emacs-diffs
[Top][All Lists]
Advanced

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

master 3a50773ab00: startup.el: Don't override init.el custom of `debug-


From: Stefan Monnier
Subject: master 3a50773ab00: startup.el: Don't override init.el custom of `debug-ignored-errors`
Date: Mon, 26 Jun 2023 11:25:27 -0400 (EDT)

branch: master
commit 3a50773ab0071addba98249d26c309f5fb78bd74
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    startup.el: Don't override init.el custom of `debug-ignored-errors`
    
    * lisp/startup.el (startup--load-user-init-file): Undo commit 4302bc9b0f12.
    Mimic the code we use for `debug-on-error` instead.
---
 lisp/startup.el | 44 +++++++++++++++++++++-----------------------
 1 file changed, 21 insertions(+), 23 deletions(-)

diff --git a/lisp/startup.el b/lisp/startup.el
index 484c8f57a9f..5a389294e78 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1025,13 +1025,21 @@ init-file, or to a default value if loading is not 
possible."
         (debug-on-error-should-be-set nil)
         (debug-on-error-initial
          (if (eq init-file-debug t)
-             'startup
+             'startup--witness  ;Dummy but recognizable non-nil value.
            init-file-debug))
+        (d-i-e-from-init-file nil)
+        (d-i-e-initial
+         ;; 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))
         ;; The init file might contain byte-code with embedded NULs,
         ;; which can cause problems when read back, so disable nul
         ;; byte detection.  (Bug#52554)
         (inhibit-null-byte-detection t))
-    (let ((debug-on-error debug-on-error-initial))
+    (let ((debug-on-error debug-on-error-initial)
+          ;; If they specified --debug-init, enter the debugger
+          ;; on any error whatsoever.
+          (debug-ignored-errors d-i-e-initial))
       (condition-case-unless-debug error
           (when init-file-user
             (let ((init-file-name (funcall filename-function)))
@@ -1041,17 +1049,11 @@ init-file, or to a default value if loading is not 
possible."
               ;; `user-init-file'.
               (setq user-init-file t)
              (when init-file-name
-                ;; If they specified --debug-init, enter the debugger
-                ;; on any error whatsoever.
-                (let ((debug-ignored-errors
-                       (if (and init-file-debug (not noninteractive))
-                           nil
-                         debug-ignored-errors)))
-                 (load (if (equal (file-name-extension init-file-name)
-                                  "el")
-                           (file-name-sans-extension init-file-name)
-                         init-file-name)
-                       'noerror 'nomessage)))
+               (load (if (equal (file-name-extension init-file-name)
+                                "el")
+                         (file-name-sans-extension init-file-name)
+                       init-file-name)
+                     'noerror 'nomessage))
 
               (when (and (eq user-init-file t) alternate-filename-function)
                 (let ((alt-file (funcall alternate-filename-function)))
@@ -1059,11 +1061,7 @@ init-file, or to a default value if loading is not 
possible."
                    (setq init-file-name alt-file))
                   (and (equal (file-name-extension alt-file) "el")
                        (setq alt-file (file-name-sans-extension alt-file)))
-                  (let ((debug-ignored-errors
-                         (if (and init-file-debug (not noninteractive))
-                             nil
-                           debug-ignored-errors)))
-                    (load alt-file 'noerror 'nomessage))))
+                  (load alt-file 'noerror 'nomessage)))
 
               ;; If we did not find the user's init file, set
               ;; user-init-file conclusively.  Don't let it be
@@ -1102,11 +1100,7 @@ init-file, or to a default value if loading is not 
possible."
                        (not inhibit-default-init))
               ;; Prevent default.el from changing the value of
               ;; `inhibit-startup-screen'.
-              (let ((inhibit-startup-screen nil)
-                    (debug-ignored-errors
-                     (if (and init-file-debug (not noninteractive))
-                         nil
-                       debug-ignored-errors)))
+              (let ((inhibit-startup-screen nil))
                 (load "default" 'noerror 'nomessage))))
         (error
          (display-warning
@@ -1126,10 +1120,14 @@ 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)))
       (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)))
 
+    (when d-i-e-from-init-file
+      (setq debug-ignored-errors (car d-i-e-from-init-file)))
     (when debug-on-error-should-be-set
       (setq debug-on-error debug-on-error-from-init-file))))
 



reply via email to

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