Subject: 30.1; --debug-init and condition-case-unless-debug

From: "Nussbaum Ferdinand" <[email-masked]>
Date: Tue, 11 Mar 2025 17:13:56 +0000

Errors inside condition-case-unless-debug do not trigger the debugger when the
--debug-init startup option is set (and debug-on-error is not additionally and
explicitly set to a non-nil value).

This can be reproduced, for example, by adding the following to init.el:

(condition-case-unless-debug nil
    (error "error")
  (error
   (message "error caught")))

and restarting Emacs with --debug-init. In Emacs 29 this enters the debugger
(as expected), while in Emacs 30 the message "error caught" is displayed.

On a related note, the Emacs Lisp reference manual still says the following: "[...]
use the option ‘--debug-init’. This binds debug-on-error to t while loading the
init file, [...]".
(https://www.gnu.org/software/emacs/manual/html_node/elisp/Error-Debugging.html#Error-Debugging)
AFAICT this is no longer correct since the implementation uses handler-bind instead.

(Originally reported in https://github.com/syl20bnr/spacemacs/issues/16871
and https://github.com/syl20bnr/spacemacs/issues/16619#issuecomment-2708510954.)

Best,
Ferdinand