(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 : > >> From: Lars Ingebrigtsen >> Cc: tsuucat@icloud.com, 45197@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