From: Lars Ingebrigtsen Date: Wed, 21 Jul 2021 14:53:54 +0000 (+0200) Subject: Make `C-g' after `M-x' not give a backtrace unless required X-Git-Tag: emacs-28.0.90~1765 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=da4b3973deb5eb271d79568092ad25560b65dbf8;p=emacs.git Make `C-g' after `M-x' not give a backtrace unless required * src/eval.c (signal_quit_p): New function. (maybe_call_debugger): React to all `quit' signals (bug#49675). * src/keyboard.c (cmd_error_internal, menu_item_eval_property_1): Ditto. --- diff --git a/src/eval.c b/src/eval.c index b76ced79d61..ddf7e703fc2 100644 --- a/src/eval.c +++ b/src/eval.c @@ -2026,6 +2026,18 @@ skip_debugger (Lisp_Object conditions, Lisp_Object data) return 0; } +/* Say whether SIGNAL is a `quit' symbol (or inherits from it). */ +bool +signal_quit_p (Lisp_Object signal) +{ + Lisp_Object list; + + return EQ (signal, Qquit) + || (Fsymbolp (signal) + && CONSP (list = Fget (signal, Qerror_conditions)) + && Fmemq (Qquit, list)); +} + /* Call the debugger if calling it is currently enabled for CONDITIONS. SIG and DATA describe the signal. There are two ways to pass them: = SIG is the error symbol, and DATA is the rest of the data. @@ -2044,7 +2056,7 @@ maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig, Lisp_Object data) ! input_blocked_p () && NILP (Vinhibit_debugger) /* Does user want to enter debugger for this kind of error? */ - && (EQ (sig, Qquit) + && (signal_quit_p (sig) ? debug_on_quit : wants_debugger (Vdebug_on_error, conditions)) && ! skip_debugger (conditions, combined_data) diff --git a/src/keyboard.c b/src/keyboard.c index db934686594..38118071a80 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -985,7 +985,7 @@ cmd_error_internal (Lisp_Object data, const char *context) { /* The immediate context is not interesting for Quits, since they are asynchronous. */ - if (EQ (XCAR (data), Qquit)) + if (signal_quit_p (XCAR (data))) Vsignaling_function = Qnil; Vquit_flag = Qnil; @@ -7634,7 +7634,7 @@ menu_item_eval_property_1 (Lisp_Object arg) { /* If we got a quit from within the menu computation, quit all the way out of it. This takes care of C-] in the debugger. */ - if (CONSP (arg) && EQ (XCAR (arg), Qquit)) + if (CONSP (arg) && signal_quit_p (XCAR (arg))) quit (); return Qnil; diff --git a/src/lisp.h b/src/lisp.h index b3f1dc16b13..80efd771139 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -4116,6 +4116,7 @@ extern Lisp_Object Vautoload_queue; extern Lisp_Object Vrun_hooks; extern Lisp_Object Vsignaling_function; extern Lisp_Object inhibit_lisp_code; +extern bool signal_quit_p (Lisp_Object); /* To run a normal hook, use the appropriate function from the list below. The calling convention: