all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Radon Rosborough <radon.neon@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: [PATCH] Fix `early-init-file' value when file is missing
Date: Tue, 12 Feb 2019 18:36:20 -0800	[thread overview]
Message-ID: <CADB4rJGm6ROrJMx-0U3Z=E2TvZUqFTCNuAU6Qw+qVaVrDerxYA@mail.gmail.com> (raw)
In-Reply-To: <83o97houg9.fsf@gnu.org>


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

> if you can come up with such a safe change, I will of course gladly
> accept it.

It is attached.

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

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

From c6c94fe3d04acd21b52d4a85a334dbe6f13c45ff Mon Sep 17 00:00:00 2001
From: Radon Rosborough <radon.neon@gmail.com>
Date: Tue, 12 Feb 2019 18:34:41 -0800
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 | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/lisp/startup.el b/lisp/startup.el
index f2410f6f2c..eec025f4b6 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -923,7 +923,19 @@ 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.  But
+                      ;; for backwards compatibility, don't do this if
+                      ;; we are using the alternate filename argument
+                      ;; (so we use ~/.emacs instead of ~/.emacs.el,
+                      ;; but ~/.emacs.d/early-init.el instead of
+                      ;; ~/.emacs.d/early-init, by default).
+                      (if alternate-filename-function
+                          init-file-name
+                        (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


  reply	other threads:[~2019-02-13  2:36 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADB4rJGm6ROrJMx-0U3Z=E2TvZUqFTCNuAU6Qw+qVaVrDerxYA@mail.gmail.com' \
    --to=radon.neon@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.