GNU bug report logs - #64163
29.0.92; Syntactic errors in early init when --debug-init is on

Previous Next

Package: emacs;

Reported by: Sebastian Miele <iota <at> whxvd.name>

Date: Mon, 19 Jun 2023 10:45:01 UTC

Severity: normal

Found in version 29.0.92

Full log


Message #8 received at 64163 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Sebastian Miele <iota <at> whxvd.name>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 64163 <at> debbugs.gnu.org
Subject: Re: bug#64163: 29.0.92;
 Syntactic errors in early init when --debug-init is on
Date: Tue, 20 Jun 2023 16:27:24 +0300
> From: Sebastian Miele <iota <at> whxvd.name>
> Date: Mon, 19 Jun 2023 12:27:09 +0200
> 
> Create a $DIR with an early-init.el containing just '(' and an init.el
> with just '(error "Later")'.
> 
> Then running
> 
>   src/emacs --init-directory=$DIR
> 
> produces a warning buffer that lists both errors in order.  However,
> when running
> 
>   src/emacs --init-directory=$DIR --debug-init
> 
> the debugger triggers on the error "Later", without any mention of the
> error in the early init file.  This is unexpected.

First, the --init-directory=$DIR part is not relevant to the issue;
the same happens if you place such init files in your "normal" home
directory.

More to the point, that error in early-init.el does not trigger a
backtrace because 'end-of-file' error is in the list that is the value
of debug-ignored-errors.  So this problem is specific to that
particular kind of error in early-init.el.  If you trigger some other
error, which is not in the list of ignored ones, you will see a
backtrace.

IOW, this is the expected behavior.

I wonder whether the patch below could be the solution to this.
Stefan, WDYT?  Should we perhaps condition this binding by more
conditions, like only do this in interactive invocations or something?

diff --git a/lisp/startup.el b/lisp/startup.el
index b0f019d..bf16f14 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1030,7 +1030,8 @@ startup--load-user-init-file
     (let ((debug-on-error debug-on-error-initial))
       (condition-case-unless-debug error
           (when init-file-user
-            (let ((init-file-name (funcall filename-function)))
+            (let ((init-file-name (funcall filename-function))
+                  (debug-ignored-errors nil))
 
               ;; If `user-init-file' is t, then `load' will store
               ;; the name of the file that it loads into




This bug report was last modified 2 years and 50 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.