bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#59334: 29.0.50; loading native-compiled init file sets user-init-fil


From: Eli Zaretskii
Subject: bug#59334: 29.0.50; loading native-compiled init file sets user-init-file to .eln
Date: Thu, 17 Nov 2022 16:00:11 +0200

> From: Juanma Barranquero <lekktu@gmail.com>
> Date: Thu, 17 Nov 2022 14:30:27 +0100
> Cc: 59334@debbugs.gnu.org
> 
> M-: (gethash "init-7890dda9-d677a456.eln" comp-eln-to-el-h) RET
> 
> => "d:/mypath/Home/.emacs.d/init.el"

OK, thanks.  So using this, can you propose a patch for
startup--load-user-init-file, where it figures out the name of
user-init-file?  It happens in this fragment:

            ;; If we loaded a compiled file, set `user-init-file' to
            ;; the source version if that exists.
            (when (equal (file-name-extension user-init-file)
                         "elc")
              (let* ((source (file-name-sans-extension user-init-file))
                     (alt (concat source ".el")))
                (setq source (cond ((file-exists-p alt) alt)
                                   ((file-exists-p source) source)
                                   (t nil)))
                (when source
                  (when (file-newer-than-file-p source user-init-file)
                    (message "Warning: %s is newer than %s"
                             source user-init-file)
                    (sit-for 1))
                  (setq user-init-file source))))

Note that the gethash trick I suggested needs a _basename_ of the .eln
file, without any leading directories.

(It is best if you propose a patch because it should be easy for you
to test it.)

Andrea, do you agree with this solution?





reply via email to

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