GNU bug report logs -
#45197
Saving customizations makes ~/.config/emacs/init (no .el extension)
Previous Next
Reported by: tsuucat <tsuucat <at> icloud.com>
Date: Sat, 12 Dec 2020 18:20:01 UTC
Severity: normal
Tags: confirmed, fixed
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 45197 in the body.
You can then email your comments to 45197 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#45197
; Package
emacs
.
(Sat, 12 Dec 2020 18:20:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
tsuucat <tsuucat <at> icloud.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sat, 12 Dec 2020 18:20:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Subject says all.
How to reproduce:
1. $ cd /tmp
2. $ mkdir -p test-home/.config/emacs
3. $ cd test-home
4. $ HOME=$PWD emacs
5. M-x customize, edit something and Save for Future Sessions.
=> Wrote /tmp/test-home/.config/emacs/init
init (not init.el) is created.
This is because user-init-file is set to “/tmp/test-home/.config/emacs/init”.
Emacs manual doesn’t refer ~/.config/emacs/init so I think this is not intended.
Changing
(lambda ()
(expand-file-name
“init"
startup-init-directory))
to
(lambda ()
(expand-file-name
“init.el"
startup-init-directory))
in startup.el
maybe solve this (like early-init.el)?
--
tsuucat
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#45197
; Package
emacs
.
(Mon, 14 Dec 2020 17:13:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 45197 <at> debbugs.gnu.org (full text, mbox):
tsuucat <tsuucat <at> icloud.com> writes:
> This is because user-init-file is set to “/tmp/test-home/.config/emacs/init”.
This was part of:
Add early init file, stop package-initialize insertion
Discussion on emacs-devel leading up to this change (approximately 150
messages):
- https://lists.gnu.org/archive/html/emacs-devel/2017-08/msg00154.html
- https://lists.gnu.org/archive/html/emacs-devel/2017-08/msg00433.html
- https://lists.gnu.org/archive/html/emacs-devel/2017-09/msg00023.html
- https://lists.gnu.org/archive/html/emacs-devel/2017-09/msg00599.html
- https://lists.gnu.org/archive/html/emacs-devel/2017-10/msg00332.html
I did not read those 150 messages, and this code is uncommented in
startup.el:
(lambda ()
(expand-file-name
"init"
startup-init-directory))
Does anybody know whether this is just a typo?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Added tag(s) confirmed.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Mon, 14 Dec 2020 17:13:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#45197
; Package
emacs
.
(Mon, 14 Dec 2020 17:24:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 45197 <at> debbugs.gnu.org (full text, mbox):
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
> tsuucat <tsuucat <at> icloud.com> writes:
> I did not read those 150 messages, and this code is uncommented in
> startup.el:
>
> (lambda ()
> (expand-file-name
> "init"
> startup-init-directory))
>
> Does anybody know whether this is just a typo?
Iʼm not sure it is. startup--load-user-init-file does this:
(when (and (eq user-init-file t) alternate-filename-function)
(let ((alt-file (funcall alternate-filename-function)))
(and (equal (file-name-extension alt-file) "el")
(setq alt-file (file-name-sans-extension alt-file)))
(unless init-file-name
(setq init-file-name alt-file))
(load alt-file 'noerror 'nomessage)))
which makes me wonder if itʼs trying to cater for people who compile
their init.el file, since this code doesnʼt actually probe the
filesystem, but presumably later we do (load init-file-name), which
will match .elc and .el suffixes.
Robert
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#45197
; Package
emacs
.
(Mon, 14 Dec 2020 17:47:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 45197 <at> debbugs.gnu.org (full text, mbox):
> I did not read those 150 messages, and this code is uncommented in
> startup.el:
>
> (lambda ()
> (expand-file-name
> "init"
> startup-init-directory))
I found the explicit .el extension of "early-init.el” in startup.el is from
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=3d9a56f00040cbfc8fb92c4379344d7e91e2dff2.
--
tsuucat
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#45197
; Package
emacs
.
(Mon, 14 Dec 2020 17:54:01 GMT)
Full text and
rfc822 format available.
Message #19 received at 45197 <at> debbugs.gnu.org (full text, mbox):
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Date: Mon, 14 Dec 2020 18:11:49 +0100
> Cc: 45197 <at> debbugs.gnu.org
>
> I did not read those 150 messages, and this code is uncommented in
> startup.el:
>
> (lambda ()
> (expand-file-name
> "init"
> startup-init-directory))
>
> Does anybody know whether this is just a typo?
It isn't: the code later tries appending .el to the name.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#45197
; Package
emacs
.
(Tue, 15 Dec 2020 06:16:02 GMT)
Full text and
rfc822 format available.
Message #22 received at 45197 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
>> I did not read those 150 messages, and this code is uncommented in
>> startup.el:
>>
>> (lambda ()
>> (expand-file-name
>> "init"
>> startup-init-directory))
>>
>> Does anybody know whether this is just a typo?
>
> It isn't: the code later tries appending .el to the name.
The code flow isn't trivial to follow here, but this is the code:
(when (and (eq user-init-file t) alternate-filename-function)
(let ((alt-file (funcall alternate-filename-function)))
(and (equal (file-name-extension alt-file) "el")
(setq alt-file (file-name-sans-extension alt-file)))
(unless init-file-name
(setq init-file-name alt-file))
(load alt-file 'noerror 'nomessage)))
;; If we did not find the user's init file, set
;; 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)))
alternate-filename-function is the lambda up there, so it's
"/tmp/test-home/.config/emacs/init". So this always sets user-init-file
to the .el-less file name. (Well, it would have even if the alternate
file name had ended in ".el".)
That makes sense for making a file name for `load' (so that it'll load
the .elc file, if it exists), but setting `user-init-file' to that
.el-less name sounds like the problem here?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#45197
; Package
emacs
.
(Tue, 15 Dec 2020 16:24:02 GMT)
Full text and
rfc822 format available.
Message #25 received at 45197 <at> debbugs.gnu.org (full text, mbox):
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Cc: tsuucat <at> icloud.com, 45197 <at> debbugs.gnu.org
> Date: Tue, 15 Dec 2020 07:14:58 +0100
>
> alternate-filename-function is the lambda up there, so it's
> "/tmp/test-home/.config/emacs/init". So this always sets user-init-file
> to the .el-less file name. (Well, it would have even if the alternate
> file name had ended in ".el".)
>
> That makes sense for making a file name for `load' (so that it'll load
> the .elc file, if it exists), but setting `user-init-file' to that
> .el-less name sounds like the problem here?
I'm not arguing against the fact that there's a bug, I'm just saying
that there's code which was supposed to handle this, and I think
that's where this should be fixed.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#45197
; Package
emacs
.
(Wed, 16 Dec 2020 01:49:02 GMT)
Full text and
rfc822 format available.
Message #28 received at 45197 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
(unless init-file-name
(setq init-file-name alt-file))
is added
in https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=4118297ae2fab4886b20d193ba511a229637aea3.
Before this commit, I think ‘.emacs’ is always used for ‘user-init-file’ value if
init file is missing.
(and (equal (file-name-extension alt-file) "el")
(setq alt-file (file-name-sans-extension alt-file)))
...
(load alt-file 'noerror 'nomessage)))
should be also changed in the commit to use “init.el” not “init".
> 2020/12/16 1:23、Eli Zaretskii <eliz <at> gnu.org>:
>
>> From: Lars Ingebrigtsen <larsi <at> gnus.org>
>> Cc: tsuucat <at> icloud.com, 45197 <at> debbugs.gnu.org
>> Date: Tue, 15 Dec 2020 07:14:58 +0100
>>
>> alternate-filename-function is the lambda up there, so it's
>> "/tmp/test-home/.config/emacs/init". So this always sets user-init-file
>> to the .el-less file name. (Well, it would have even if the alternate
>> file name had ended in ".el".)
>>
>> That makes sense for making a file name for `load' (so that it'll load
>> the .elc file, if it exists), but setting `user-init-file' to that
>> .el-less name sounds like the problem here?
>
> I'm not arguing against the fact that there's a bug, I'm just saying
> that there's code which was supposed to handle this, and I think
> that's where this should be fixed.
I can’t find such a code.
I made a patch to set 'user-init-file' value to init”.el" for XDG convention users
who do not have an init file.
(But alternate-filename-function is only used for "init.el” so
...(if (equal (file-name-extension alt-file)
"el")
(file-name-sans-extension alt-file)
alt-file)...
may be redundant.)
--
tsuucat
[0001-Fix-user-init-file-value-when-file-is-missing-in-XDG.patch (application/octet-stream, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#45197
; Package
emacs
.
(Thu, 17 Dec 2020 11:19:01 GMT)
Full text and
rfc822 format available.
Message #31 received at 45197 <at> debbugs.gnu.org (full text, mbox):
tsuucat <tsuucat <at> icloud.com> writes:
> (unless init-file-name
> (setq init-file-name alt-file))
> is added
> in https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=4118297ae2fab4886b20d193ba511a229637aea3.
>
> Before this commit, I think ‘.emacs’ is always used for ‘user-init-file’ value if
> init file is missing.
>
> (and (equal (file-name-extension alt-file) "el")
> (setq alt-file (file-name-sans-extension alt-file)))
> ...
> (load alt-file 'noerror 'nomessage)))
>
> should be also changed in the commit to use “init.el” not “init".
Yes, I think the code here is just confused -- alt-file is "init" by
default, but since it's passed in as a closure, pretty much anything can
be returned, right? The code does the right thing in stripping the
".el" before passing it to `load', because then `load' will load
init.elc if it exists.
But we can't add back ".el" before setting init-file-name, because the
alt-file may legitimately be ".emacs", and should not then be forced to
".emacs.el".
So I think the "init" in the alt-file closure is the problem: It should
be "init.el", and init-file-name should be set to that verbatim. (But
the ".el" should still be stripped before doing the `load'.)
I think. I've now done this change in Emacs 28, but I'm not
super-confident about it -- there's many subtleties here...
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Added tag(s) fixed.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Thu, 17 Dec 2020 11:19:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 28.1, send any further explanations to
45197 <at> debbugs.gnu.org and tsuucat <tsuucat <at> icloud.com>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Thu, 17 Dec 2020 11:19:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 14 Jan 2021 12:24:08 GMT)
Full text and
rfc822 format available.
This bug report was last modified 4 years and 154 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.