unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Fix `early-init-file' value when file is missing
@ 2019-01-16  5:54 Radon Rosborough
  2019-01-23  3:47 ` Radon Rosborough
  0 siblings, 1 reply; 19+ messages in thread
From: Radon Rosborough @ 2019-01-16  5:54 UTC (permalink / raw)
  To: emacs-devel


[-- Attachment #1.1: Type: text/plain, Size: 468 bytes --]

Dear all,

In Emacs 27, when Emacs starts up without an early init-file (located
by default at ~/.emacs.d/early-init.el), the value of
`early-init-file' is set to ~/.emacs.d/early-init (note the missing
file extension). When the early init-file does exist, the variable is
set to the correct value. I have attached a patch which fixes this
bug.

Feedback is welcome. Please copy me on replies, since I am not
subscribed to emacs-devel.

Best regards,
Radon Rosborough

[-- Attachment #1.2: Type: text/html, Size: 620 bytes --]

[-- Attachment #2: 0001-Fix-early-init-file-value-when-file-is-missing.patch --]
[-- Type: application/octet-stream, Size: 1964 bytes --]

From cca8239869acf0de37cd5ae0b81a6a103be354f0 Mon Sep 17 00:00:00 2001
From: Radon Rosborough <radon.neon@gmail.com>
Date: Sun, 13 Jan 2019 21:55:42 -0700
Subject: [PATCH] Fix `early-init-file' value when file is missing

Previously, if no early init-file existed in `user-emacs-directory',
then the value of `early-init-file' after startup would be
~/.emacs.d/early-init (note the missing extension).  This commit
adjusts that value to ~/.emacs.d/early-init.el as desired, while not
changing other behavior.  Note that when the early init-file did
exist, then the value of `early-init-file' after startup was already
correct; this commit fixes a bug that occurred only when the file did
not exist.

lisp/startup.el (load-user-init-file): Update logic.
---
 lisp/startup.el | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/lisp/startup.el b/lisp/startup.el
index 1011d5f953..cd1e296686 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -923,7 +923,17 @@ load-user-init-file
               ;; user-init-file conclusively.  Don't let it be
               ;; set from default.el.
               (when (eq user-init-file t)
-                (setq user-init-file init-file-name)))
+                (setq user-init-file
+                      ;; If the init-file doesn't exist, default to
+                      ;; the .el version, not the bare filename.
+                      ;; (Practically, this means that
+                      ;; `early-init-file' will be set to the value
+                      ;; "early-init.el" rather than the more
+                      ;; confusing value "early-init" during startup
+                      ;; if the file does not exist.)
+                      (concat
+                       (file-name-sans-extension init-file-name)
+                       ".el"))))
 
             ;; If we loaded a compiled file, set `user-init-file' to
             ;; the source version if that exists.
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2019-02-16 20:26 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-16  5:54 [PATCH] Fix `early-init-file' value when file is missing Radon Rosborough
2019-01-23  3:47 ` Radon Rosborough
2019-01-29 17:24   ` Radon Rosborough
2019-01-29 17:46     ` Eli Zaretskii
2019-02-01  9:11     ` Eli Zaretskii
2019-02-01 23:10       ` Radon Rosborough
2019-02-08  7:32         ` Eli Zaretskii
2019-02-08 17:34           ` Radon Rosborough
2019-02-08 21:52             ` Eli Zaretskii
2019-02-10 23:04               ` Radon Rosborough
2019-02-10 23:14                 ` Stefan Monnier
2019-02-11 16:05                 ` Eli Zaretskii
2019-02-12  5:38                   ` Radon Rosborough
2019-02-12 16:14                     ` Eli Zaretskii
2019-02-13  2:36                       ` Radon Rosborough
2019-02-13 17:56                         ` Eli Zaretskii
2019-02-16  0:47                           ` Radon Rosborough
2019-02-16  7:17                             ` Eli Zaretskii
2019-02-16 20:26                               ` Radon Rosborough

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).