diff options
| author | Eli Zaretskii | 2023-08-17 21:35:20 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2023-08-17 21:35:20 +0300 |
| commit | 3685387e609753293c4518be75e77c659c3b2d8d (patch) | |
| tree | 0cc2bf25e73fd20fc279e55bc53207050f41ac89 | |
| parent | 39e0121354c25919c20786782da0c5f1952278a8 (diff) | |
| download | emacs-3685387e609753293c4518be75e77c659c3b2d8d.tar.gz emacs-3685387e609753293c4518be75e77c659c3b2d8d.zip | |
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)
| -rw-r--r-- | lisp/startup.el | 13 | ||||
| -rw-r--r-- | 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." | |||
| 1023 | ;; Use (startup--witness) instead of nil, so we can detect when the | 1023 | ;; Use (startup--witness) instead of nil, so we can detect when the |
| 1024 | ;; init files set `debug-ignored-errors' to nil. | 1024 | ;; init files set `debug-ignored-errors' to nil. |
| 1025 | (if init-file-debug '(startup--witness) debug-ignored-errors)) | 1025 | (if init-file-debug '(startup--witness) debug-ignored-errors)) |
| 1026 | (d-i-e-standard debug-ignored-errors) | ||
| 1026 | ;; The init file might contain byte-code with embedded NULs, | 1027 | ;; The init file might contain byte-code with embedded NULs, |
| 1027 | ;; which can cause problems when read back, so disable nul | 1028 | ;; which can cause problems when read back, so disable nul |
| 1028 | ;; byte detection. (Bug#52554) | 1029 | ;; byte detection. (Bug#52554) |
| @@ -1111,8 +1112,16 @@ the `--debug-init' option to view a complete error backtrace." | |||
| 1111 | 1112 | ||
| 1112 | ;; If we can tell that the init file altered debug-on-error, | 1113 | ;; If we can tell that the init file altered debug-on-error, |
| 1113 | ;; arrange to preserve the value that it set up. | 1114 | ;; arrange to preserve the value that it set up. |
| 1114 | (or (eq debug-ignored-errors d-i-e-initial) | 1115 | (unless (eq debug-ignored-errors d-i-e-initial) |
| 1115 | (setq d-i-e-from-init-file (list debug-ignored-errors))) | 1116 | (if (memq 'startup--witness debug-ignored-errors) |
| 1117 | ;; The init file wants to add errors to the standard | ||
| 1118 | ;; value, so we need to emulate that. | ||
| 1119 | (setq d-i-e-from-init-file | ||
| 1120 | (list (append d-i-e-standard | ||
| 1121 | (remq 'startup--witness | ||
| 1122 | debug-ignored-errors)))) | ||
| 1123 | ;; The init file _replaces_ the standard value. | ||
| 1124 | (setq d-i-e-from-init-file (list debug-ignored-errors)))) | ||
| 1116 | (or (eq debug-on-error debug-on-error-initial) | 1125 | (or (eq debug-on-error debug-on-error-initial) |
| 1117 | (setq debug-on-error-should-be-set t | 1126 | (setq debug-on-error-should-be-set t |
| 1118 | debug-on-error-from-init-file debug-on-error))) | 1127 | 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'. */); | |||
| 4296 | Each element may be a condition-name or a regexp that matches error messages. | 4296 | Each element may be a condition-name or a regexp that matches error messages. |
| 4297 | If any element applies to a given error, that error skips the debugger | 4297 | If any element applies to a given error, that error skips the debugger |
| 4298 | and just returns to top level. | 4298 | and just returns to top level. |
| 4299 | If you invoke Emacs with --debug-init, and want to remove some | ||
| 4300 | elements from the default value of this variable, use `setq' to | ||
| 4301 | change the value of the variable to a new list, rather than `delq' | ||
| 4302 | to remove some errors from the list. | ||
| 4299 | This overrides the variable `debug-on-error'. | 4303 | This overrides the variable `debug-on-error'. |
| 4300 | It does not apply to errors handled by `condition-case'. */); | 4304 | It does not apply to errors handled by `condition-case'. */); |
| 4301 | Vdebug_ignored_errors = Qnil; | 4305 | Vdebug_ignored_errors = Qnil; |