aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiha Rihtaršič2021-09-01 10:10:44 +0200
committerLars Ingebrigtsen2021-09-01 10:10:44 +0200
commit45793b195cf36adfff26d94e65e15429ff9c2235 (patch)
treefccba86cb073623285d866bedd3a010c047612fe /src
parenta0be0cdbd23947e59b4108125a20c7f9c800a052 (diff)
downloademacs-45793b195cf36adfff26d94e65e15429ff9c2235.tar.gz
emacs-45793b195cf36adfff26d94e65e15429ff9c2235.zip
In batch mode, avoid killing Emacs with C-g in the minibuffer
* src/keyboard.c (Fcommand_error_default_function): Don't kill emacs when handling the minibuffer-quit condition (bug#48603).
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 81ff9df153d..6a8c33ae3b6 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1009,25 +1009,28 @@ Default value of `command-error-function'. */)
1009 (Lisp_Object data, Lisp_Object context, Lisp_Object signal) 1009 (Lisp_Object data, Lisp_Object context, Lisp_Object signal)
1010{ 1010{
1011 struct frame *sf = SELECTED_FRAME (); 1011 struct frame *sf = SELECTED_FRAME ();
1012 Lisp_Object conditions; 1012 Lisp_Object conditions = Fget (XCAR (data), Qerror_conditions);
1013 int is_minibuffer_quit = !NILP (Fmemq (Qminibuffer_quit, conditions));
1013 1014
1014 CHECK_STRING (context); 1015 CHECK_STRING (context);
1015 1016
1016 /* If the window system or terminal frame hasn't been initialized 1017 /* If the window system or terminal frame hasn't been initialized
1017 yet, or we're not interactive, write the message to stderr and exit. */ 1018 yet, or we're not interactive, write the message to stderr and exit.
1018 if (!sf->glyphs_initialized_p 1019 Don't do this for the minibuffer-quit condition. */
1019 /* The initial frame is a special non-displaying frame. It 1020 if (!is_minibuffer_quit
1020 will be current in daemon mode when there are no frames 1021 && (!sf->glyphs_initialized_p
1021 to display, and in non-daemon mode before the real frame 1022 /* The initial frame is a special non-displaying frame. It
1022 has finished initializing. If an error is thrown in the 1023 will be current in daemon mode when there are no frames
1023 latter case while creating the frame, then the frame 1024 to display, and in non-daemon mode before the real frame
1024 will never be displayed, so the safest thing to do is 1025 has finished initializing. If an error is thrown in the
1025 write to stderr and quit. In daemon mode, there are 1026 latter case while creating the frame, then the frame
1026 many other potential errors that do not prevent frames 1027 will never be displayed, so the safest thing to do is
1027 from being created, so continuing as normal is better in 1028 write to stderr and quit. In daemon mode, there are
1028 that case. */ 1029 many other potential errors that do not prevent frames
1029 || (!IS_DAEMON && FRAME_INITIAL_P (sf)) 1030 from being created, so continuing as normal is better in
1030 || noninteractive) 1031 that case. */
1032 || (!IS_DAEMON && FRAME_INITIAL_P (sf))
1033 || noninteractive))
1031 { 1034 {
1032 print_error_message (data, Qexternal_debugging_output, 1035 print_error_message (data, Qexternal_debugging_output,
1033 SSDATA (context), signal); 1036 SSDATA (context), signal);
@@ -1036,12 +1039,10 @@ Default value of `command-error-function'. */)
1036 } 1039 }
1037 else 1040 else
1038 { 1041 {
1039 conditions = Fget (XCAR (data), Qerror_conditions);
1040
1041 clear_message (1, 0); 1042 clear_message (1, 0);
1042 message_log_maybe_newline (); 1043 message_log_maybe_newline ();
1043 1044
1044 if (!NILP (Fmemq (Qminibuffer_quit, conditions))) 1045 if (is_minibuffer_quit)
1045 { 1046 {
1046 Fding (Qt); 1047 Fding (Qt);
1047 } 1048 }