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.
This commit is contained in:
14
src/eval.c
14
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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user