emacs-diffs
[Top][All Lists]
Advanced

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

master 3685387e609: Fix invocation with --debug-init and changes to debu


From: Eli Zaretskii
Subject: master 3685387e609: Fix invocation with --debug-init and changes to debug-ignored-errors
Date: Thu, 17 Aug 2023 14:36:37 -0400 (EDT)

branch: master
commit 3685387e609753293c4518be75e77c659c3b2d8d
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix invocation with --debug-init and changes to debug-ignored-errors
    
    * src/eval.c (syms_of_eval) <debug-ignored-errors>: Mention in the
    doc string the caveat with removing errors from the standard value
    while invoking Emacs with --debug-init.
    
    * lisp/startup.el (startup--load-user-init-file): If the user's
    init files add to the value of 'debug-ignored-errors', make sure
    the additions are preserved after restoring the value we reset
    during loading the init file, if Emacs was invoked with
    "--debug-init".  (Bug#65267)
---
 lisp/startup.el | 13 +++++++++++--
 src/eval.c      |  4 ++++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/lisp/startup.el b/lisp/startup.el
index 43d6bf7fd59..4d0e59ba4f3 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1023,6 +1023,7 @@ init-file, or to a default value if loading is not 
possible."
          ;; Use (startup--witness) instead of nil, so we can detect when the
          ;; init files set `debug-ignored-errors' to nil.
          (if init-file-debug '(startup--witness) debug-ignored-errors))
+        (d-i-e-standard debug-ignored-errors)
         ;; The init file might contain byte-code with embedded NULs,
         ;; which can cause problems when read back, so disable nul
         ;; byte detection.  (Bug#52554)
@@ -1111,8 +1112,16 @@ the `--debug-init' option to view a complete error 
backtrace."
 
       ;; If we can tell that the init file altered debug-on-error,
       ;; arrange to preserve the value that it set up.
-      (or (eq debug-ignored-errors d-i-e-initial)
-          (setq d-i-e-from-init-file (list debug-ignored-errors)))
+      (unless (eq debug-ignored-errors d-i-e-initial)
+        (if (memq 'startup--witness debug-ignored-errors)
+            ;; The init file wants to add errors to the standard
+            ;; value, so we need to emulate that.
+            (setq d-i-e-from-init-file
+                  (list (append d-i-e-standard
+                                (remq 'startup--witness
+                                      debug-ignored-errors))))
+          ;; The init file _replaces_ the standard value.
+          (setq d-i-e-from-init-file (list debug-ignored-errors))))
       (or (eq debug-on-error debug-on-error-initial)
           (setq debug-on-error-should-be-set t
                 debug-on-error-from-init-file debug-on-error)))
diff --git a/src/eval.c b/src/eval.c
index 9e54d489a3b..9268b65aa85 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -4296,6 +4296,10 @@ See also the variable `debug-on-quit' and 
`inhibit-debugger'.  */);
 Each element may be a condition-name or a regexp that matches error messages.
 If any element applies to a given error, that error skips the debugger
 and just returns to top level.
+If you invoke Emacs with --debug-init, and want to remove some
+elements from the default value of this variable, use `setq' to
+change the value of the variable to a new list, rather than `delq'
+to remove some errors from the list.
 This overrides the variable `debug-on-error'.
 It does not apply to errors handled by `condition-case'.  */);
   Vdebug_ignored_errors = Qnil;



reply via email to

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