summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2026-05-01 13:17:20 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2026-05-04 12:49:35 -0400
commita952324e9be37869158e8a9cc4f676fa6113a343 (patch)
treeac60bdadf2e66a1fd940f3b5e84a8b752fea54d3 /doc
parent9c0a699c59ebe127950cf561b98a40f6e5916a03 (diff)
keyboard.c: Allow SIGINT to `quit` in batch mode, instead of exit
In terminal sessions, SIGINT is turned into a `quit` ELisp signal, but in batch it has traditionally killed Emacs. It can be very useful to cause a `quit` from outside the process when running in batch (e.g. for "batch" sessions that provide a REPL via stdin/out), so add a new var 'kill-emacs-on-sigint' to control that behavior. (bug#80942) * src/keyboard.c (handle_interrupt_signal): Obey `kill_emacs_on_sigint`. (init_keyboard): Use `deliver_interrupt_signal` for SIGINT also for batch sessions. (syms_of_keyboard): New variable `kill_emacs_on_sigint`. * test/src/keyboard-tests.el (keyboard-sigint-to-quit): New test. * doc/emacs/cmdargs.texi (Initial Options): Mention the effect of `kill-emacs-on-sigint` in batch mode.
Diffstat (limited to 'doc')
-rw-r--r--doc/emacs/cmdargs.texi7
1 files changed, 6 insertions, 1 deletions
diff --git a/doc/emacs/cmdargs.texi b/doc/emacs/cmdargs.texi
index 5a3c1c14ab1..f9904d1f2e6 100644
--- a/doc/emacs/cmdargs.texi
+++ b/doc/emacs/cmdargs.texi
@@ -260,9 +260,14 @@ on. To invoke a Lisp program, use the @samp{-batch} option in
conjunction with one or more of @samp{-l}, @samp{-f} or @samp{--eval}
(@pxref{Action Arguments}). @xref{Command Example}, for an example.
+@vindex kill-emacs-on-sigint
In batch mode, Emacs does not display the text being edited, and the
standard terminal interrupt characters such as @kbd{C-z} and @kbd{C-c}
-have their usual effect. Emacs functions that normally print a
+have their usual effect: for @kbd{C-c} that effect is either to
+exit Emacs or to signal @code{quit}, depending on the variable
+@code{kill-emacs-on-sigint}.
+
+Emacs functions that normally print a
message in the echo area will print to either the standard output
stream (@code{stdout}) or the standard error stream (@code{stderr})
instead. (To be precise, functions like @code{prin1}, @code{princ}