aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2021-07-21 16:53:54 +0200
committerLars Ingebrigtsen2021-07-21 16:53:54 +0200
commitda4b3973deb5eb271d79568092ad25560b65dbf8 (patch)
tree6d38e326f3529472159b3aca3fa3ab9999d5e1a5
parente3b8ddd5005903465ec86823559a2e884c7b13f2 (diff)
downloademacs-da4b3973deb5eb271d79568092ad25560b65dbf8.tar.gz
emacs-da4b3973deb5eb271d79568092ad25560b65dbf8.zip
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.
-rw-r--r--src/eval.c14
-rw-r--r--src/keyboard.c4
-rw-r--r--src/lisp.h1
3 files changed, 16 insertions, 3 deletions
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)
2026 return 0; 2026 return 0;
2027} 2027}
2028 2028
2029/* Say whether SIGNAL is a `quit' symbol (or inherits from it). */
2030bool
2031signal_quit_p (Lisp_Object signal)
2032{
2033 Lisp_Object list;
2034
2035 return EQ (signal, Qquit)
2036 || (Fsymbolp (signal)
2037 && CONSP (list = Fget (signal, Qerror_conditions))
2038 && Fmemq (Qquit, list));
2039}
2040
2029/* Call the debugger if calling it is currently enabled for CONDITIONS. 2041/* Call the debugger if calling it is currently enabled for CONDITIONS.
2030 SIG and DATA describe the signal. There are two ways to pass them: 2042 SIG and DATA describe the signal. There are two ways to pass them:
2031 = SIG is the error symbol, and DATA is the rest of the data. 2043 = 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)
2044 ! input_blocked_p () 2056 ! input_blocked_p ()
2045 && NILP (Vinhibit_debugger) 2057 && NILP (Vinhibit_debugger)
2046 /* Does user want to enter debugger for this kind of error? */ 2058 /* Does user want to enter debugger for this kind of error? */
2047 && (EQ (sig, Qquit) 2059 && (signal_quit_p (sig)
2048 ? debug_on_quit 2060 ? debug_on_quit
2049 : wants_debugger (Vdebug_on_error, conditions)) 2061 : wants_debugger (Vdebug_on_error, conditions))
2050 && ! skip_debugger (conditions, combined_data) 2062 && ! 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)
985{ 985{
986 /* The immediate context is not interesting for Quits, 986 /* The immediate context is not interesting for Quits,
987 since they are asynchronous. */ 987 since they are asynchronous. */
988 if (EQ (XCAR (data), Qquit)) 988 if (signal_quit_p (XCAR (data)))
989 Vsignaling_function = Qnil; 989 Vsignaling_function = Qnil;
990 990
991 Vquit_flag = Qnil; 991 Vquit_flag = Qnil;
@@ -7634,7 +7634,7 @@ menu_item_eval_property_1 (Lisp_Object arg)
7634{ 7634{
7635 /* If we got a quit from within the menu computation, 7635 /* If we got a quit from within the menu computation,
7636 quit all the way out of it. This takes care of C-] in the debugger. */ 7636 quit all the way out of it. This takes care of C-] in the debugger. */
7637 if (CONSP (arg) && EQ (XCAR (arg), Qquit)) 7637 if (CONSP (arg) && signal_quit_p (XCAR (arg)))
7638 quit (); 7638 quit ();
7639 7639
7640 return Qnil; 7640 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;
4116extern Lisp_Object Vrun_hooks; 4116extern Lisp_Object Vrun_hooks;
4117extern Lisp_Object Vsignaling_function; 4117extern Lisp_Object Vsignaling_function;
4118extern Lisp_Object inhibit_lisp_code; 4118extern Lisp_Object inhibit_lisp_code;
4119extern bool signal_quit_p (Lisp_Object);
4119 4120
4120/* To run a normal hook, use the appropriate function from the list below. 4121/* To run a normal hook, use the appropriate function from the list below.
4121 The calling convention: 4122 The calling convention: