emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master da4b397: Make `C-g' after `M-x' not give a backtrace unless requi


From: Lars Ingebrigtsen
Subject: master da4b397: Make `C-g' after `M-x' not give a backtrace unless required
Date: Wed, 21 Jul 2021 10:54:02 -0400 (EDT)

branch: master
commit da4b3973deb5eb271d79568092ad25560b65dbf8
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    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.
---
 src/eval.c     | 14 +++++++++++++-
 src/keyboard.c |  4 ++--
 src/lisp.h     |  1 +
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/eval.c b/src/eval.c
index b76ced7..ddf7e70 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 db93468..3811807 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 b3f1dc1..80efd77 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:



reply via email to

[Prev in Thread] Current Thread [Next in Thread]