* Default emacs init file location confusion
@ 2020-01-07 2:51 Elias Mårtenson
2020-01-07 3:32 ` Eli Zaretskii
2020-01-07 3:43 ` VanL
0 siblings, 2 replies; 90+ messages in thread
From: Elias Mårtenson @ 2020-01-07 2:51 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1515 bytes --]
I recently had a problem which may cause some real issues with user. Please
allow me to explain the background:
I installed a new computer a couple of days ago (Fedora 31). I started out
with an empty home directory and I did not install Emacs from the
repositories. Instead, I installed all the build dependencies and built
Emacs master from Git.
After installing Emacs, and starting it once to check that it worked, I
checked out my $HOME/.emacs.d directory from source control and started
Emacs. At this point, I noted that my init file was not being loaded.
After checking all the obvious things, I remembered seeing something about
supporting the XDG standards, and because of this I found a directory
$HOME/.config/emacs. This directoriy contained a single file whose name I
cannot remember. As far as I can rceall, this file was empty. I deleted
this directory and restarted Emacs. At this point my init file was loaded
correctly.
If I had not known about the XDS stuff, I would have been extremely
confused about this behaviour. I don't think it can be expected that users
know about this, do this could cause a lot of confusion among people
following tutorials for example.
I'm guessing that the $HOME/.config/emacs directory was created when I
started Emacs before checking out my .emacs.d from source control.
Would it make sense to display a warning before creating this directory in
the first place, explaining that doing so will prevent
$HOME/.emacs.d/init.el from being loaded?
Regards,
Elias
[-- Attachment #2: Type: text/html, Size: 1746 bytes --]
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-07 2:51 Default emacs init file location confusion Elias Mårtenson
@ 2020-01-07 3:32 ` Eli Zaretskii
2020-01-07 3:40 ` Elias Mårtenson
2020-01-07 3:46 ` Mingde (Matthew) Zeng
2020-01-07 3:43 ` VanL
1 sibling, 2 replies; 90+ messages in thread
From: Eli Zaretskii @ 2020-01-07 3:32 UTC (permalink / raw)
To: Elias Mårtenson; +Cc: emacs-devel
> From: Elias Mårtenson <lokedhs@gmail.com>
> Date: Tue, 7 Jan 2020 10:51:49 +0800
>
> I'm guessing that the $HOME/.config/emacs directory was created when I started Emacs before checking out
> my .emacs.d from source control.
>
> Would it make sense to display a warning before creating this directory in the first place, explaining that doing
> so will prevent $HOME/.emacs.d/init.el from being loaded?
I don't think we create the ~/.config directory. We just check if its
emacs subdirectory exists.
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-07 3:32 ` Eli Zaretskii
@ 2020-01-07 3:40 ` Elias Mårtenson
2020-01-07 4:40 ` Eli Zaretskii
2020-01-07 3:46 ` Mingde (Matthew) Zeng
1 sibling, 1 reply; 90+ messages in thread
From: Elias Mårtenson @ 2020-01-07 3:40 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 939 bytes --]
On Tue, 7 Jan 2020 at 11:32, Eli Zaretskii <eliz@gnu.org> wrote:
> > From: Elias Mårtenson <lokedhs@gmail.com>
> > Date: Tue, 7 Jan 2020 10:51:49 +0800
> >
> > I'm guessing that the $HOME/.config/emacs directory was created when I
> started Emacs before checking out
> > my .emacs.d from source control.
> >
> > Would it make sense to display a warning before creating this directory
> in the first place, explaining that doing
> > so will prevent $HOME/.emacs.d/init.el from being loaded?
>
> I don't think we create the ~/.config directory. We just check if its
> emacs subdirectory exists.
>
Interesting. I certainly never created it myself. When I get back home I
will remove my $HOME/.emacs.d directory and restart Emacs in an attempt to
recreate it.
Assuming my description of the events is accurate (I may have missed
something), there really should be no such directory created, yes?
Regards,
Elias
[-- Attachment #2: Type: text/html, Size: 1372 bytes --]
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-07 2:51 Default emacs init file location confusion Elias Mårtenson
2020-01-07 3:32 ` Eli Zaretskii
@ 2020-01-07 3:43 ` VanL
2020-01-07 3:51 ` Elias Mårtenson
1 sibling, 1 reply; 90+ messages in thread
From: VanL @ 2020-01-07 3:43 UTC (permalink / raw)
To: emacs-devel
Elias Mårtenson <lokedhs@gmail.com> writes:
> After checking all the obvious things, I remembered seeing something about supporting the
> XDG standards, and because of this I found a directory $HOME/.config/emacs. This directoriy
> contained a single file whose name I cannot remember. As far as I can rceall, this file was
> empty. I deleted this directory and restarted Emacs. At this point my init file was loaded
> correctly.
The confusion is gone after readin the NEWS outline file.
-- VL
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-07 3:32 ` Eli Zaretskii
2020-01-07 3:40 ` Elias Mårtenson
@ 2020-01-07 3:46 ` Mingde (Matthew) Zeng
2020-01-07 3:50 ` Elias Mårtenson
1 sibling, 1 reply; 90+ messages in thread
From: Mingde (Matthew) Zeng @ 2020-01-07 3:46 UTC (permalink / raw)
To: emacs-devel; +Cc: Elias Mårtenson
>> From: Elias Mårtenson <lokedhs@gmail.com>
>> Date: Tue, 7 Jan 2020 10:51:49 +0800
>>
>> I'm guessing that the $HOME/.config/emacs directory was created when I started Emacs before checking out
>> my .emacs.d from source control.
>>
>> Would it make sense to display a warning before creating this directory in the first place, explaining that doing
>> so will prevent $HOME/.emacs.d/init.el from being loaded?
>
> I don't think we create the ~/.config directory. We just check if its
> emacs subdirectory exists.
I think he meant the emacs subdirectory was created without his knowledge.
>> I found a directory $HOME/.config/emacs. This directoriy contained a single file whose name I cannot remember. As
>> far as I can rceall, this file was empty. I deleted this directory and restarted Emacs. At this point my init file was loaded correctly.
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-07 3:46 ` Mingde (Matthew) Zeng
@ 2020-01-07 3:50 ` Elias Mårtenson
0 siblings, 0 replies; 90+ messages in thread
From: Elias Mårtenson @ 2020-01-07 3:50 UTC (permalink / raw)
To: Mingde (Matthew) Zeng; +Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 852 bytes --]
On Tue, 7 Jan 2020 at 11:46, Mingde (Matthew) Zeng <matthewzmd@gmail.com>
wrote:
>
> >> From: Elias Mårtenson <lokedhs@gmail.com>
> >> Date: Tue, 7 Jan 2020 10:51:49 +0800
> >>
> >> I'm guessing that the $HOME/.config/emacs directory was created when I
> started Emacs before checking out
> >> my .emacs.d from source control.
> >>
> >> Would it make sense to display a warning before creating this directory
> in the first place, explaining that doing
> >> so will prevent $HOME/.emacs.d/init.el from being loaded?
> >
> > I don't think we create the ~/.config directory. We just check if its
> > emacs subdirectory exists.
>
> I think he meant the emacs subdirectory was created without his knowledge.
>
That is correct. The $HOME/.config directory exists of course. I'm
referring to $HOME/.config/emacs
Regards,
Elias
[-- Attachment #2: Type: text/html, Size: 1314 bytes --]
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-07 3:43 ` VanL
@ 2020-01-07 3:51 ` Elias Mårtenson
0 siblings, 0 replies; 90+ messages in thread
From: Elias Mårtenson @ 2020-01-07 3:51 UTC (permalink / raw)
To: VanL; +Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 825 bytes --]
On Tue, 7 Jan 2020 at 11:50, VanL <van@scratch.space> wrote:
> Elias Mårtenson <lokedhs@gmail.com> writes:
>
> > After checking all the obvious things, I remembered seeing something
> about supporting the
> > XDG standards, and because of this I found a directory
> $HOME/.config/emacs. This directoriy
> > contained a single file whose name I cannot remember. As far as I can
> rceall, this file was
> > empty. I deleted this directory and restarted Emacs. At this point my
> init file was loaded
> > correctly.
>
> The confusion is gone after readin the NEWS outline file.
>
I didn't have to read it. I knew about this behaviour. I'm talking about
regular users of Emacs, most of which have never heard about the NEWS file,
nor would they be reading it even if they knew about it.
Regards,
Elias
[-- Attachment #2: Type: text/html, Size: 1182 bytes --]
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-07 3:40 ` Elias Mårtenson
@ 2020-01-07 4:40 ` Eli Zaretskii
2020-01-07 14:43 ` Lawrence Liu
0 siblings, 1 reply; 90+ messages in thread
From: Eli Zaretskii @ 2020-01-07 4:40 UTC (permalink / raw)
To: Elias Mårtenson; +Cc: emacs-devel
On January 7, 2020 5:40:14 AM GMT+02:00, "Elias Mårtenson" <lokedhs@gmail.com> wrote:
> On Tue, 7 Jan 2020 at 11:32, Eli Zaretskii <eliz@gnu.org> wrote:
>
> > I don't think we create the ~/.config directory. We just check if
> its
> > emacs subdirectory exists.
> >
>
> Interesting. I certainly never created it myself. When I get back home
> I
> will remove my $HOME/.emacs.d directory and restart Emacs in an
> attempt to
> recreate it.
>
> Assuming my description of the events is accurate (I may have missed
> something), there really should be no such directory created, yes?
Yes, that's my reading of the code in startup.el, and also what NEWS says. If you find that we do somehow create that directory, please show the code which does that, and report that as a bug.
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-07 4:40 ` Eli Zaretskii
@ 2020-01-07 14:43 ` Lawrence Liu
2020-01-07 15:26 ` Robert Pluim
0 siblings, 1 reply; 90+ messages in thread
From: Lawrence Liu @ 2020-01-07 14:43 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Elias Mårtenson, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1166 bytes --]
Hi all,
I also met this issue on a machine running gnome3 Ubuntu 18.04.
Took sometime for me to figured it out from mail list and news file.
Haven’t look into the code to figure where it happens.
Thanks.
Eli Zaretskii <eliz@gnu.org>于2020年1月7日 周二12:42写道:
> On January 7, 2020 5:40:14 AM GMT+02:00, "Elias Mårtenson" <
> lokedhs@gmail.com> wrote:
> > On Tue, 7 Jan 2020 at 11:32, Eli Zaretskii <eliz@gnu.org> wrote:
> >
> > > I don't think we create the ~/.config directory. We just check if
> > its
> > > emacs subdirectory exists.
> > >
> >
> > Interesting. I certainly never created it myself. When I get back home
> > I
> > will remove my $HOME/.emacs.d directory and restart Emacs in an
> > attempt to
> > recreate it.
> >
> > Assuming my description of the events is accurate (I may have missed
> > something), there really should be no such directory created, yes?
>
> Yes, that's my reading of the code in startup.el, and also what NEWS
> says. If you find that we do somehow create that directory, please show
> the code which does that, and report that as a bug.
>
> --
Best Regards
Lawrence
[-- Attachment #2: Type: text/html, Size: 1990 bytes --]
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-07 14:43 ` Lawrence Liu
@ 2020-01-07 15:26 ` Robert Pluim
2020-01-07 16:12 ` Eli Zaretskii
0 siblings, 1 reply; 90+ messages in thread
From: Robert Pluim @ 2020-01-07 15:26 UTC (permalink / raw)
To: Lawrence Liu; +Cc: Eli Zaretskii, Elias Mårtenson, emacs-devel
>>>>> On Tue, 7 Jan 2020 22:43:10 +0800, Lawrence Liu <smartlitchi@gmail.com> said:
Lawrence> Hi all,
Lawrence> I also met this issue on a machine running gnome3 Ubuntu 18.04.
Lawrence> Took sometime for me to figured it out from mail list and news file.
Lawrence> Haven’t look into the code to figure where it happens.
With a breakpoint on 'mkdir':
Lisp Backtrace:
"make-directory-internal" (0xffffb498)
"files--ensure-directory" (0xffffb7c0)
"make-directory" (0xffffbb50)
"locate-user-emacs-file" (0xffffbed0)
0xf4ce7b70 PVEC_COMPILED
"funcall" (0xffffc1a0)
"eval" (0xffffc2f8)
"custom-reevaluate-setting" (0xffffc5f8)
"mapc" (0xffffc710)
"command-line" (0xffffd0c8)
"normal-top-level" (0xffffd560)
'locate-user-emacs-file' says:
;; Make sure `user-emacs-directory' exists,
;; unless we're in batch mode or dumping Emacs.
(or noninteractive
dump-mode
(let (errtype)
(if (file-directory-p user-emacs-directory)
(or (file-accessible-directory-p user-emacs-directory)
(setq errtype "access"))
(with-file-modes ?\700
(condition-case nil
(make-directory user-emacs-directory t)
(error (setq errtype "create")))))
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-07 15:26 ` Robert Pluim
@ 2020-01-07 16:12 ` Eli Zaretskii
2020-01-07 16:25 ` Robert Pluim
0 siblings, 1 reply; 90+ messages in thread
From: Eli Zaretskii @ 2020-01-07 16:12 UTC (permalink / raw)
To: Robert Pluim; +Cc: smartlitchi, lokedhs, emacs-devel
> From: Robert Pluim <rpluim@gmail.com>
> Cc: Eli Zaretskii <eliz@gnu.org>, Elias Mårtenson
> <lokedhs@gmail.com>,
> emacs-devel <emacs-devel@gnu.org>
> Date: Tue, 07 Jan 2020 16:26:52 +0100
>
> Lisp Backtrace:
> "make-directory-internal" (0xffffb498)
> "files--ensure-directory" (0xffffb7c0)
> "make-directory" (0xffffbb50)
> "locate-user-emacs-file" (0xffffbed0)
> 0xf4ce7b70 PVEC_COMPILED
> "funcall" (0xffffc1a0)
> "eval" (0xffffc2f8)
> "custom-reevaluate-setting" (0xffffc5f8)
> "mapc" (0xffffc710)
> "command-line" (0xffffd0c8)
> "normal-top-level" (0xffffd560)
>
> 'locate-user-emacs-file' says:
>
> ;; Make sure `user-emacs-directory' exists,
> ;; unless we're in batch mode or dumping Emacs.
Thanks, but how did user-emacs-directory get set to ~/.config/emacs if
that directory didn't exist to begin with? The code in startup.el
does
(setq user-emacs-directory
(startup--xdg-or-homedot startup--xdg-config-home-emacs nil))
and startup--xdg-or-homedot is supposed not to look in ~/.config
unless ~/.config/emacs exists and is a directory. Or what am I
missing?
In any case, the right place to fix this is in startup.el, where we
compute the value of user-emacs-directory.
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-07 16:12 ` Eli Zaretskii
@ 2020-01-07 16:25 ` Robert Pluim
2020-01-07 17:04 ` Eli Zaretskii
0 siblings, 1 reply; 90+ messages in thread
From: Robert Pluim @ 2020-01-07 16:25 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: smartlitchi, lokedhs, emacs-devel
>>>>> On Tue, 07 Jan 2020 18:12:44 +0200, Eli Zaretskii <eliz@gnu.org> said:
Eli> Thanks, but how did user-emacs-directory get set to ~/.config/emacs if
Eli> that directory didn't exist to begin with? The code in startup.el
Eli> does
Eli> (setq user-emacs-directory
Eli> (startup--xdg-or-homedot startup--xdg-config-home-emacs nil))
Eli> and startup--xdg-or-homedot is supposed not to look in ~/.config
Eli> unless ~/.config/emacs exists and is a directory. Or what am I
Eli> missing?
If neither ~/.config/emacs nor ~/.emacs.d exist,
startup--xdg-or-homedot returns ~/.config/emacs, which goes all the
way back to 2befb4f0a1494f699f56215d5f28ba055663d881
Iʼm sure this was discussed back then, but I donʼt remember all the
details.
Robert
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-07 16:25 ` Robert Pluim
@ 2020-01-07 17:04 ` Eli Zaretskii
2020-01-07 17:11 ` Elias Mårtenson
2020-01-07 17:12 ` Yuan Fu
0 siblings, 2 replies; 90+ messages in thread
From: Eli Zaretskii @ 2020-01-07 17:04 UTC (permalink / raw)
To: Robert Pluim; +Cc: smartlitchi, lokedhs, emacs-devel
> From: Robert Pluim <rpluim@gmail.com>
> Cc: smartlitchi@gmail.com, lokedhs@gmail.com, emacs-devel@gnu.org
> Date: Tue, 07 Jan 2020 17:25:21 +0100
>
> Eli> (setq user-emacs-directory
> Eli> (startup--xdg-or-homedot startup--xdg-config-home-emacs nil))
>
> Eli> and startup--xdg-or-homedot is supposed not to look in ~/.config
> Eli> unless ~/.config/emacs exists and is a directory. Or what am I
> Eli> missing?
>
> If neither ~/.config/emacs nor ~/.emacs.d exist,
> startup--xdg-or-homedot returns ~/.config/emacs
But that doesn't seem to be the situation described by Elias in his
original report. He said:
> After installing Emacs, and starting it once to check that it
> worked, I checked out my $HOME/.emacs.d directory from source
> control and started Emacs. At this point, I noted that my init file
> was not being loaded.
If this means that ~/.emacs.d/ didn't exist when Emacs was first
started, then I think it's OK for Emacs to default to ~/.config/emacs,
because neither of the two possible candidates exist.
So now I don't think I understand the confusion.
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-07 17:04 ` Eli Zaretskii
@ 2020-01-07 17:11 ` Elias Mårtenson
2020-01-07 17:21 ` Eli Zaretskii
2020-01-07 17:12 ` Yuan Fu
1 sibling, 1 reply; 90+ messages in thread
From: Elias Mårtenson @ 2020-01-07 17:11 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Robert Pluim, smartlitchi, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1404 bytes --]
On Wed, 8 Jan 2020 at 01:04, Eli Zaretskii <eliz@gnu.org> wrote:
>
> If this means that ~/.emacs.d/ didn't exist when Emacs was first
> started, then I think it's OK for Emacs to default to ~/.config/emacs,
> because neither of the two possible candidates exist.
>
> So now I don't think I understand the confusion.
>
The confusion is that once I start Emacs without any configuration, the
$HOME/.config/emacs will be created, and after that the $HOME/.emacs.d will
never be used, even though I don't actually have a configuration yet. All I
did was to start Emacs once.
I don't think the $HOME/.config/emacs should be created until there is
actually a configuration to save. Or, alternatively, before the user have
confirmed where they want the configuration directory to be created.
Imagine a user starting Emacs once, and then immediately closing it without
touching a single option in the application (this will create the
$HOME/.config/emacs). They then go to a Youtube video or blog post to learn
about how to configure the application. They create a
$HOME/.emacs.d/init.el and then ends up not understanding why the config
file is never read, even though they followed the instructions exactly.
Since the $HOME/.config behaviour is new, it will not be easy for them to
figure out why nothing works and they will give up, perhaps never trying
Emacs again.
That is my concern.
Regards,
Elias
[-- Attachment #2: Type: text/html, Size: 1859 bytes --]
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-07 17:04 ` Eli Zaretskii
2020-01-07 17:11 ` Elias Mårtenson
@ 2020-01-07 17:12 ` Yuan Fu
2020-01-07 17:26 ` Elias Mårtenson
1 sibling, 1 reply; 90+ messages in thread
From: Yuan Fu @ 2020-01-07 17:12 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Robert Pluim, lokedhs, smartlitchi, emacs-devel
>> After installing Emacs, and starting it once to check that it
>> worked, I checked out my $HOME/.emacs.d directory from source
>> control and started Emacs. At this point, I noted that my init file
>> was not being loaded.
>
> If this means that ~/.emacs.d/ didn't exist when Emacs was first
> started, then I think it's OK for Emacs to default to ~/.config/emacs,
> because neither of the two possible candidates exist.
>
> So now I don't think I understand the confusion.
I guess he ran Emacs before checking out his .emacs.d, and Emacs created .config/emacs. Then when he checked out his .emacs.d, it is not loaded. This could confuse some people, for example, when someone installed emacs and ran it once to make sure the install is successful. Adding a notice when creating .config/emacs would be helpful.
Yuan
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-07 17:11 ` Elias Mårtenson
@ 2020-01-07 17:21 ` Eli Zaretskii
2020-01-07 17:33 ` Elias Mårtenson
2020-01-07 17:57 ` Stefan Monnier
0 siblings, 2 replies; 90+ messages in thread
From: Eli Zaretskii @ 2020-01-07 17:21 UTC (permalink / raw)
To: Elias Mårtenson; +Cc: rpluim, smartlitchi, emacs-devel
> From: Elias Mårtenson <lokedhs@gmail.com>
> Date: Wed, 8 Jan 2020 01:11:37 +0800
> Cc: Robert Pluim <rpluim@gmail.com>, smartlitchi@gmail.com,
> emacs-devel <emacs-devel@gnu.org>
>
> The confusion is that once I start Emacs without any configuration, the $HOME/.config/emacs will be created,
> and after that the $HOME/.emacs.d will never be used, even though I don't actually have a configuration yet.
> All I did was to start Emacs once.
But Emacs did that with ~/.emacs.d/ as well: it would create it if it
didn't exist when you first started. It did that silently without any
warning. How is this situation different?
The way to prevent the above is described in NEWS, btw.
> I don't think the $HOME/.config/emacs should be created until there is actually a configuration to save. Or,
> alternatively, before the user have confirmed where they want the configuration directory to be created.
I'm not sure this is practical: there must be gazillion places where
we assume that directory exists. E.g., what about auto-saving? we
could defer the creation of the directory until we actually call
do-auto-save, but that will only buy us what, 30 sec?
> Since the $HOME/.config behaviour is new, it will not be easy for them to figure out why nothing works and
> they will give up, perhaps never trying Emacs again.
We need to decide which directory to create if neither of the 2
candidates exist. Previously, we had only one candidate, and we'd
create it without any regrets. I don't think I see how the current
situation is suddenly different. Moreover, I don't think I understand
how to do something smarter, without breaking gobs of code that
depends on user-emacs-directory be existing. Ideas welcome.
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-07 17:12 ` Yuan Fu
@ 2020-01-07 17:26 ` Elias Mårtenson
0 siblings, 0 replies; 90+ messages in thread
From: Elias Mårtenson @ 2020-01-07 17:26 UTC (permalink / raw)
To: Yuan Fu; +Cc: Eli Zaretskii, smartlitchi, Robert Pluim, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 589 bytes --]
On Wed, 8 Jan 2020 at 01:12, Yuan Fu <casouri@gmail.com> wrote:
>
> I guess he ran Emacs before checking out his .emacs.d, and Emacs created
> .config/emacs. Then when he checked out his .emacs.d, it is not loaded.
> This could confuse some people, for example, when someone installed emacs
> and ran it once to make sure the install is successful. Adding a notice
> when creating .config/emacs would be helpful.
>
This is exactly hat happened. I'm not concerned myself, I understand
precisely what's going on. I'm concerned with new users who don't know this
stuff yet.
Regards,
Elias
[-- Attachment #2: Type: text/html, Size: 934 bytes --]
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-07 17:21 ` Eli Zaretskii
@ 2020-01-07 17:33 ` Elias Mårtenson
2020-01-07 17:37 ` Eli Zaretskii
2020-01-07 17:57 ` Stefan Monnier
1 sibling, 1 reply; 90+ messages in thread
From: Elias Mårtenson @ 2020-01-07 17:33 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Robert Pluim, smartlitchi, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1472 bytes --]
On Wed, 8 Jan 2020 at 01:21, Eli Zaretskii <eliz@gnu.org> wrote:
>
> We need to decide which directory to create if neither of the 2
> candidates exist. Previously, we had only one candidate, and we'd
> create it without any regrets. I don't think I see how the current
> situation is suddenly different. Moreover, I don't think I understand
> how to do something smarter, without breaking gobs of code that
> depends on user-emacs-directory be existing. Ideas welcome.
>
The problem I see (which is indeed the problem I ran into myself, someone
who has used Emacs since the 80's) is that users will be confused about
this because the behaviour is new, and from the user's point of view, Emacs
simply isn't reading the $HOME/.emacs.d directory.
This confusion is caused by an unfamiliarity with new functionality.
Therefore, we must conclude that this is a temporary problem. Once
documentation, youtube videos, block posts, stackoveflow examples, etc has
been updated, this will no longer be a problem. Just like the confusion
between $HOME/.emacs and $HOME/.emacs.d/init.el is no longer an issue.
But for now, it is an issue, so the solution should be to put this
information in from of the user's face. That means displaying a warning
(including a y/n prompt) when the directory is created.
Perhaps this warning is only needed for one release cycle, and then users
will be informed. But right now, it is my opinion that such warning is
needed.
Regards,
Elias
[-- Attachment #2: Type: text/html, Size: 1909 bytes --]
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-07 17:33 ` Elias Mårtenson
@ 2020-01-07 17:37 ` Eli Zaretskii
2020-01-08 5:28 ` Mingde (Matthew) Zeng
0 siblings, 1 reply; 90+ messages in thread
From: Eli Zaretskii @ 2020-01-07 17:37 UTC (permalink / raw)
To: Elias Mårtenson; +Cc: rpluim, smartlitchi, emacs-devel
> From: Elias Mårtenson <lokedhs@gmail.com>
> Date: Wed, 8 Jan 2020 01:33:14 +0800
> Cc: Robert Pluim <rpluim@gmail.com>, smartlitchi@gmail.com,
> emacs-devel <emacs-devel@gnu.org>
>
> But for now, it is an issue, so the solution should be to put this information in from of the user's face. That
> means displaying a warning (including a y/n prompt) when the directory is created.
>
> Perhaps this warning is only needed for one release cycle, and then users will be informed. But right now, it is
> my opinion that such warning is needed.
I think such a warning is not a solution, because it's all to easy to
miss it. It could even be an annoyance.
But that's my opinion; let's hear others.
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-07 17:21 ` Eli Zaretskii
2020-01-07 17:33 ` Elias Mårtenson
@ 2020-01-07 17:57 ` Stefan Monnier
2020-01-07 18:08 ` Stefan Monnier
2020-01-07 18:09 ` Eli Zaretskii
1 sibling, 2 replies; 90+ messages in thread
From: Stefan Monnier @ 2020-01-07 17:57 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: rpluim, Elias Mårtenson, smartlitchi, emacs-devel
>> The confusion is that once I start Emacs without any configuration, the
>> $HOME/.config/emacs will be created,
>> and after that the $HOME/.emacs.d will never be used, even though I don't
>> actually have a configuration yet.
>> All I did was to start Emacs once.
>
> But Emacs did that with ~/.emacs.d/ as well: it would create it if it
> didn't exist when you first started. It did that silently without any
> warning. How is this situation different?
It's different because the existence of ~/.emacs.d/ did not
significantly change Emacs's behavior in most cases, whereas the
existence of ~/.config/emacs has the effect of ignoring all of
~/.emacs.d.
That's why I originally suggested that if ~/.emacs.d/ exists we should
use it in preference to ~/.config/emacs/ rather than the reverse.
We could also be smarter: if both exist and one of the two is empty,
then prefer the non-empty one.
In any case, we should probably be more proactive about the problem: if
both exist we should emit a clear and visible warning.
> The way to prevent the above is described in NEWS, btw.
I think this effect is sufficiently major that we can't just say "you
should have read the NEWS".
Stefan
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-07 17:57 ` Stefan Monnier
@ 2020-01-07 18:08 ` Stefan Monnier
2020-01-07 18:09 ` Eli Zaretskii
1 sibling, 0 replies; 90+ messages in thread
From: Stefan Monnier @ 2020-01-07 18:08 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: rpluim, Elias Mårtenson, smartlitchi, emacs-devel
> We could also be smarter: if both exist and one of the two is empty,
> then prefer the non-empty one.
Another option (tho not in Windows, IIUC) is to create a ~/.emacs.d
symlink to ~/.config/emacs when we create ~/.config/emacs.
> In any case, we should probably be more proactive about the problem: if
> both exist we should emit a clear and visible warning.
Unless they are one and the same because of symlinks ;-)
Stefan
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-07 17:57 ` Stefan Monnier
2020-01-07 18:08 ` Stefan Monnier
@ 2020-01-07 18:09 ` Eli Zaretskii
2020-01-07 18:41 ` Stefan Monnier
2020-01-07 18:53 ` Yuan Fu
1 sibling, 2 replies; 90+ messages in thread
From: Eli Zaretskii @ 2020-01-07 18:09 UTC (permalink / raw)
To: Stefan Monnier; +Cc: rpluim, lokedhs, smartlitchi, emacs-devel
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: Elias Mårtenson <lokedhs@gmail.com>,
> rpluim@gmail.com,
> smartlitchi@gmail.com, emacs-devel@gnu.org
> Date: Tue, 07 Jan 2020 12:57:53 -0500
>
> That's why I originally suggested that if ~/.emacs.d/ exists we should
> use it in preference to ~/.config/emacs/ rather than the reverse.
The issue at hand is what happens when neither of these exists at
startup time. So your proposal would not have helped here.
We can, of course, change the preference to the opposite one when none
of the two candidates exist, if that's what people prefer.
> In any case, we should probably be more proactive about the problem: if
> both exist we should emit a clear and visible warning.
Again, that's not the situation we are discussing.
> > The way to prevent the above is described in NEWS, btw.
>
> I think this effect is sufficiently major that we can't just say "you
> should have read the NEWS".
The idea was that very few will want that workaround. If everyone
will want it, we should probably just summarily remove the XDG
support.
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-07 18:09 ` Eli Zaretskii
@ 2020-01-07 18:41 ` Stefan Monnier
2020-01-07 18:57 ` Yuan Fu
2020-01-07 18:53 ` Yuan Fu
1 sibling, 1 reply; 90+ messages in thread
From: Stefan Monnier @ 2020-01-07 18:41 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: rpluim, lokedhs, smartlitchi, emacs-devel
>> That's why I originally suggested that if ~/.emacs.d/ exists we should
>> use it in preference to ~/.config/emacs/ rather than the reverse.
> The issue at hand is what happens when neither of these exists at
> startup time.
No, there are several questions along the way in the current scenario:
1- when neither exists yet, which one do we choose?
2- if the one we chose doesn't exist yet, when do we create it?
3- if two exist, which one do we choose?
4- should we pay attention to the fact that one of the two is empty?
> So your proposal would not have helped here.
Not in the first run of Emacs (the one that creates ~/.config/emacs),
but it would have helped in the second run (after ~/.emacs.d was
created). It's only the second run which misbehaved (w.r.t what the
user expected), so it would not have been too late.
>> In any case, we should probably be more proactive about the problem: if
>> both exist we should emit a clear and visible warning.
> Again, that's not the situation we are discussing.
It is (for the second run).
>> > The way to prevent the above is described in NEWS, btw.
>> I think this effect is sufficiently major that we can't just say "you
>> should have read the NEWS".
> The idea was that very few will want that workaround.
I expect that it would/will bite any old timer who moves to a new
machine and happens to run `emacs` before installing his config
(e.g. because he needs to edit a config file in order to fetch his
Emacs config).
Stefan
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-07 18:09 ` Eli Zaretskii
2020-01-07 18:41 ` Stefan Monnier
@ 2020-01-07 18:53 ` Yuan Fu
1 sibling, 0 replies; 90+ messages in thread
From: Yuan Fu @ 2020-01-07 18:53 UTC (permalink / raw)
To: Eli Zaretskii
Cc: smartlitchi, Robert Pluim, lokedhs, Stefan Monnier, emacs-devel
> The issue at hand is what happens when neither of these exists at
> startup time. So your proposal would not have helped here.
>
> We can, of course, change the preference to the opposite one when none
> of the two candidates exist, if that's what people prefer.
>
>> In any case, we should probably be more proactive about the problem: if
>> both exist we should emit a clear and visible warning.
>
> Again, that's not the situation we are discussing.
>
>>> The way to prevent the above is described in NEWS, btw.
>>
>> I think this effect is sufficiently major that we can't just say "you
>> should have read the NEWS".
>
> The idea was that very few will want that workaround. If everyone
> will want it, we should probably just summarily remove the XDG
> support.
I think the problem isn’t the preference of either location, but the fact that this default location changed and new users are very likely to be confused by it. If we release Emacs 27, many of the tutorials out there won’t update to address this change. This scenario is likely to happen: a new user installed Emacs 27 and run it just to see it works. Then he/she added .emacs.d/init.el following a tutorial, but none of his/her configuration take effect. He/she would almost certainly have no idea what’s the problem. In fact, he/she would probably suspect that there’s problem with the configuration code.
Instead of focusing on which default location to use, we can do what VIM does (IIRC): if no configuration file is found, prompt user when creating one. I remember that VIM says “you don’t have a configuration file, and we are creating one at ~/.vimrc, is that ok? …” I think this way the user is clear where the config file is, and the problem I describes above wouldn’t happen. This should only happen when Emacs is running interactively though.
Yuan
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-07 18:41 ` Stefan Monnier
@ 2020-01-07 18:57 ` Yuan Fu
2020-01-07 19:15 ` Greg Farough
0 siblings, 1 reply; 90+ messages in thread
From: Yuan Fu @ 2020-01-07 18:57 UTC (permalink / raw)
To: Stefan Monnier; +Cc: smartlitchi, Eli Zaretskii, lokedhs, rpluim, emacs-devel
> I expect that it would/will bite any old timer who moves to a new
> machine and happens to run `emacs` before installing his config
> (e.g. because he needs to edit a config file in order to fetch his
> Emacs config).
That happened to me when I installed Emacs on a remote server some time ago. I found out the problem when I vaguely remembered that XDG discussion after trying to debug my config for quite while.
Yuan
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-07 18:57 ` Yuan Fu
@ 2020-01-07 19:15 ` Greg Farough
2020-01-07 20:11 ` Andrea Corallo
0 siblings, 1 reply; 90+ messages in thread
From: Greg Farough @ 2020-01-07 19:15 UTC (permalink / raw)
To: emacs-devel
On Tue, Jan 07 2020, Yuan Fu <casouri@gmail.com> wrote:
>> I expect that it would/will bite any old timer who moves to a new
>> machine and happens to run `emacs` before installing his config
>> (e.g. because he needs to edit a config file in order to fetch his
>> Emacs config).
>
> That happened to me when I installed Emacs on a remote server some
> time ago. I found out the problem when I vaguely remembered that XDG
> discussion after trying to debug my config for quite while.
>
> Yuan
This also happened to me when setting up a new laptop. It took quite a
while for me to figure out.
-g
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-07 19:15 ` Greg Farough
@ 2020-01-07 20:11 ` Andrea Corallo
0 siblings, 0 replies; 90+ messages in thread
From: Andrea Corallo @ 2020-01-07 20:11 UTC (permalink / raw)
To: Greg Farough; +Cc: emacs-devel
Greg Farough <gregf@gnu.org> writes:
> On Tue, Jan 07 2020, Yuan Fu <casouri@gmail.com> wrote:
>
>>> I expect that it would/will bite any old timer who moves to a new
>>> machine and happens to run `emacs` before installing his config
>>> (e.g. because he needs to edit a config file in order to fetch his
>>> Emacs config).
>>
>> That happened to me when I installed Emacs on a remote server some
>> time ago. I found out the problem when I vaguely remembered that XDG
>> discussion after trying to debug my config for quite while.
>>
>> Yuan
>
> This also happened to me when setting up a new laptop. It took quite a
> while for me to figure out.
>
Same here.
--
akrl@sdf.org
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-07 17:37 ` Eli Zaretskii
@ 2020-01-08 5:28 ` Mingde (Matthew) Zeng
2020-01-08 5:33 ` Elias Mårtenson
0 siblings, 1 reply; 90+ messages in thread
From: Mingde (Matthew) Zeng @ 2020-01-08 5:28 UTC (permalink / raw)
To: emacs-devel; +Cc: rpluim, Elias Mårtenson, smartlitchi
> I think such a warning is not a solution, because it's all to easy to
> miss it. It could even be an annoyance.
>
> But that's my opinion; let's hear others.
I am one of many people who was confused by this change as well.
I agree that we should (at least) give a warning during startup. If you believe it's too easy to miss it, a y-or-n prompt notifying ~/.config/emacs creation would be much better, though I might be asking too much.
I don't think it will be an annoyance, because this warning/prompt should only occur in the first ever startup of Emacs, prior to creating any configuration file. If configuration exists either in ~/.emacs.d or ~/.config/emacs, the user should never see this message again.
Matthew
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 5:28 ` Mingde (Matthew) Zeng
@ 2020-01-08 5:33 ` Elias Mårtenson
2020-01-08 7:22 ` Eli Zaretskii
2020-01-08 8:04 ` Robert Pluim
0 siblings, 2 replies; 90+ messages in thread
From: Elias Mårtenson @ 2020-01-08 5:33 UTC (permalink / raw)
To: Mingde (Matthew) Zeng; +Cc: Robert Pluim, smartlitchi, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1202 bytes --]
On Wed, 8 Jan 2020 at 13:28, Mingde (Matthew) Zeng <matthewzmd@gmail.com>
wrote:
>
> I am one of many people who was confused by this change as well.
>
> I agree that we should (at least) give a warning during startup. If you
> believe it's too easy to miss it, a y-or-n prompt notifying ~/.config/emacs
> creation would be much better, though I might be asking too much.
>
> I don't think it will be an annoyance, because this warning/prompt should
> only occur in the first ever startup of Emacs, prior to creating any
> configuration file. If configuration exists either in ~/.emacs.d or
> ~/.config/emacs, the user should never see this message again.
>
Given the large number of people who seem to have run into the same issue,
most of which are users who have years if not decades of Emacs experience
shows that something should be done before the release of 27.
Having thought about it some more, I came up with this proposal: Emacs
could check if both directories exist, and if so, provide an interactive
choice for the user to pick which one to use. If the user don't want to
have to answer this question every time Emacs starts up, they can delete
one of the directories.
Regards,
Elias
[-- Attachment #2: Type: text/html, Size: 1570 bytes --]
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 5:33 ` Elias Mårtenson
@ 2020-01-08 7:22 ` Eli Zaretskii
2020-01-08 10:05 ` Elias Mårtenson
[not found] ` <m2eewajram.fsf@gmail.com>
2020-01-08 8:04 ` Robert Pluim
1 sibling, 2 replies; 90+ messages in thread
From: Eli Zaretskii @ 2020-01-08 7:22 UTC (permalink / raw)
To: emacs-devel, Elias Mårtenson, Mingde (Matthew) Zeng
Cc: Robert Pluim, smartlitchi, emacs-devel
On January 8, 2020 7:33:20 AM GMT+02:00, "Elias Mårtenson" <lokedhs@gmail.com> wrote:
>
> Given the large number of people who seem to have run into the same
> issue,
> most of which are users who have years if not decades of Emacs
> experience
> shows that something should be done before the release of 27.
>
> Having thought about it some more, I came up with this proposal: Emacs
> could check if both directories exist, and if so, provide an
> interactive
> choice for the user to pick which one to use. If the user don't want
> to
> have to answer this question every time Emacs starts up, they can
> delete
> one of the directories.
Here's my proposal:
. If neither the old nor the new (XDG compliant) directory exists, default to ~/.emacs.d (it will be created, as we did before)
. If both the old and the new directory exist, use ~/.emacs.d
. Otherwise use the XDG compliant directory
This will make the new XDG compliant directory an opt-in feature: users who want that will have to create ~/.config/emacs, move there the contents of ~/.emacs.d, and then delete the latter, in order to have Emacs use the XDG convention.
I don't like to pop up questions at startup, brcause users don't expect such questions, and because people who would like to keep their existing ~/.emacs.d and yet use ~/.config for other programs will need to respond to this prompt every time they start Emacs.
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 5:33 ` Elias Mårtenson
2020-01-08 7:22 ` Eli Zaretskii
@ 2020-01-08 8:04 ` Robert Pluim
1 sibling, 0 replies; 90+ messages in thread
From: Robert Pluim @ 2020-01-08 8:04 UTC (permalink / raw)
To: Elias Mårtenson; +Cc: Mingde (Matthew) Zeng, smartlitchi, emacs-devel
>>>>> On Wed, 8 Jan 2020 13:33:20 +0800, Elias Mårtenson <lokedhs@gmail.com> said:
Elias> Having thought about it some more, I came up with this proposal: Emacs
Elias> could check if both directories exist, and if so, provide an interactive
Elias> choice for the user to pick which one to use. If the user don't want to
Elias> have to answer this question every time Emacs starts up, they can delete
Elias> one of the directories.
That seems like the worst of both worlds. Iʼd say the principle of
least surprise says that emacs should prefer ~/.emacs.d if neither of
two directories exist (which would end up creating it), and prefer
~/.config/emacs if that exists (but not create it), which allows
people who want to use the xdg stuff to do so easily. Concretely:
diff --git a/lisp/startup.el b/lisp/startup.el
index 04a37bf59e..ebf9d33a97 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -497,28 +497,20 @@ startup--xdg-config-default
(defvar startup--xdg-config-home-emacs)
;; Return the name of the init file directory for Emacs, assuming
-;; XDG-DIR is the XDG location and USER-NAME is the user name.
-;; If USER-NAME is nil or "", use the current user.
-;; Prefer the XDG location unless it does does not exist and the
-;; .emacs.d location does exist.
+;; XDG-DIR is the XDG location and USER-NAME is the user name. If
+;; USER-NAME is nil or "", use the current user. Prefer the XDG
+;; location unless it does not exist, in which case we prefer the
+;; .emacs.d location (even if it does not exist)
(defun startup--xdg-or-homedot (xdg-dir user-name)
+ (let ((user-name (if (and user-name (not (string-equal user-name "")))
+ user-name
+ init-file-user)))
(if (file-exists-p xdg-dir)
xdg-dir
- (let ((emacs-d-dir (concat "~" user-name
- (if (eq system-type 'ms-dos)
- "/_emacs.d/"
- "/.emacs.d/"))))
- (if (or (file-exists-p emacs-d-dir)
- (if (eq system-type 'windows-nt)
- (if (file-directory-p (concat "~" user-name))
- (directory-files (concat "~" user-name) nil
- "\\`[._]emacs\\(\\.elc?\\)?\\'"))
- (file-exists-p (concat "~" init-file-user
- (if (eq system-type 'ms-dos)
- "/_emacs"
- "/.emacs")))))
- emacs-d-dir
- xdg-dir))))
+ (concat "~" user-name
+ (if (eq system-type 'ms-dos)
+ "/_emacs.d/"
+ "/.emacs.d/")))))
(defun normal-top-level ()
"Emacs calls this function when it first starts up.
^ permalink raw reply related [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 7:22 ` Eli Zaretskii
@ 2020-01-08 10:05 ` Elias Mårtenson
[not found] ` <m2eewajram.fsf@gmail.com>
1 sibling, 0 replies; 90+ messages in thread
From: Elias Mårtenson @ 2020-01-08 10:05 UTC (permalink / raw)
To: Eli Zaretskii
Cc: Mingde (Matthew) Zeng, Robert Pluim, smartlitchi, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 506 bytes --]
On Wed, 8 Jan 2020 at 15:22, Eli Zaretskii <eliz@gnu.org> wrote:
> I don't like to pop up questions at startup, brcause users don't expect
> such questions, and because people who would like to keep their existing
> ~/.emacs.d and yet use ~/.config for other programs will need to respond to
> this prompt every time they start Emacs.
>
I agree with your opinion in general, but I do need to point out that my
proposal would not warn about $HOME/.config, but rather $HOME/.config/emacs.
Regards,
Elias
[-- Attachment #2: Type: text/html, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
[not found] ` <m2eewajram.fsf@gmail.com>
@ 2020-01-08 10:05 ` Eli Zaretskii
2020-01-08 10:13 ` Elias Mårtenson
` (2 more replies)
0 siblings, 3 replies; 90+ messages in thread
From: Eli Zaretskii @ 2020-01-08 10:05 UTC (permalink / raw)
To: emacs-devel, Robert Pluim
Cc: Mingde (Matthew) Zeng, smartlitchi, Elias Mårtenson
On January 8, 2020 10:17:21 AM GMT+02:00, Robert Pluim <rpluim@gmail.com> wrote:
> >>>>> On Wed, 08 Jan 2020 09:22:12 +0200, Eli Zaretskii <eliz@gnu.org>
> said:
>
> Eli> Here's my proposal:
>
> Eli> . If neither the old nor the new (XDG compliant) directory
> exists, default to ~/.emacs.d (it will be created, as we did before)
> Eli> . If both the old and the new directory exist, use ~/.emacs.d
> Eli> . Otherwise use the XDG compliant directory
>
> Eli> This will make the new XDG compliant directory an opt-in feature:
> Eli> users who want that will have to create ~/.config/emacs, move
> there
> Eli> the contents of ~/.emacs.d, and then delete the latter, in order
> to
> Eli> have Emacs use the XDG convention.
>
> Except that now the issue becomes "I created ~/.config/emacs, and
> emacs doesnʼt use it".
Which is completely consistent with making this feature opt-in, don't you agree? And NEWS will tell so.
> hence Iʼd prefer:
>
> Use the XDG directory if it exists, but donʼt create
> it. Otherwise, use ~/.emacs.d (and create it if necessary).
This is IMO a much more invasive change, and therefore inappropriate for the release branch. The current code relies on user-emacs-directory to exist. Lifting this restriction should be a separate change, and we should do it on master.
> Eli> I don't like to pop up questions at startup, brcause users don't
> Eli> expect such questions, and because people who would like to keep
> their
> Eli> existing ~/.emacs.d and yet use ~/.config for other programs will
> need
> Eli> to respond to this prompt every time they start Emacs.
>
> I agree about the pop ups, but the prompt would only be if
> ~/.config/emacs existed, not ~/.config, so deleting it would stop the
> prompt.
The same people who won't know they should delete .emacs.d will also fail to know about deleting .config/emacs.
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 10:05 ` Eli Zaretskii
@ 2020-01-08 10:13 ` Elias Mårtenson
2020-01-08 10:22 ` Robert Pluim
2020-01-08 11:03 ` Mario Lang
2 siblings, 0 replies; 90+ messages in thread
From: Elias Mårtenson @ 2020-01-08 10:13 UTC (permalink / raw)
To: Eli Zaretskii
Cc: Mingde (Matthew) Zeng, Robert Pluim, smartlitchi, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1053 bytes --]
On Wed, 8 Jan 2020 at 18:06, Eli Zaretskii <eliz@gnu.org> wrote:
> > I agree about the pop ups, but the prompt would only be if
> > ~/.config/emacs existed, not ~/.config, so deleting it would stop the
> > prompt.
>
> The same people who won't know they should delete .emacs.d will also fail
> to know about deleting .config/emacs.
>
This part of the discussion only applies if my prompt proposal i adopted.
In this case, the user would know because they literally just saw a prompt
on the screen, explaining what happened and how to deal with it. Perhaps
something like this:
*Both ~/.emacs.d and ~/.config/emacs exists. Please select which one to
load the configuration from.*
* NOTE: To avoid this question in the future, please delete or rename
the directory you don't want to use.*
* Type ‘e’ or ‘c’ to select: XXX*
Now, you have already expressed disagreement with this proposal, so I'm not
going to push it further. However, I do hope this clearly clarifies my
proposal.
*Regards,*
*Elias*
[-- Attachment #2: Type: text/html, Size: 1537 bytes --]
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 10:05 ` Eli Zaretskii
2020-01-08 10:13 ` Elias Mårtenson
@ 2020-01-08 10:22 ` Robert Pluim
2020-01-08 10:49 ` Eli Zaretskii
2020-01-08 11:03 ` Mario Lang
2 siblings, 1 reply; 90+ messages in thread
From: Robert Pluim @ 2020-01-08 10:22 UTC (permalink / raw)
To: Eli Zaretskii
Cc: Mingde (Matthew) Zeng, smartlitchi, Elias Mårtenson,
emacs-devel
>>>>> On Wed, 08 Jan 2020 12:05:57 +0200, Eli Zaretskii <eliz@gnu.org> said:
>> Except that now the issue becomes "I created ~/.config/emacs, and
>> emacs doesnʼt use it".
Eli> Which is completely consistent with making this feature opt-in, don't you agree? And NEWS will tell so.
Itʼs consistent, and a lesser problem than the current situation, so I
have no strong objection to it.
>> hence Iʼd prefer:
>>
>> Use the XDG directory if it exists, but donʼt create
>> it. Otherwise, use ~/.emacs.d (and create it if necessary).
Eli> This is IMO a much more invasive change, and therefore inappropriate
Eli> for the release branch. The current code relies on
Eli> user-emacs-directory to exist. Lifting this restriction should be a
Eli> separate change, and we should do it on master.
I didnʼt propose making user-emacs-directory not exist. I proposed
creating only ~/.emacs.d (and then using it).
Robert
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 10:22 ` Robert Pluim
@ 2020-01-08 10:49 ` Eli Zaretskii
2020-01-08 12:37 ` Robert Pluim
0 siblings, 1 reply; 90+ messages in thread
From: Eli Zaretskii @ 2020-01-08 10:49 UTC (permalink / raw)
To: emacs-devel, Robert Pluim
Cc: Mingde (Matthew) Zeng, smartlitchi, Elias Mårtenson
On January 8, 2020 12:22:12 PM GMT+02:00, Robert Pluim <rpluim@gmail.com> wrote:
> >>>>> On Wed, 08 Jan 2020 12:05:57 +0200, Eli Zaretskii <eliz@gnu.org>
> said:
> >> hence Iʼd prefer:
> >>
> >> Use the XDG directory if it exists, but donʼt create
> >> it. Otherwise, use ~/.emacs.d (and create it if necessary).
>
> Eli> This is IMO a much more invasive change, and therefore
> inappropriate
> Eli> for the release branch. The current code relies on
> Eli> user-emacs-directory to exist. Lifting this restriction should
> be a
> Eli> separate change, and we should do it on master.
>
> I didnʼt propose making user-emacs-directory not exist. I proposed
> creating only ~/.emacs.d (and then using it).
That would mean we sometimes prefer XDG and sometimes .emacs.d, something that IMO will be harder to explain and document, and easier to become confused about.
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 10:05 ` Eli Zaretskii
2020-01-08 10:13 ` Elias Mårtenson
2020-01-08 10:22 ` Robert Pluim
@ 2020-01-08 11:03 ` Mario Lang
2020-01-08 15:56 ` Eli Zaretskii
2 siblings, 1 reply; 90+ messages in thread
From: Mario Lang @ 2020-01-08 11:03 UTC (permalink / raw)
To: Eli Zaretskii
Cc: Mingde (Matthew) Zeng, Robert Pluim, Elias Mårtenson,
smartlitchi, emacs-devel
Eli Zaretskii <eliz@gnu.org> writes:
> Which is completely consistent with making this feature opt-in, don't
> you agree? And NEWS will tell so.
If people would read NEWS, this problem wouldn't have come up here.
Prior to this discussion, ~/.config/emacs/ was pretty nicely
described in NEWS already.
--
CYa,
⡍⠁⠗⠊⠕
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 10:49 ` Eli Zaretskii
@ 2020-01-08 12:37 ` Robert Pluim
2020-01-08 13:51 ` Stefan Monnier
0 siblings, 1 reply; 90+ messages in thread
From: Robert Pluim @ 2020-01-08 12:37 UTC (permalink / raw)
To: Eli Zaretskii
Cc: Mingde (Matthew) Zeng, smartlitchi, Elias Mårtenson,
emacs-devel
>>>>> On Wed, 08 Jan 2020 12:49:28 +0200, Eli Zaretskii <eliz@gnu.org> said:
Eli> On January 8, 2020 12:22:12 PM GMT+02:00, Robert Pluim <rpluim@gmail.com> wrote:
>> >>>>> On Wed, 08 Jan 2020 12:05:57 +0200, Eli Zaretskii <eliz@gnu.org>
>> said:
>> >> hence Iʼd prefer:
>> >>
>> >> Use the XDG directory if it exists, but donʼt create
>> >> it. Otherwise, use ~/.emacs.d (and create it if necessary).
>>
Eli> This is IMO a much more invasive change, and therefore
>> inappropriate
Eli> for the release branch. The current code relies on
Eli> user-emacs-directory to exist. Lifting this restriction should
>> be a
Eli> separate change, and we should do it on master.
>>
>> I didnʼt propose making user-emacs-directory not exist. I proposed
>> creating only ~/.emacs.d (and then using it).
Eli> That would mean we sometimes prefer XDG and sometimes .emacs.d,
Eli> something that IMO will be harder to explain and document, and easier
Eli> to become confused about.
We'll prefer XDG *if* it exists, otherwise we ignore it. I donʼt think
thatʼs particularly open to confusion.
Robert
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 12:37 ` Robert Pluim
@ 2020-01-08 13:51 ` Stefan Monnier
2020-01-08 15:58 ` Eli Zaretskii
2020-01-08 23:26 ` chad
0 siblings, 2 replies; 90+ messages in thread
From: Stefan Monnier @ 2020-01-08 13:51 UTC (permalink / raw)
To: Robert Pluim
Cc: Mingde (Matthew) Zeng, Eli Zaretskii, Elias Mårtenson,
smartlitchi, emacs-devel
> We'll prefer XDG *if* it exists, otherwise we ignore it. I donʼt think
> thatʼs particularly open to confusion.
It's just swapping the current roles of ~/.emacs.d and
~/.config/emacs, indeed.
Still, a warning when both are present would be welcome.
Stefan
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 11:03 ` Mario Lang
@ 2020-01-08 15:56 ` Eli Zaretskii
0 siblings, 0 replies; 90+ messages in thread
From: Eli Zaretskii @ 2020-01-08 15:56 UTC (permalink / raw)
To: Mario Lang; +Cc: matthewzmd, rpluim, lokedhs, smartlitchi, emacs-devel
> From: Mario Lang <mlang@blind.guru>
> Cc: emacs-devel@gnu.org, Robert Pluim <rpluim@gmail.com>, "Mingde (Matthew)
> Zeng" <matthewzmd@gmail.com>, smartlitchi@gmail.com, Elias Mårtenson
> <lokedhs@gmail.com>
> Date: Wed, 08 Jan 2020 12:03:58 +0100
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> > Which is completely consistent with making this feature opt-in, don't
> > you agree? And NEWS will tell so.
>
> If people would read NEWS, this problem wouldn't have come up here.
> Prior to this discussion, ~/.config/emacs/ was pretty nicely
> described in NEWS already.
If the feature is changed to be backward-compatible, the NEWS entry
becomes much less important.
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 13:51 ` Stefan Monnier
@ 2020-01-08 15:58 ` Eli Zaretskii
2020-01-08 16:28 ` Stefan Monnier
2020-01-08 23:26 ` chad
1 sibling, 1 reply; 90+ messages in thread
From: Eli Zaretskii @ 2020-01-08 15:58 UTC (permalink / raw)
To: Stefan Monnier; +Cc: matthewzmd, rpluim, lokedhs, smartlitchi, emacs-devel
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: Eli Zaretskii <eliz@gnu.org>, "Mingde (Matthew) Zeng"
> <matthewzmd@gmail.com>, smartlitchi@gmail.com, Elias Mårtenson
> <lokedhs@gmail.com>, emacs-devel@gnu.org
> Date: Wed, 08 Jan 2020 08:51:27 -0500
>
> Still, a warning when both are present would be welcome.
Not here, it isn't. We had something similar with MS-Windows users
when we moved from the C:/.emacs default, and it was a source of
endless annoyances. No more, please.
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 15:58 ` Eli Zaretskii
@ 2020-01-08 16:28 ` Stefan Monnier
2020-01-08 16:32 ` Eli Zaretskii
0 siblings, 1 reply; 90+ messages in thread
From: Stefan Monnier @ 2020-01-08 16:28 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: matthewzmd, rpluim, lokedhs, smartlitchi, emacs-devel
>> Still, a warning when both are present would be welcome.
> Not here, it isn't. We had something similar with MS-Windows users
> when we moved from the C:/.emacs default, and it was a source of
> endless annoyances. No more, please.
Do you remember details of the annoyance?
Why did people have two .emacs files (and kept them both)?
Maybe these problems wouldn't apply to the ~/.config/emacs -vs- ~/.emacs.d
case, but if they do, it would be good to keep a written trace of it
somewhere to avoid falling back into that trap even after you forgot
about it ;-)
Stefan
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 16:28 ` Stefan Monnier
@ 2020-01-08 16:32 ` Eli Zaretskii
2020-01-08 16:41 ` Mingde (Matthew) Zeng
0 siblings, 1 reply; 90+ messages in thread
From: Eli Zaretskii @ 2020-01-08 16:32 UTC (permalink / raw)
To: Stefan Monnier; +Cc: matthewzmd, rpluim, lokedhs, smartlitchi, emacs-devel
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: rpluim@gmail.com, matthewzmd@gmail.com, smartlitchi@gmail.com,
> lokedhs@gmail.com, emacs-devel@gnu.org
> Date: Wed, 08 Jan 2020 11:28:42 -0500
>
> >> Still, a warning when both are present would be welcome.
> > Not here, it isn't. We had something similar with MS-Windows users
> > when we moved from the C:/.emacs default, and it was a source of
> > endless annoyances. No more, please.
>
> Do you remember details of the annoyance?
The message itself.
> Why did people have two .emacs files (and kept them both)?
Old files tend to stay put, I guess.
> Maybe these problems wouldn't apply to the ~/.config/emacs -vs- ~/.emacs.d
> case, but if they do, it would be good to keep a written trace of it
> somewhere to avoid falling back into that trap even after you forgot
> about it ;-)
I prefer to fix this problem in a way that won't require any warnings
and user interaction. I think making the new feature be more
backward-compatible will provide such a solution. We never needed to
warn people about opt-in features, so I see no reason to do that
here. A directory ~/.config/emacs should not exist unless the user
wants to switch to using it, and preferring an existing ~/.emacs.d
even if ~/.config/emacs does exist will protect those who somehow
create the latter by accident.
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 16:32 ` Eli Zaretskii
@ 2020-01-08 16:41 ` Mingde (Matthew) Zeng
2020-01-08 16:49 ` Robert Pluim
0 siblings, 1 reply; 90+ messages in thread
From: Mingde (Matthew) Zeng @ 2020-01-08 16:41 UTC (permalink / raw)
To: Eli Zaretskii
Cc: rpluim, lokedhs, emacs-devel, matthewzmd, Stefan Monnier,
smartlitchi
> A directory ~/.config/emacs should not exist unless the user
> wants to switch to using it, and preferring an existing ~/.emacs.d
> even if ~/.config/emacs does exist will protect those who somehow
> create the latter by accident.
Sounds good to me.
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 16:41 ` Mingde (Matthew) Zeng
@ 2020-01-08 16:49 ` Robert Pluim
2020-01-08 17:01 ` Eli Zaretskii
2020-01-10 16:57 ` Eli Zaretskii
0 siblings, 2 replies; 90+ messages in thread
From: Robert Pluim @ 2020-01-08 16:49 UTC (permalink / raw)
To: Mingde (Matthew) Zeng
Cc: lokedhs, Eli Zaretskii, smartlitchi, Stefan Monnier, emacs-devel
>>>>> On Wed, 08 Jan 2020 11:41:58 -0500, "Mingde (Matthew) Zeng" <matthewzmd@gmail.com> said:
>> A directory ~/.config/emacs should not exist unless the user
>> wants to switch to using it, and preferring an existing ~/.emacs.d
>> even if ~/.config/emacs does exist will protect those who somehow
>> create the latter by accident.
Mingde> Sounds good to me.
That sounds like my earlier patch, which is 100% guaranteed untested,
so let's just apply it to emacs-27.
Iʼll see if I can test it soon, unless someone beats me to it.
Robert
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 16:49 ` Robert Pluim
@ 2020-01-08 17:01 ` Eli Zaretskii
2020-01-08 17:25 ` Robert Pluim
2020-01-10 16:57 ` Eli Zaretskii
1 sibling, 1 reply; 90+ messages in thread
From: Eli Zaretskii @ 2020-01-08 17:01 UTC (permalink / raw)
To: Robert Pluim; +Cc: matthewzmd, smartlitchi, lokedhs, monnier, emacs-devel
> From: Robert Pluim <rpluim@gmail.com>
> Cc: Eli Zaretskii <eliz@gnu.org>, Stefan Monnier
> <monnier@iro.umontreal.ca>, smartlitchi@gmail.com, lokedhs@gmail.com,
> emacs-devel@gnu.org
> Date: Wed, 08 Jan 2020 17:49:30 +0100
>
> >>>>> On Wed, 08 Jan 2020 11:41:58 -0500, "Mingde (Matthew) Zeng" <matthewzmd@gmail.com> said:
>
> >> A directory ~/.config/emacs should not exist unless the user
> >> wants to switch to using it, and preferring an existing ~/.emacs.d
> >> even if ~/.config/emacs does exist will protect those who somehow
> >> create the latter by accident.
>
> Mingde> Sounds good to me.
>
> That sounds like my earlier patch
It's close. I'd like us to prefer ~/.emacs.d, if it exists, even if
~/.config/emacs also exists. I don't think your patch did that. Am I
wrong?
In any case, we need to update the NEWS entry to be in sync with the
change.
Thanks.
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 17:01 ` Eli Zaretskii
@ 2020-01-08 17:25 ` Robert Pluim
2020-01-08 17:35 ` Eli Zaretskii
0 siblings, 1 reply; 90+ messages in thread
From: Robert Pluim @ 2020-01-08 17:25 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: matthewzmd, smartlitchi, lokedhs, monnier, emacs-devel
>>>>> On Wed, 08 Jan 2020 19:01:42 +0200, Eli Zaretskii <eliz@gnu.org> said:
>> From: Robert Pluim <rpluim@gmail.com>
>> Cc: Eli Zaretskii <eliz@gnu.org>, Stefan Monnier
>> <monnier@iro.umontreal.ca>, smartlitchi@gmail.com, lokedhs@gmail.com,
>> emacs-devel@gnu.org
>> Date: Wed, 08 Jan 2020 17:49:30 +0100
>>
>> >>>>> On Wed, 08 Jan 2020 11:41:58 -0500, "Mingde (Matthew) Zeng" <matthewzmd@gmail.com> said:
>>
>> >> A directory ~/.config/emacs should not exist unless the user
>> >> wants to switch to using it, and preferring an existing ~/.emacs.d
>> >> even if ~/.config/emacs does exist will protect those who somehow
>> >> create the latter by accident.
>>
Mingde> Sounds good to me.
>>
>> That sounds like my earlier patch
Eli> It's close. I'd like us to prefer ~/.emacs.d, if it exists, even if
Eli> ~/.config/emacs also exists. I don't think your patch did that. Am I
Eli> wrong?
It didnʼt indeed. However, you said earlier:
Eli> This will make the new XDG compliant directory an opt-in
Eli> feature: users who want that will have to create
Eli> ~/.config/emacs, move there the contents of ~/.emacs.d, and
Eli> then delete the latter, in order to have Emacs use the XDG
Eli> convention.
If we prefer ~/.config/emacs if it exists, then people who read NEWS
and want to try out the XDG stuff can just copy ~/.emacs.d to
~/.config/emacs and would not have to delete .emacs.d. If they then
change their mind they can simply delete ~/.config/emacs.
I donʼt think itʼs likely that people will accidentally create
~/.config/emacs, so preferring it should not cause any surprises (plus
I feel that 'use x if it exists, else use y' is less prone to
confusion than 'use x if it exists unless y exists').
Robert
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 17:25 ` Robert Pluim
@ 2020-01-08 17:35 ` Eli Zaretskii
2020-01-08 17:44 ` Robert Pluim
0 siblings, 1 reply; 90+ messages in thread
From: Eli Zaretskii @ 2020-01-08 17:35 UTC (permalink / raw)
To: Robert Pluim; +Cc: matthewzmd, smartlitchi, lokedhs, monnier, emacs-devel
> From: Robert Pluim <rpluim@gmail.com>
> Cc: matthewzmd@gmail.com, smartlitchi@gmail.com, lokedhs@gmail.com,
> monnier@iro.umontreal.ca, emacs-devel@gnu.org
> Date: Wed, 08 Jan 2020 18:25:10 +0100
>
> I donʼt think itʼs likely that people will accidentally create
> ~/.config/emacs
But such accident was exactly what started this discussion. So
evidently the probability of that happening is higher than we assume.
> I feel that 'use x if it exists, else use y' is less prone to
> confusion than 'use x if it exists unless y exists').
The advantage of the latter is that it's fully backward-compatible.
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 17:35 ` Eli Zaretskii
@ 2020-01-08 17:44 ` Robert Pluim
2020-01-08 17:56 ` Yuan Fu
2020-01-08 18:07 ` Eli Zaretskii
0 siblings, 2 replies; 90+ messages in thread
From: Robert Pluim @ 2020-01-08 17:44 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: matthewzmd, smartlitchi, lokedhs, monnier, emacs-devel
>>>>> On Wed, 08 Jan 2020 19:35:34 +0200, Eli Zaretskii <eliz@gnu.org> said:
>> From: Robert Pluim <rpluim@gmail.com>
>> Cc: matthewzmd@gmail.com, smartlitchi@gmail.com, lokedhs@gmail.com,
>> monnier@iro.umontreal.ca, emacs-devel@gnu.org
>> Date: Wed, 08 Jan 2020 18:25:10 +0100
>>
>> I donʼt think itʼs likely that people will accidentally create
>> ~/.config/emacs
Eli> But such accident was exactly what started this discussion. So
Eli> evidently the probability of that happening is higher than we assume.
Not really. *emacs* created that directory, not the user, and thatʼs
exactly what weʼre trying to prevent (well, I am :-) ).
>> I feel that 'use x if it exists, else use y' is less prone to
>> confusion than 'use x if it exists unless y exists').
Eli> The advantage of the latter is that it's fully backward-compatible.
It is, but 'use this new thing only if you create it' is pretty
unsurprising as well, weʼre not going to stop using .emacs.d and force
people to use ~/.config/emacs.
Robert
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 17:44 ` Robert Pluim
@ 2020-01-08 17:56 ` Yuan Fu
2020-01-08 18:03 ` Robert Pluim
2020-01-08 18:07 ` Eli Zaretskii
1 sibling, 1 reply; 90+ messages in thread
From: Yuan Fu @ 2020-01-08 17:56 UTC (permalink / raw)
To: Robert Pluim
Cc: lokedhs, emacs-devel, matthewzmd, monnier, Eli Zaretskii,
smartlitchi
> It is, but 'use this new thing only if you create it' is pretty
> unsurprising as well, weʼre not going to stop using .emacs.d and force
> people to use ~/.config/emacs.
Why force people to use ~/.config/emacs when forcing them causes a lot of confusion? This confusion is corroborated by many people. And, although ~/.config/emacs has some advantages, the location of config file is still a personal thing, it is not necessary to force people to change.
Yuan
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 17:56 ` Yuan Fu
@ 2020-01-08 18:03 ` Robert Pluim
2020-01-09 2:27 ` Yuan Fu
0 siblings, 1 reply; 90+ messages in thread
From: Robert Pluim @ 2020-01-08 18:03 UTC (permalink / raw)
To: Yuan Fu
Cc: lokedhs, emacs-devel, matthewzmd, monnier, smartlitchi,
Eli Zaretskii
>>>>> On Wed, 8 Jan 2020 12:56:00 -0500, Yuan Fu <casouri@gmail.com> said:
>> It is, but 'use this new thing only if you create it' is pretty
>> unsurprising as well, weʼre not going to stop using .emacs.d and force
>> people to use ~/.config/emacs.
Yuan> Why force people to use ~/.config/emacs when forcing them causes a lot
Yuan> of confusion? This confusion is corroborated by many people. And,
Yuan> although ~/.config/emacs has some advantages, the location of config
Yuan> file is still a personal thing, it is not necessary to force people to
Yuan> change.
? I said: "weʼre *not* going to stop using .emacs.d", ie "if you do
nothing, we'll keep reading stuff from .emacs.d"
Robert
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 17:44 ` Robert Pluim
2020-01-08 17:56 ` Yuan Fu
@ 2020-01-08 18:07 ` Eli Zaretskii
2020-01-08 18:12 ` Robert Pluim
1 sibling, 1 reply; 90+ messages in thread
From: Eli Zaretskii @ 2020-01-08 18:07 UTC (permalink / raw)
To: Robert Pluim; +Cc: matthewzmd, smartlitchi, lokedhs, monnier, emacs-devel
> From: Robert Pluim <rpluim@gmail.com>
> Date: Wed, 08 Jan 2020 18:44:33 +0100
> Cc: matthewzmd@gmail.com, smartlitchi@gmail.com, lokedhs@gmail.com,
> monnier@iro.umontreal.ca, emacs-devel@gnu.org
>
> Eli> But such accident was exactly what started this discussion. So
> Eli> evidently the probability of that happening is higher than we assume.
>
> Not really. *emacs* created that directory, not the user, and thatʼs
> exactly what weʼre trying to prevent (well, I am :-) ).
It could still happen again, with another Emacs version.
> Eli> The advantage of the latter is that it's fully backward-compatible.
>
> It is, but 'use this new thing only if you create it' is pretty
> unsurprising as well, weʼre not going to stop using .emacs.d and force
> people to use ~/.config/emacs.
Sorry, I'm unconvinced.
Let me put it this way: why should we prefer XDG just because the
directory exists, but not prefer ~/.emacs.d when that one exists?
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 18:07 ` Eli Zaretskii
@ 2020-01-08 18:12 ` Robert Pluim
2020-01-08 18:19 ` Eli Zaretskii
0 siblings, 1 reply; 90+ messages in thread
From: Robert Pluim @ 2020-01-08 18:12 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: matthewzmd, smartlitchi, lokedhs, monnier, emacs-devel
>>>>> On Wed, 08 Jan 2020 20:07:24 +0200, Eli Zaretskii <eliz@gnu.org> said:
>> It is, but 'use this new thing only if you create it' is pretty
>> unsurprising as well, weʼre not going to stop using .emacs.d and force
>> people to use ~/.config/emacs.
Eli> Sorry, I'm unconvinced.
Eli> Let me put it this way: why should we prefer XDG just because the
Eli> directory exists, but not prefer ~/.emacs.d when that one exists?
Because the XDG one will only exist if the user is opting-in to using
it?
Anyway, I guess I canʼt convince you. We'll just have to be very clear
in the NEWS entry.
Robert
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 18:12 ` Robert Pluim
@ 2020-01-08 18:19 ` Eli Zaretskii
2020-01-08 19:45 ` Stefan Monnier
0 siblings, 1 reply; 90+ messages in thread
From: Eli Zaretskii @ 2020-01-08 18:19 UTC (permalink / raw)
To: Robert Pluim; +Cc: matthewzmd, smartlitchi, lokedhs, monnier, emacs-devel
> From: Robert Pluim <rpluim@gmail.com>
> Cc: matthewzmd@gmail.com, smartlitchi@gmail.com, lokedhs@gmail.com,
> monnier@iro.umontreal.ca, emacs-devel@gnu.org
> Date: Wed, 08 Jan 2020 19:12:42 +0100
>
> Eli> Let me put it this way: why should we prefer XDG just because the
> Eli> directory exists, but not prefer ~/.emacs.d when that one exists?
>
> Because the XDG one will only exist if the user is opting-in to using
> it?
If the user created it, sure. But that is not guaranteed, and if it
wasn't the user, as we saw, the preference causes confusion and makes
Emacs behave backward-incompatibly.
> Anyway, I guess I canʼt convince you. We'll just have to be very clear
> in the NEWS entry.
Yes. But backward-compatible behavior makes the NEWS entry much less
important.
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 18:19 ` Eli Zaretskii
@ 2020-01-08 19:45 ` Stefan Monnier
2020-01-08 20:03 ` Eli Zaretskii
0 siblings, 1 reply; 90+ messages in thread
From: Stefan Monnier @ 2020-01-08 19:45 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: matthewzmd, Robert Pluim, lokedhs, smartlitchi, emacs-devel
> If the user created it, sure. But that is not guaranteed, and if it
> wasn't the user, as we saw, the preference causes confusion and makes
> Emacs behave backward-incompatibly.
>
>> Anyway, I guess I canʼt convince you. We'll just have to be very clear
>> in the NEWS entry.
>
> Yes. But backward-compatible behavior makes the NEWS entry much less
> important.
I'm not sure human language is clear enough. So, IIUC, you're suggesting
(defvar user-emacs-directory
(cond
((file-directory-p "~/.emacs.d") "~/.emacs.d/")
((file-directory-p "~/.config/emacs") "~/.config/emacs")
(t "~/.emacs.d/")))
Right? If so, you have my vote.
Stefan
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 19:45 ` Stefan Monnier
@ 2020-01-08 20:03 ` Eli Zaretskii
0 siblings, 0 replies; 90+ messages in thread
From: Eli Zaretskii @ 2020-01-08 20:03 UTC (permalink / raw)
To: Stefan Monnier; +Cc: matthewzmd, rpluim, lokedhs, smartlitchi, emacs-devel
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: Robert Pluim <rpluim@gmail.com>, matthewzmd@gmail.com,
> smartlitchi@gmail.com, lokedhs@gmail.com, emacs-devel@gnu.org
> Date: Wed, 08 Jan 2020 14:45:31 -0500
>
> (defvar user-emacs-directory
> (cond
> ((file-directory-p "~/.emacs.d") "~/.emacs.d/")
> ((file-directory-p "~/.config/emacs") "~/.config/emacs")
> (t "~/.emacs.d/")))
>
> Right?
Yes (modulo accessing $XDG_CONFIG_HOME).
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 13:51 ` Stefan Monnier
2020-01-08 15:58 ` Eli Zaretskii
@ 2020-01-08 23:26 ` chad
2020-01-08 23:32 ` Stefan Monnier
2020-01-09 1:26 ` HaiJun Zhang
1 sibling, 2 replies; 90+ messages in thread
From: chad @ 2020-01-08 23:26 UTC (permalink / raw)
To: Stefan Monnier
Cc: Robert Pluim, Elias Mårtenson, EMACS development team,
Mingde (Matthew) Zeng, smartlitchi, Eli Zaretskii
[-- Attachment #1: Type: text/plain, Size: 366 bytes --]
On Wed, Jan 8, 2020 at 5:52 AM Stefan Monnier <monnier@iro.umontreal.ca>
wrote:
> It's just swapping the current roles of ~/.emacs.d and
> ~/.config/emacs, indeed.
> Still, a warning when both are present would be welcome.
>
I'll suggest a friendly amendment: A warning when both
~/.config/emacs/init.el and ~/.emacs.d/init.el are present would be
welcome.
~Chad
[-- Attachment #2: Type: text/html, Size: 740 bytes --]
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 23:26 ` chad
@ 2020-01-08 23:32 ` Stefan Monnier
2020-01-09 3:34 ` Eli Zaretskii
2020-01-09 1:26 ` HaiJun Zhang
1 sibling, 1 reply; 90+ messages in thread
From: Stefan Monnier @ 2020-01-08 23:32 UTC (permalink / raw)
To: chad
Cc: Robert Pluim, Elias Mårtenson, EMACS development team,
Mingde (Matthew) Zeng, smartlitchi, Eli Zaretskii
> I'll suggest a friendly amendment: A warning when both
> ~/.config/emacs/init.el and ~/.emacs.d/init.el are present would be
> welcome.
Unless they're the same file, yes,
Stefan
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 23:26 ` chad
2020-01-08 23:32 ` Stefan Monnier
@ 2020-01-09 1:26 ` HaiJun Zhang
2020-01-09 5:07 ` 황병희
1 sibling, 1 reply; 90+ messages in thread
From: HaiJun Zhang @ 2020-01-09 1:26 UTC (permalink / raw)
To: Stefan Monnier, chad
Cc: Robert Pluim, Elias Mårtenson, EMACS development team,
Mingde (Matthew) Zeng, Eli Zaretskii, smartlitchi
[-- Attachment #1: Type: text/plain, Size: 821 bytes --]
My user-init-file is set to “~/.emacs” for long time, which will now work for your logic.
There is a long history for “~/.emacs.d”. Old users may be fooled when someone else creates an empty “~/.config/emacs” for him or some packages create it.
I like the backward-compatible proposal. This will not disturb old users.
在 2020年1月9日 +0800 AM7:27,chad <yandros@gmail.com>,写道:
>
>
> > On Wed, Jan 8, 2020 at 5:52 AM Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> > > It's just swapping the current roles of ~/.emacs.d and
> > > ~/.config/emacs, indeed.
> > > Still, a warning when both are present would be welcome.
> >
> > I'll suggest a friendly amendment: A warning when both ~/.config/emacs/init.el and ~/.emacs.d/init.el are present would be welcome.
> >
> > ~Chad
[-- Attachment #2: Type: text/html, Size: 1995 bytes --]
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 18:03 ` Robert Pluim
@ 2020-01-09 2:27 ` Yuan Fu
0 siblings, 0 replies; 90+ messages in thread
From: Yuan Fu @ 2020-01-09 2:27 UTC (permalink / raw)
To: Robert Pluim
Cc: lokedhs, Emacs developers, matthewzmd, monnier, smartlitchi,
Eli Zaretskii
> Yuan> Why force people to use ~/.config/emacs when forcing them causes a lot
> Yuan> of confusion? This confusion is corroborated by many people. And,
> Yuan> although ~/.config/emacs has some advantages, the location of config
> Yuan> file is still a personal thing, it is not necessary to force people to
> Yuan> change.
>
> ? I said: "weʼre *not* going to stop using .emacs.d", ie "if you do
> nothing, we'll keep reading stuff from .emacs.d”
Ah, sorry. I thought you mean just the opposite.
Yuan
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 23:32 ` Stefan Monnier
@ 2020-01-09 3:34 ` Eli Zaretskii
0 siblings, 0 replies; 90+ messages in thread
From: Eli Zaretskii @ 2020-01-09 3:34 UTC (permalink / raw)
To: Stefan Monnier
Cc: rpluim, lokedhs, emacs-devel, matthewzmd, smartlitchi, yandros
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: Robert Pluim <rpluim@gmail.com>, "Mingde (Matthew) Zeng"
> <matthewzmd@gmail.com>, Eli Zaretskii <eliz@gnu.org>, Elias
> Mårtenson
> <lokedhs@gmail.com>, smartlitchi@gmail.com, EMACS development team
> <emacs-devel@gnu.org>
> Date: Wed, 08 Jan 2020 18:32:03 -0500
>
> > I'll suggest a friendly amendment: A warning when both
> > ~/.config/emacs/init.el and ~/.emacs.d/init.el are present would be
> > welcome.
>
> Unless they're the same file, yes,
I already said I'm against any such warnings at startup.
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-09 1:26 ` HaiJun Zhang
@ 2020-01-09 5:07 ` 황병희
0 siblings, 0 replies; 90+ messages in thread
From: 황병희 @ 2020-01-09 5:07 UTC (permalink / raw)
To: EMACS development team
HaiJun Zhang <netjune@outlook.com> writes:
> My user-init-file is set to “~/.emacs” for long time, [...]
> I like the backward-compatible proposal. This will not disturb old users.
Yes, i agree with your comments.
Sincerely,
--
^고맙습니다 _地平天成_ 감사합니다_^))//
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-08 16:49 ` Robert Pluim
2020-01-08 17:01 ` Eli Zaretskii
@ 2020-01-10 16:57 ` Eli Zaretskii
2020-01-11 1:46 ` Paul Eggert
1 sibling, 1 reply; 90+ messages in thread
From: Eli Zaretskii @ 2020-01-10 16:57 UTC (permalink / raw)
To: Robert Pluim; +Cc: emacs-devel
> From: Robert Pluim <rpluim@gmail.com>
> Date: Wed, 08 Jan 2020 17:49:30 +0100
> Cc: lokedhs@gmail.com, Eli Zaretskii <eliz@gnu.org>, smartlitchi@gmail.com,
> Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
>
> >>>>> On Wed, 08 Jan 2020 11:41:58 -0500, "Mingde (Matthew) Zeng" <matthewzmd@gmail.com> said:
>
> That sounds like my earlier patch, which is 100% guaranteed untested,
> so let's just apply it to emacs-27.
>
> Iʼll see if I can test it soon, unless someone beats me to it.
Any news with this? I'd like to have this in the repository ASAP, so
that the pretest (which is expected soonish) will have it.
TIA
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-10 16:57 ` Eli Zaretskii
@ 2020-01-11 1:46 ` Paul Eggert
2020-01-11 7:58 ` Eli Zaretskii
` (3 more replies)
0 siblings, 4 replies; 90+ messages in thread
From: Paul Eggert @ 2020-01-11 1:46 UTC (permalink / raw)
To: Eli Zaretskii, Robert Pluim; +Cc: emacs-devel
On 1/10/20 8:57 AM, Eli Zaretskii wrote:
>> Iʼll see if I can test it soon, unless someone beats me to it.
> Any news with this? I'd like to have this in the repository ASAP, so
> that the pretest (which is expected soonish) will have it.
Which version is "this"? It's kind of a long thread....
If the idea is to go back to defaulting to .emacs.d, that's a step in
the wrong direction. Instead, I suggest that when Emacs starts up in a
fresh home directory that lacks both .config/emacs and .emacs.d, Emacs
creates .config/emacs and sets up a symlink .emacs.d -> .config/emacs.
This would avoid the specific problem that Elias ran into, and is less
likely to cause problems in environments where user configurations live
in '.config'.
Partly I suggest this because it's what I've already been doing by hand:
the symlink makes things more convenient for users who run a mixture of
Emacs versions, as I do.
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-11 1:46 ` Paul Eggert
@ 2020-01-11 7:58 ` Eli Zaretskii
2020-01-11 15:43 ` Drew Adams
` (2 subsequent siblings)
3 siblings, 0 replies; 90+ messages in thread
From: Eli Zaretskii @ 2020-01-11 7:58 UTC (permalink / raw)
To: Paul Eggert; +Cc: rpluim, emacs-devel
> Cc: emacs-devel@gnu.org
> From: Paul Eggert <eggert@cs.ucla.edu>
> Date: Fri, 10 Jan 2020 17:46:34 -0800
>
> On 1/10/20 8:57 AM, Eli Zaretskii wrote:
> >> Iʼll see if I can test it soon, unless someone beats me to it.
> > Any news with this? I'd like to have this in the repository ASAP, so
> > that the pretest (which is expected soonish) will have it.
>
> Which version is "this"? It's kind of a long thread....
>
> If the idea is to go back to defaulting to .emacs.d, that's a step in
> the wrong direction.
I disagree, and most of the participants in this discussion disagree
as well.
> Instead, I suggest that when Emacs starts up in a fresh home
> directory that lacks both .config/emacs and .emacs.d, Emacs creates
> .config/emacs and sets up a symlink .emacs.d -> .config/emacs.
I'm not going to endorse creation of symlinks by Emacs, sorry. It's
bad enough that we create files and directories, before we even know
they will be needed.
A simple and effective solution was found in this discussion, and it
was overwhelmingly agreed to. Let's implement it and see what
feedback the pretest brings us. Yes, this solution is a kind of
retreat from the original intent, which was proved to be too bold.
But it still allows users to opt-in to using XDG if they so want, and
doesn't make that too hard. So I think it's a good compromise, and we
shouldn't over-engineer it any more.
^ permalink raw reply [flat|nested] 90+ messages in thread
* RE: Default emacs init file location confusion
2020-01-11 1:46 ` Paul Eggert
2020-01-11 7:58 ` Eli Zaretskii
@ 2020-01-11 15:43 ` Drew Adams
2020-01-11 16:16 ` Stefan Monnier
2020-01-13 7:53 ` Robert Pluim
3 siblings, 0 replies; 90+ messages in thread
From: Drew Adams @ 2020-01-11 15:43 UTC (permalink / raw)
To: Paul Eggert, Eli Zaretskii, Robert Pluim; +Cc: emacs-devel
> I suggest that when Emacs starts up in a fresh home
> directory that lacks both .config/emacs and .emacs.d,
> Emacs creates .config/emacs and sets up a symlink
> .emacs.d -> .config/emacs.
(Ignore if irrelevant - I'm not following this thread.)
Just do you mean by a "fresh home directory", and what
do you mean by starting up "in" such a directory?
I'd hope that if a user has neither .config/emacs nor
.emacs.d in her designated home directory (e.g. HOME env
var) then Emacs would not create any such subdirs of
that home dir. I'd hope that if a user has HOME defined
then Emacs would continue to leave well enough alone in
this regard.
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-11 1:46 ` Paul Eggert
2020-01-11 7:58 ` Eli Zaretskii
2020-01-11 15:43 ` Drew Adams
@ 2020-01-11 16:16 ` Stefan Monnier
2020-01-11 18:08 ` Eli Zaretskii
2020-01-13 7:53 ` Robert Pluim
3 siblings, 1 reply; 90+ messages in thread
From: Stefan Monnier @ 2020-01-11 16:16 UTC (permalink / raw)
To: Paul Eggert; +Cc: Eli Zaretskii, Robert Pluim, emacs-devel
> If the idea is to go back to defaulting to .emacs.d, that's a step in the
> wrong direction.
It might be "stepping away from XDG" compared to what we currently have
in Emacs-27, but it's still "stepping toward XDG" compared to Emacs-26,
so it's still in the right direction, methinks.
Stefan
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-11 16:16 ` Stefan Monnier
@ 2020-01-11 18:08 ` Eli Zaretskii
0 siblings, 0 replies; 90+ messages in thread
From: Eli Zaretskii @ 2020-01-11 18:08 UTC (permalink / raw)
To: Stefan Monnier; +Cc: rpluim, eggert, emacs-devel
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: Eli Zaretskii <eliz@gnu.org>, Robert Pluim <rpluim@gmail.com>,
> emacs-devel@gnu.org
> Date: Sat, 11 Jan 2020 11:16:19 -0500
>
> > If the idea is to go back to defaulting to .emacs.d, that's a step in the
> > wrong direction.
>
> It might be "stepping away from XDG" compared to what we currently have
> in Emacs-27, but it's still "stepping toward XDG" compared to Emacs-26,
> so it's still in the right direction, methinks.
In my POV, we are simply making the XDG support slightly more
conservative and cautious. We certainly don't disable it or back it
out.
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-11 1:46 ` Paul Eggert
` (2 preceding siblings ...)
2020-01-11 16:16 ` Stefan Monnier
@ 2020-01-13 7:53 ` Robert Pluim
2020-01-13 14:36 ` Robert Pluim
2020-01-13 16:17 ` Eli Zaretskii
3 siblings, 2 replies; 90+ messages in thread
From: Robert Pluim @ 2020-01-13 7:53 UTC (permalink / raw)
To: Paul Eggert; +Cc: Eli Zaretskii, emacs-devel
>>>>> On Fri, 10 Jan 2020 17:46:34 -0800, Paul Eggert <eggert@cs.ucla.edu> said:
Paul> On 1/10/20 8:57 AM, Eli Zaretskii wrote:
>>> Iʼll see if I can test it soon, unless someone beats me to it.
>> Any news with this? I'd like to have this in the repository ASAP, so
>> that the pretest (which is expected soonish) will have it.
Paul> Which version is "this"? It's kind of a long thread....
I think "this" is something like the following.
;; Return the name of the init file directory for Emacs, assuming
;; XDG-DIR is the XDG location and USER-NAME is the user name. If
;; USER-NAME is nil or "", use the current user. Prefer the XDG
;; location only if the .emacs.d location does not exist.
(defun startup--xdg-or-homedot (xdg-dir user-name)
(let ((emacs-d-dir (concat "~" user-name
(if (eq system-type 'ms-dos)
"/_emacs.d/"
"/.emacs.d/"))))
(cond
((or (file-exists-p emacs-d-dir)
(if (eq system-type 'windows-nt)
(if (file-directory-p (concat "~" user-name))
(directory-files (concat "~" user-name) nil
"\\`[._]emacs\\(\\.elc?\\)?\\'"))
(file-exists-p (concat "~" init-file-user
(if (eq system-type 'ms-dos)
"/_emacs"
"/.emacs")))))
emacs-d-dir)
((file-exists-p xdg-dir)
xdg-dir)
(t emacs-d-dir))))
This requires an etc/NEWS update as well.
Paul> If the idea is to go back to defaulting to .emacs.d, that's a step in
Paul> the wrong direction. Instead, I suggest that when Emacs starts up in a
Paul> fresh home directory that lacks both .config/emacs and .emacs.d, Emacs
Paul> creates .config/emacs and sets up a symlink .emacs.d ->
Paul> .config/emacs. This would avoid the specific problem that Elias ran
Paul> into, and is less likely to cause problems in environments where user
Paul> configurations live in '.config'.
Paul> Partly I suggest this because it's what I've already been doing by
Paul> hand: the symlink makes things more convenient for users who run a
Paul> mixture of Emacs versions, as I do.
I have no objection to symlinking, but Eli really wants to only use
XDG if .emacs.d is non-existent.
Robert
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-13 7:53 ` Robert Pluim
@ 2020-01-13 14:36 ` Robert Pluim
2020-01-13 15:27 ` Colin Baxter
` (2 more replies)
2020-01-13 16:17 ` Eli Zaretskii
1 sibling, 3 replies; 90+ messages in thread
From: Robert Pluim @ 2020-01-13 14:36 UTC (permalink / raw)
To: Paul Eggert; +Cc: Eli Zaretskii, emacs-devel
>>>>> On Mon, 13 Jan 2020 08:53:47 +0100, Robert Pluim <rpluim@gmail.com> said:
Robert> This requires an etc/NEWS update as well.
Comments definitely welcome. Any hint of possible ambiguity is to be
ruthlessly eliminated.
+++
** Emacs can now use the XDG convention for init files.
For example, it can look for init.el in "~/.config/emacs/init.el", and
similarly for other init files.
The 'XDG_CONFIG_HOME' environment variable (which defaults to "~/.config")
specifies the parent directory of these and other configuration files.
Emacs will initially look for init files in their traditional
locations if "~/.emacs.d" or "~/.emacs" exist, even if
"$XDG_CONFIG_HOME/emacs" also exists. This implies that you must
delete or rename any existing "~/.emacs.d" and "~/.emacs" to enable
use of the XDG directory.
If "~/.emacs.d" does not exist, and Emacs has decided to use it
(i.e. $XDG_CONFIG_HOME/emacs does not exist), Emacs will create that
directory and set 'user-emacs-directory' to point to it. Emacs will
never create "$XDG_CONFIG_HOME/emacs".
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-13 14:36 ` Robert Pluim
@ 2020-01-13 15:27 ` Colin Baxter
2020-01-13 15:37 ` Robert Pluim
2020-01-13 16:15 ` Eli Zaretskii
2020-01-13 16:52 ` Stefan Kangas
2 siblings, 1 reply; 90+ messages in thread
From: Colin Baxter @ 2020-01-13 15:27 UTC (permalink / raw)
To: Robert Pluim; +Cc: Eli Zaretskii, Paul Eggert, emacs-devel
>>>>> Robert Pluim <rpluim@gmail.com> writes:
>>>>> On Mon, 13 Jan 2020 08:53:47 +0100, Robert Pluim <rpluim@gmail.com> said:
Robert> This requires an etc/NEWS update as well.
> Comments definitely welcome. Any hint of possible ambiguity is to
> be ruthlessly eliminated.
> +++ ** Emacs can now use the XDG convention for init files. For
> example, it can look for init.el in "~/.config/emacs/init.el", and
> similarly for other init files.
For those emacs users who are not computer science graduates, could
something be included in NEWS, say a URL link, to explain *briefly* this
XDG convention?
Best wishes,
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-13 15:27 ` Colin Baxter
@ 2020-01-13 15:37 ` Robert Pluim
2020-01-13 15:58 ` Colin Baxter
0 siblings, 1 reply; 90+ messages in thread
From: Robert Pluim @ 2020-01-13 15:37 UTC (permalink / raw)
To: Colin Baxter; +Cc: Eli Zaretskii, Paul Eggert, emacs-devel
>>>>> On Mon, 13 Jan 2020 15:27:26 +0000, Colin Baxter <m43cap@yandex.com> said:
>>>>> Robert Pluim <rpluim@gmail.com> writes:
>>>>> On Mon, 13 Jan 2020 08:53:47 +0100, Robert Pluim <rpluim@gmail.com> said:
Robert> This requires an etc/NEWS update as well.
>> Comments definitely welcome. Any hint of possible ambiguity is to
>> be ruthlessly eliminated.
>> +++ ** Emacs can now use the XDG convention for init files. For
>> example, it can look for init.el in "~/.config/emacs/init.el", and
>> similarly for other init files.
Colin> For those emacs users who are not computer science graduates, could
Colin> something be included in NEWS, say a URL link, to explain *briefly* this
Colin> XDG convention?
I donʼt know about brief, but thereʼs
<https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html>
Robert
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-13 15:37 ` Robert Pluim
@ 2020-01-13 15:58 ` Colin Baxter
2020-01-13 16:05 ` Robert Pluim
2020-01-13 16:42 ` Eli Zaretskii
0 siblings, 2 replies; 90+ messages in thread
From: Colin Baxter @ 2020-01-13 15:58 UTC (permalink / raw)
To: Robert Pluim; +Cc: Eli Zaretskii, Paul Eggert, emacs-devel
>>>>> Robert Pluim <rpluim@gmail.com> writes:
>>>>> On Mon, 13 Jan 2020 15:27:26 +0000, Colin Baxter <m43cap@yandex.com> said:
>>>>> Robert Pluim <rpluim@gmail.com> writes:
>>>>> On Mon, 13 Jan 2020 08:53:47 +0100, Robert Pluim <rpluim@gmail.com> said:
Robert> This requires an etc/NEWS update as well.
>>> Comments definitely welcome. Any hint of possible ambiguity is
>>> to be ruthlessly eliminated.
>>> +++ ** Emacs can now use the XDG convention for init files. For
>>> example, it can look for init.el in "~/.config/emacs/init.el",
>>> and similarly for other init files.
Colin> For those emacs users who are not computer science graduates,
Colin> could something be included in NEWS, say a URL link, to
Colin> explain *briefly* this XDG convention?
> I donʼt know about brief, but thereʼs
> <https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html>
Yes, I've seen that url before. I was thinking more along the lines of few
words on why it's necessary now for emacs to adopt the convention - it
is after all only a convention. However, I don't want to re-start the
~/.emacs.d versus ~/.config/emacs argument!
Best wishes,
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-13 15:58 ` Colin Baxter
@ 2020-01-13 16:05 ` Robert Pluim
2020-01-13 16:42 ` Eli Zaretskii
1 sibling, 0 replies; 90+ messages in thread
From: Robert Pluim @ 2020-01-13 16:05 UTC (permalink / raw)
To: Colin Baxter; +Cc: Eli Zaretskii, Paul Eggert, emacs-devel
>>>>> On Mon, 13 Jan 2020 15:58:03 +0000, Colin Baxter <m43cap@yandex.com> said:
>>>>> Robert Pluim <rpluim@gmail.com> writes:
>>>>> On Mon, 13 Jan 2020 15:27:26 +0000, Colin Baxter <m43cap@yandex.com> said:
>>>>> Robert Pluim <rpluim@gmail.com> writes:
>>>>> On Mon, 13 Jan 2020 08:53:47 +0100, Robert Pluim <rpluim@gmail.com> said:
Robert> This requires an etc/NEWS update as well.
>>>> Comments definitely welcome. Any hint of possible ambiguity is
>>>> to be ruthlessly eliminated.
>>>> +++ ** Emacs can now use the XDG convention for init files. For
>>>> example, it can look for init.el in "~/.config/emacs/init.el",
>>>> and similarly for other init files.
Colin> For those emacs users who are not computer science graduates,
Colin> could something be included in NEWS, say a URL link, to
Colin> explain *briefly* this XDG convention?
>> I donʼt know about brief, but thereʼs
>> <https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html>
Colin> Yes, I've seen that url before. I was thinking more along the lines of few
Colin> words on why it's necessary now for emacs to adopt the convention - it
Colin> is after all only a convention. However, I don't want to re-start the
Colin> ~/.emacs.d versus ~/.config/emacs argument!
Weʼre not adopting the convention, weʼre allowing users to take
advantage of it if they wish. I guess we could say that in NEWS, but I
fear it would be a bit tautological: "If you want to use the XDG
conventions, put your files in the XDG location"
Robert.
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-13 14:36 ` Robert Pluim
2020-01-13 15:27 ` Colin Baxter
@ 2020-01-13 16:15 ` Eli Zaretskii
2020-01-13 16:39 ` Robert Pluim
2020-01-13 16:52 ` Stefan Kangas
2 siblings, 1 reply; 90+ messages in thread
From: Eli Zaretskii @ 2020-01-13 16:15 UTC (permalink / raw)
To: Robert Pluim; +Cc: eggert, emacs-devel
> From: Robert Pluim <rpluim@gmail.com>
> Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
> Date: Mon, 13 Jan 2020 15:36:08 +0100
>
> >>>>> On Mon, 13 Jan 2020 08:53:47 +0100, Robert Pluim <rpluim@gmail.com> said:
>
> Robert> This requires an etc/NEWS update as well.
>
> Comments definitely welcome. Any hint of possible ambiguity is to be
> ruthlessly eliminated.
This is fine with me, with a single comment:
> +++
> ** Emacs can now use the XDG convention for init files.
> For example, it can look for init.el in "~/.config/emacs/init.el", and
> similarly for other init files.
I would remove the last sentence, as "for example" should IMO be after
the more general description.
> The 'XDG_CONFIG_HOME' environment variable (which defaults to "~/.config")
> specifies the parent directory of these and other configuration files.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
And change here to say "directory of init.el and other configuration
files".
Btw, the "+++" before the NEWS entry means we have this documented in
the manuals, but I wonder whether the current text there is in sync
with the code change we are about to install.
Thanks.
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-13 7:53 ` Robert Pluim
2020-01-13 14:36 ` Robert Pluim
@ 2020-01-13 16:17 ` Eli Zaretskii
2020-01-13 16:29 ` Robert Pluim
1 sibling, 1 reply; 90+ messages in thread
From: Eli Zaretskii @ 2020-01-13 16:17 UTC (permalink / raw)
To: Robert Pluim; +Cc: eggert, emacs-devel
> From: Robert Pluim <rpluim@gmail.com>
> Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
> Date: Mon, 13 Jan 2020 08:53:47 +0100
>
> I think "this" is something like the following.
LGTM, thanks.
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-13 16:17 ` Eli Zaretskii
@ 2020-01-13 16:29 ` Robert Pluim
0 siblings, 0 replies; 90+ messages in thread
From: Robert Pluim @ 2020-01-13 16:29 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: eggert, emacs-devel
>>>>> On Mon, 13 Jan 2020 18:17:22 +0200, Eli Zaretskii <eliz@gnu.org> said:
>> From: Robert Pluim <rpluim@gmail.com>
>> Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
>> Date: Mon, 13 Jan 2020 08:53:47 +0100
>>
>> I think "this" is something like the following.
Eli> LGTM, thanks.
Well, Iʼll have to test it before I push, of course :-)
Robert
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-13 16:15 ` Eli Zaretskii
@ 2020-01-13 16:39 ` Robert Pluim
2020-01-14 14:00 ` Robert Pluim
0 siblings, 1 reply; 90+ messages in thread
From: Robert Pluim @ 2020-01-13 16:39 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: eggert, emacs-devel
>>>>> On Mon, 13 Jan 2020 18:15:54 +0200, Eli Zaretskii <eliz@gnu.org> said:
>> +++
>> ** Emacs can now use the XDG convention for init files.
>> For example, it can look for init.el in "~/.config/emacs/init.el", and
>> similarly for other init files.
Eli> I would remove the last sentence, as "for example" should IMO be after
Eli> the more general description.
OK.
>> The 'XDG_CONFIG_HOME' environment variable (which defaults to "~/.config")
>> specifies the parent directory of these and other configuration files.
Eli> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Eli> And change here to say "directory of init.el and other configuration
Eli> files".
Hmm, I did that, and found the result not as clear as it could
be. Iʼll do some more wordsmithing.
Eli> Btw, the "+++" before the NEWS entry means we have this documented in
Eli> the manuals, but I wonder whether the current text there is in sync
Eli> with the code change we are about to install.
No, it is definitely not aligned.
Robert
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-13 15:58 ` Colin Baxter
2020-01-13 16:05 ` Robert Pluim
@ 2020-01-13 16:42 ` Eli Zaretskii
2020-01-13 16:59 ` Colin Baxter
1 sibling, 1 reply; 90+ messages in thread
From: Eli Zaretskii @ 2020-01-13 16:42 UTC (permalink / raw)
To: Colin Baxter; +Cc: rpluim, eggert, emacs-devel
> From: Colin Baxter <m43cap@yandex.com>
> Date: Mon, 13 Jan 2020 15:58:03 +0000
> Cc: , Eli Zaretskii <eliz@gnu.org>, Paul Eggert <eggert@cs.ucla.edu>,
> emacs-devel@gnu.org
>
> I was thinking more along the lines of few words on why it's
> necessary now for emacs to adopt the convention - it is after all
> only a convention.
The reason is "by popular demand". If this is what you wanted us to
say that in NEWS, I'm okay with saying it.
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-13 14:36 ` Robert Pluim
2020-01-13 15:27 ` Colin Baxter
2020-01-13 16:15 ` Eli Zaretskii
@ 2020-01-13 16:52 ` Stefan Kangas
2 siblings, 0 replies; 90+ messages in thread
From: Stefan Kangas @ 2020-01-13 16:52 UTC (permalink / raw)
To: Robert Pluim; +Cc: Eli Zaretskii, Paul Eggert, Emacs developers
Robert Pluim <rpluim@gmail.com> writes:
> This implies that you must
> delete or rename any existing "~/.emacs.d" and "~/.emacs" to enable
> use of the XDG directory.
Very minor nitpick: I suggest to change "implies" to "means". I
believe that it would be slightly easier to understand for non-native
speakers and/or people without formal training in e.g. computer
science or math.
Best regards,
Stefan Kangas
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-13 16:42 ` Eli Zaretskii
@ 2020-01-13 16:59 ` Colin Baxter
2020-01-13 17:06 ` Robert Pluim
0 siblings, 1 reply; 90+ messages in thread
From: Colin Baxter @ 2020-01-13 16:59 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: rpluim, eggert, emacs-devel
>>>>> Eli Zaretskii <eliz@gnu.org> writes:
>> From: Colin Baxter <m43cap@yandex.com> Date: Mon, 13 Jan 2020
>> 15:58:03 +0000 Cc: , Eli Zaretskii <eliz@gnu.org>, Paul Eggert
>> <eggert@cs.ucla.edu>, emacs-devel@gnu.org
>>
>> I was thinking more along the lines of few words on why it's
>> necessary now for emacs to adopt the convention - it is after all
>> only a convention.
> The reason is "by popular demand". If this is what you wanted us
> to say that in NEWS, I'm okay with saying it.
I thought it had something to do with *.desktop files. I don't use them so
I don't know.
Best wishes,
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-13 16:59 ` Colin Baxter
@ 2020-01-13 17:06 ` Robert Pluim
2020-01-13 17:21 ` Colin Baxter
0 siblings, 1 reply; 90+ messages in thread
From: Robert Pluim @ 2020-01-13 17:06 UTC (permalink / raw)
To: Colin Baxter; +Cc: Eli Zaretskii, eggert, emacs-devel
>>>>> On Mon, 13 Jan 2020 16:59:58 +0000, Colin Baxter <m43cap@yandex.com> said:
>>>>> Eli Zaretskii <eliz@gnu.org> writes:
>>> From: Colin Baxter <m43cap@yandex.com> Date: Mon, 13 Jan 2020
>>> 15:58:03 +0000 Cc: , Eli Zaretskii <eliz@gnu.org>, Paul Eggert
>>> <eggert@cs.ucla.edu>, emacs-devel@gnu.org
>>>
>>> I was thinking more along the lines of few words on why it's
>>> necessary now for emacs to adopt the convention - it is after all
>>> only a convention.
>> The reason is "by popular demand". If this is what you wanted us
>> to say that in NEWS, I'm okay with saying it.
Colin> I thought it had something to do with *.desktop files. I don't use them so
Colin> I don't know.
*.desktop files are for telling your desktop environment how you want
certain applications launched (I think. I use the cli to launch
applications). Iʼll see how I can phrase 'by popular demand' and 'for
config files'.
Robert
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-13 17:06 ` Robert Pluim
@ 2020-01-13 17:21 ` Colin Baxter
0 siblings, 0 replies; 90+ messages in thread
From: Colin Baxter @ 2020-01-13 17:21 UTC (permalink / raw)
To: Robert Pluim; +Cc: Eli Zaretskii, eggert, emacs-devel
>>>>> Robert Pluim <rpluim@gmail.com> writes:
>>>>> On Mon, 13 Jan 2020 16:59:58 +0000, Colin Baxter <m43cap@yandex.com> said:
>>>>> Eli Zaretskii <eliz@gnu.org> writes:
>>>> From: Colin Baxter <m43cap@yandex.com> Date: Mon, 13 Jan 2020
>>>> 15:58:03 +0000 Cc: , Eli Zaretskii <eliz@gnu.org>, Paul Eggert
>>>> <eggert@cs.ucla.edu>, emacs-devel@gnu.org
>>>>
>>>> I was thinking more along the lines of few words on why it's
>>>> necessary now for emacs to adopt the convention - it is after
>>>> all only a convention.
>>> The reason is "by popular demand". If this is what you wanted
>>> us to say that in NEWS, I'm okay with saying it.
Colin> I thought it had something to do with *.desktop files. I
Colin> don't use them so I don't know.
> *.desktop files are for telling your desktop environment how you
> want certain applications launched (I think. I use the cli to
> launch applications). Iʼll see how I can phrase 'by popular
> demand' and 'for config files'.
Thank you.
Best wishes.
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-13 16:39 ` Robert Pluim
@ 2020-01-14 14:00 ` Robert Pluim
2020-01-14 16:05 ` Eli Zaretskii
0 siblings, 1 reply; 90+ messages in thread
From: Robert Pluim @ 2020-01-14 14:00 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: eggert, emacs-devel
>>>>> On Mon, 13 Jan 2020 17:39:19 +0100, Robert Pluim <rpluim@gmail.com> said:
>>>>> On Mon, 13 Jan 2020 18:15:54 +0200, Eli Zaretskii <eliz@gnu.org> said:
Eli> Btw, the "+++" before the NEWS entry means we have this documented in
Eli> the manuals, but I wonder whether the current text there is in sync
Eli> with the code change we are about to install.
Robert> No, it is definitely not aligned.
Robert> Robert
So hereʼs what I have so far.
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi
index 1958a86b92..55c3141a71 100644
--- a/doc/emacs/custom.texi
+++ b/doc/emacs/custom.texi
@@ -2655,26 +2655,34 @@ Find Init
Emacs normally finds your init file in a location under your home
directory. @xref{Init File}. By default this location is
-@file{~/.config/emacs/init.el} where @file{~/} stands for your home directory.
+@file{~/.emacs.d/init.el} where @file{~/} stands for your home directory.
This default can be overridden as described below.
- If @env{XDG_CONFIG_HOME} is set in your environment, its
-value replaces @file{~/.config} in the name of the default
-init file.
-
- If the default init file's parent directory does not exist but the
-directory @file{~/.emacs.d} does exist, Emacs looks for your init file
+Emacs looks for your init file
using the filenames @file{~/.emacs.el}, @file{~/.emacs}, or
@file{~/.emacs.d/init.el}; you can choose to use any one of these
names. (Note that only the locations directly in your home directory
-have a leading dot in the location's basename.) Although this is
-backward-compatible with older Emacs versions, modern POSIX platforms
-prefer putting your initialization files under @file{~/.config} so
-that troubleshooting a problem that might be due to a bad init file,
-or archiving a collection of init files, can be done by renaming that
-directory. To help older Emacs versions find configuration files in
-their current default locations, you can execute the following
-Emacs Lisp code:
+have a leading dot in the location's basename.)
+
+Emacs can also look in an XDG-compatible location for @file{init.el},
+the default is the directory @file{~/.config/emacs}. This can be
+overriden by setting @env{XDG_CONFIG_HOME} in your environment, its
+value replaces @file{~/.config} in the name of the default XDG init
+file. However @file{~/.emacs.d} and @file{~/.emacs} are always
+preferred if they exist, which means that you must delete or rename
+them in order to use the XDG location.
+
+Note also that if neither the XDG location nor @file{~/.emacs.d}
+exist, then Emacs will create @file{~/.emacs.d} (and therefore use it
+during subsequent invocations).
+
+Although this is backward-compatible with older Emacs versions, modern
+POSIX platforms prefer putting your initialization files under
+@file{~/.config} so that troubleshooting a problem that might be due
+to a bad init file, or archiving a collection of init files, can be
+done by renaming that directory. To help older Emacs versions find
+configuration files in their current default locations, you can
+execute the following Emacs Lisp code:
@example
(make-symbolic-link ".config/emacs" "~/.emacs.d")
@@ -2694,7 +2702,7 @@ Find Init
name in the system's data base of users.
For brevity the rest of the Emacs documentation generally uses just
-the current default location @file{~/.config/emacs/init.el} for the
+the current default location @file{~/.emacs.d/init.el} for the
init file.
@c LocalWords: backtab
@@ -2740,7 +2748,7 @@ Early Init File
@xref{Init File}. However, it is sometimes desirable
to have customizations that take effect during Emacs startup earlier than the
normal init file is processed. Such customizations can be put in the early
-init file, @file{~/.config/emacs.d/early-init.el} or @file{~/.emacs.d/early-init.el}. This file is loaded before the
+init file, @file{~/.config/emacs/early-init.el} or @file{~/.emacs.d/early-init.el}. This file is loaded before the
package system and GUI is initialized, so in it you can customize variables
that affect frame appearance as well as the package initialization process,
such as @code{package-enable-at-startup}, @code{package-load-list}, and
diff --git a/etc/NEWS b/etc/NEWS
index cea5d500c7..0837bd2336 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -154,25 +154,24 @@ support.
* Startup Changes in Emacs 27.1
+++
-** Emacs now uses the XDG convention for init files.
-For example, it looks for init.el in "~/.config/emacs/init.el", and
-similarly for other init files.
-
-The 'XDG_CONFIG_HOME' environment variable (which defaults to "~/.config")
-specifies the parent directory of these and other configuration files,
-and will override their traditional locations (the home directory,
-"~/.emacs.d", etc.).
-
-Emacs will still look for init files in their traditional locations if
-"$XDG_CONFIG_HOME/emacs" does not exist, but "~/.emacs.d" or
-"~/.emacs" does exist, so invoking Emacs with XDG_CONFIG_HOME='/nowhere'
-might be useful if your new-location init files are scrambled, or if
-you want to force Emacs to ignore files under 'XDG_CONFIG_HOME' for
-some other reason.
-
-If neither "$XDG_CONFIG_HOME/emacs" nor "~/.emacs.d" exist, Emacs will
-now default to "$XDG_CONFIG_HOME/emacs", and will create that directory
-and set 'user-emacs-directory' to point to it.
+** Emacs can now use the XDG convention for init files.
+The 'XDG_CONFIG_HOME' environment variable (which defaults to
+"~/.config") specifies the XDG configuration parent directory. Emacs
+checks for "init.el" and other configuration files inside the "emacs"
+subdirectory of 'XDG_CONFIG_HOME', i.e. "$XDG_CONFIG_HOME/emacs/init.el"
+
+Emacs will still initially look for init files in their traditional
+locations if "~/.emacs.d" or "~/.emacs" exist, even if
+"$XDG_CONFIG_HOME/emacs" also exists. This means that you must delete
+or rename any existing "~/.emacs.d" and "~/.emacs" to enable use of
+the XDG directory.
+
+If "~/.emacs.d" does not exist, and Emacs has decided to use it
+(i.e. "$XDG_CONFIG_HOME/emacs" does not exist), Emacs will create it.
+Emacs will never create "$XDG_CONFIG_HOME/emacs".
+
+Whichever directory Emacs decides to use, it will set
+'user-emacs-directory' to point to it.
+++
** Emacs can now be configured using an early init file.
diff --git a/lisp/startup.el b/lisp/startup.el
index 2a85c004da..1f545c6692 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -497,28 +497,28 @@ startup--xdg-config-default
(defvar startup--xdg-config-home-emacs)
;; Return the name of the init file directory for Emacs, assuming
-;; XDG-DIR is the XDG location and USER-NAME is the user name.
-;; If USER-NAME is nil or "", use the current user.
-;; Prefer the XDG location unless it does does not exist and the
-;; .emacs.d location does exist.
+;; XDG-DIR is the XDG location and USER-NAME is the user name. If
+;; USER-NAME is nil or "", use the current user. Prefer the XDG
+;; location only if the .emacs.d location does not exist.
(defun startup--xdg-or-homedot (xdg-dir user-name)
- (if (file-exists-p xdg-dir)
- xdg-dir
- (let ((emacs-d-dir (concat "~" user-name
- (if (eq system-type 'ms-dos)
- "/_emacs.d/"
- "/.emacs.d/"))))
- (if (or (file-exists-p emacs-d-dir)
- (if (eq system-type 'windows-nt)
- (if (file-directory-p (concat "~" user-name))
- (directory-files (concat "~" user-name) nil
- "\\`[._]emacs\\(\\.elc?\\)?\\'"))
- (file-exists-p (concat "~" init-file-user
- (if (eq system-type 'ms-dos)
- "/_emacs"
- "/.emacs")))))
- emacs-d-dir
- xdg-dir))))
+ (let ((emacs-d-dir (concat "~" user-name
+ (if (eq system-type 'ms-dos)
+ "/_emacs.d/"
+ "/.emacs.d/"))))
+ (cond
+ ((or (file-exists-p emacs-d-dir)
+ (if (eq system-type 'windows-nt)
+ (if (file-directory-p (concat "~" user-name))
+ (directory-files (concat "~" user-name) nil
+ "\\`[._]emacs\\(\\.elc?\\)?\\'"))
+ (file-exists-p (concat "~" init-file-user
+ (if (eq system-type 'ms-dos)
+ "/_emacs"
+ "/.emacs")))))
+ emacs-d-dir)
+ ((file-exists-p xdg-dir)
+ xdg-dir)
+ (t emacs-d-dir))))
(defun normal-top-level ()
"Emacs calls this function when it first starts up.
^ permalink raw reply related [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-14 14:00 ` Robert Pluim
@ 2020-01-14 16:05 ` Eli Zaretskii
2020-01-15 13:03 ` Robert Pluim
0 siblings, 1 reply; 90+ messages in thread
From: Eli Zaretskii @ 2020-01-14 16:05 UTC (permalink / raw)
To: Robert Pluim; +Cc: eggert, emacs-devel
> From: Robert Pluim <rpluim@gmail.com>
> Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org
> Date: Tue, 14 Jan 2020 15:00:13 +0100
>
> So hereʼs what I have so far.
LGTM, thanks. If you are satisfied with testing the code, please push
to the emacs-27 branch.
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-14 16:05 ` Eli Zaretskii
@ 2020-01-15 13:03 ` Robert Pluim
2020-01-15 17:32 ` Eli Zaretskii
0 siblings, 1 reply; 90+ messages in thread
From: Robert Pluim @ 2020-01-15 13:03 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: eggert, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 535 bytes --]
>>>>> On Tue, 14 Jan 2020 18:05:27 +0200, Eli Zaretskii <eliz@gnu.org> said:
>> From: Robert Pluim <rpluim@gmail.com>
>> Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org
>> Date: Tue, 14 Jan 2020 15:00:13 +0100
>>
>> So hereʼs what I have so far.
Eli> LGTM, thanks. If you are satisfied with testing the code, please push
Eli> to the emacs-27 branch.
I found another use of XDG in emacsclient.c that needed fixing. It
works fine in my testing, but Iʼd appreciate another pair of eyeballs.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Make-emacs-prefer-an-existing-.emacs.d-to-an-existin.patch --]
[-- Type: text/x-patch, Size: 9174 bytes --]
From bfe956817df9f6b36f260b6df5a4d4dba4fee688 Mon Sep 17 00:00:00 2001
From: Robert Pluim <rpluim@gmail.com>
Date: Wed, 15 Jan 2020 12:24:43 +0100
Subject: [PATCH] Make emacs prefer an existing ~/.emacs.d to an existing XDG
location
* doc/emacs/custom.texi (Find Init): Update description of how Emacs
finds its init file directory and the interaction with
$XDG_CONFIG_HOME
(Early Init File): Correct XDG location of early-init.el
* etc/NEWS: Update description to make it clear the ~/.emacs.d is
preferred, even if the XDG location exists.
* lisp/startup.el: Prefer ~/.emacs.d even if the XDG location exists.
* lib-src/emacsclient.c (open_config): Prefer home directory the XDG
location.
---
doc/emacs/custom.texi | 45 +++++++++++++++++++++++++++----------------
etc/NEWS | 37 +++++++++++++++++------------------
lisp/startup.el | 42 ++++++++++++++++++++--------------------
3 files changed, 67 insertions(+), 57 deletions(-)
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi
index 1958a86b92..2e04a6b22d 100644
--- a/doc/emacs/custom.texi
+++ b/doc/emacs/custom.texi
@@ -2655,26 +2655,37 @@ Find Init
Emacs normally finds your init file in a location under your home
directory. @xref{Init File}. By default this location is
-@file{~/.config/emacs/init.el} where @file{~/} stands for your home directory.
+@file{~/.emacs.d/init.el} where @file{~/} stands for your home directory.
This default can be overridden as described below.
- If @env{XDG_CONFIG_HOME} is set in your environment, its
-value replaces @file{~/.config} in the name of the default
-init file.
-
- If the default init file's parent directory does not exist but the
-directory @file{~/.emacs.d} does exist, Emacs looks for your init file
+Emacs looks for your init file
using the filenames @file{~/.emacs.el}, @file{~/.emacs}, or
@file{~/.emacs.d/init.el}; you can choose to use any one of these
names. (Note that only the locations directly in your home directory
-have a leading dot in the location's basename.) Although this is
-backward-compatible with older Emacs versions, modern POSIX platforms
-prefer putting your initialization files under @file{~/.config} so
-that troubleshooting a problem that might be due to a bad init file,
-or archiving a collection of init files, can be done by renaming that
-directory. To help older Emacs versions find configuration files in
-their current default locations, you can execute the following
-Emacs Lisp code:
+have a leading dot in the location's basename.)
+
+Emacs can also look in an XDG-compatible location for @file{init.el},
+the default is the directory @file{~/.config/emacs}. This can be
+overriden by setting @env{XDG_CONFIG_HOME} in your environment, its
+value replaces @file{~/.config} in the name of the default XDG init
+file. However @file{~/.emacs.d} and @file{~/.emacs} are always
+preferred if they exist, which means that you must delete or rename
+them in order to use the XDG location.
+
+Note also that if neither the XDG location nor @file{~/.emacs.d}
+exist, then Emacs will create @file{~/.emacs.d} (and therefore use it
+during subsequent invocations).
+
+Emacs will set @var{user-emacs-directory} to the directory it decides
+to use.
+
+Although this is backward-compatible with older Emacs versions, modern
+POSIX platforms prefer putting your initialization files under
+@file{~/.config} so that troubleshooting a problem that might be due
+to a bad init file, or archiving a collection of init files, can be
+done by renaming that directory. To help older Emacs versions find
+configuration files in their current default locations, you can
+execute the following Emacs Lisp code:
@example
(make-symbolic-link ".config/emacs" "~/.emacs.d")
@@ -2694,7 +2705,7 @@ Find Init
name in the system's data base of users.
For brevity the rest of the Emacs documentation generally uses just
-the current default location @file{~/.config/emacs/init.el} for the
+the current default location @file{~/.emacs.d/init.el} for the
init file.
@c LocalWords: backtab
@@ -2740,7 +2751,7 @@ Early Init File
@xref{Init File}. However, it is sometimes desirable
to have customizations that take effect during Emacs startup earlier than the
normal init file is processed. Such customizations can be put in the early
-init file, @file{~/.config/emacs.d/early-init.el} or @file{~/.emacs.d/early-init.el}. This file is loaded before the
+init file, @file{~/.config/emacs/early-init.el} or @file{~/.emacs.d/early-init.el}. This file is loaded before the
package system and GUI is initialized, so in it you can customize variables
that affect frame appearance as well as the package initialization process,
such as @code{package-enable-at-startup}, @code{package-load-list}, and
diff --git a/etc/NEWS b/etc/NEWS
index cea5d500c7..c247adc285 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -154,25 +154,24 @@ support.
* Startup Changes in Emacs 27.1
+++
-** Emacs now uses the XDG convention for init files.
-For example, it looks for init.el in "~/.config/emacs/init.el", and
-similarly for other init files.
-
-The 'XDG_CONFIG_HOME' environment variable (which defaults to "~/.config")
-specifies the parent directory of these and other configuration files,
-and will override their traditional locations (the home directory,
-"~/.emacs.d", etc.).
-
-Emacs will still look for init files in their traditional locations if
-"$XDG_CONFIG_HOME/emacs" does not exist, but "~/.emacs.d" or
-"~/.emacs" does exist, so invoking Emacs with XDG_CONFIG_HOME='/nowhere'
-might be useful if your new-location init files are scrambled, or if
-you want to force Emacs to ignore files under 'XDG_CONFIG_HOME' for
-some other reason.
-
-If neither "$XDG_CONFIG_HOME/emacs" nor "~/.emacs.d" exist, Emacs will
-now default to "$XDG_CONFIG_HOME/emacs", and will create that directory
-and set 'user-emacs-directory' to point to it.
+** Emacs can now use the XDG convention for init files.
+The 'XDG_CONFIG_HOME' environment variable (which defaults to
+"~/.config") specifies the XDG configuration parent directory. Emacs
+checks for "init.el" and other configuration files inside the "emacs"
+subdirectory of 'XDG_CONFIG_HOME', i.e. "$XDG_CONFIG_HOME/emacs/init.el"
+
+However, Emacs will still initially look for init files in their
+traditional locations if "~/.emacs.d" or "~/.emacs" exist, even if
+"$XDG_CONFIG_HOME/emacs" also exists. This means that you must delete
+or rename any existing "~/.emacs.d" and "~/.emacs" to enable use of
+the XDG directory.
+
+If "~/.emacs.d" does not exist, and Emacs has decided to use it
+(i.e. "$XDG_CONFIG_HOME/emacs" does not exist), Emacs will create it.
+Emacs will never create "$XDG_CONFIG_HOME/emacs".
+
+Whichever directory Emacs decides to use, it will set
+'user-emacs-directory' to point to it.
+++
** Emacs can now be configured using an early init file.
diff --git a/lisp/startup.el b/lisp/startup.el
index 2a85c004da..1f545c6692 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -497,28 +497,28 @@ startup--xdg-config-default
(defvar startup--xdg-config-home-emacs)
;; Return the name of the init file directory for Emacs, assuming
-;; XDG-DIR is the XDG location and USER-NAME is the user name.
-;; If USER-NAME is nil or "", use the current user.
-;; Prefer the XDG location unless it does does not exist and the
-;; .emacs.d location does exist.
+;; XDG-DIR is the XDG location and USER-NAME is the user name. If
+;; USER-NAME is nil or "", use the current user. Prefer the XDG
+;; location only if the .emacs.d location does not exist.
(defun startup--xdg-or-homedot (xdg-dir user-name)
- (if (file-exists-p xdg-dir)
- xdg-dir
- (let ((emacs-d-dir (concat "~" user-name
- (if (eq system-type 'ms-dos)
- "/_emacs.d/"
- "/.emacs.d/"))))
- (if (or (file-exists-p emacs-d-dir)
- (if (eq system-type 'windows-nt)
- (if (file-directory-p (concat "~" user-name))
- (directory-files (concat "~" user-name) nil
- "\\`[._]emacs\\(\\.elc?\\)?\\'"))
- (file-exists-p (concat "~" init-file-user
- (if (eq system-type 'ms-dos)
- "/_emacs"
- "/.emacs")))))
- emacs-d-dir
- xdg-dir))))
+ (let ((emacs-d-dir (concat "~" user-name
+ (if (eq system-type 'ms-dos)
+ "/_emacs.d/"
+ "/.emacs.d/"))))
+ (cond
+ ((or (file-exists-p emacs-d-dir)
+ (if (eq system-type 'windows-nt)
+ (if (file-directory-p (concat "~" user-name))
+ (directory-files (concat "~" user-name) nil
+ "\\`[._]emacs\\(\\.elc?\\)?\\'"))
+ (file-exists-p (concat "~" init-file-user
+ (if (eq system-type 'ms-dos)
+ "/_emacs"
+ "/.emacs")))))
+ emacs-d-dir)
+ ((file-exists-p xdg-dir)
+ xdg-dir)
+ (t emacs-d-dir))))
(defun normal-top-level ()
"Emacs calls this function when it first starts up.
--
2.23.0
^ permalink raw reply related [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-15 13:03 ` Robert Pluim
@ 2020-01-15 17:32 ` Eli Zaretskii
2020-01-16 7:35 ` Robert Pluim
0 siblings, 1 reply; 90+ messages in thread
From: Eli Zaretskii @ 2020-01-15 17:32 UTC (permalink / raw)
To: Robert Pluim; +Cc: eggert, emacs-devel
> From: Robert Pluim <rpluim@gmail.com>
> Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org
> Date: Wed, 15 Jan 2020 14:03:53 +0100
>
> I found another use of XDG in emacsclient.c that needed fixing. It
> works fine in my testing, but Iʼd appreciate another pair of eyeballs.
I see no changes in emacsclient.c in the patch you sent...
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-15 17:32 ` Eli Zaretskii
@ 2020-01-16 7:35 ` Robert Pluim
2020-01-16 15:02 ` Eli Zaretskii
0 siblings, 1 reply; 90+ messages in thread
From: Robert Pluim @ 2020-01-16 7:35 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: eggert, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 551 bytes --]
>>>>> On Wed, 15 Jan 2020 19:32:45 +0200, Eli Zaretskii <eliz@gnu.org> said:
>> From: Robert Pluim <rpluim@gmail.com>
>> Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org
>> Date: Wed, 15 Jan 2020 14:03:53 +0100
>>
>> I found another use of XDG in emacsclient.c that needed fixing. It
>> works fine in my testing, but Iʼd appreciate another pair of eyeballs.
Eli> I see no changes in emacsclient.c in the patch you sent...
*sigh* Iʼd updated the commit with the log message, and forgotten to
do 'git add'.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Make-emacs-prefer-an-existing-.emacs.d-to-an-existin.patch --]
[-- Type: text/x-patch, Size: 10399 bytes --]
From f840c92da8b6dcd0e4f5506c2fea27a8cb4eed5a Mon Sep 17 00:00:00 2001
From: Robert Pluim <rpluim@gmail.com>
Date: Wed, 15 Jan 2020 12:24:43 +0100
Subject: [PATCH] Make emacs prefer an existing ~/.emacs.d to an existing XDG
location
* doc/emacs/custom.texi (Find Init): Update description of how Emacs
finds its init file directory and the interaction with
$XDG_CONFIG_HOME
(Early Init File): Correct XDG location of early-init.el
* etc/NEWS: Update description to make it clear the ~/.emacs.d is
preferred, even if the XDG location exists.
* lisp/startup.el: Prefer ~/.emacs.d even if the XDG location exists.
* lib-src/emacsclient.c (open_config): Prefer home directory the XDG
location.
---
doc/emacs/custom.texi | 45 +++++++++++++++++++++++++++----------------
etc/NEWS | 37 +++++++++++++++++------------------
lib-src/emacsclient.c | 17 ++++++++--------
lisp/startup.el | 42 ++++++++++++++++++++--------------------
4 files changed, 76 insertions(+), 65 deletions(-)
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi
index 1958a86b92..2e04a6b22d 100644
--- a/doc/emacs/custom.texi
+++ b/doc/emacs/custom.texi
@@ -2655,26 +2655,37 @@ Find Init
Emacs normally finds your init file in a location under your home
directory. @xref{Init File}. By default this location is
-@file{~/.config/emacs/init.el} where @file{~/} stands for your home directory.
+@file{~/.emacs.d/init.el} where @file{~/} stands for your home directory.
This default can be overridden as described below.
- If @env{XDG_CONFIG_HOME} is set in your environment, its
-value replaces @file{~/.config} in the name of the default
-init file.
-
- If the default init file's parent directory does not exist but the
-directory @file{~/.emacs.d} does exist, Emacs looks for your init file
+Emacs looks for your init file
using the filenames @file{~/.emacs.el}, @file{~/.emacs}, or
@file{~/.emacs.d/init.el}; you can choose to use any one of these
names. (Note that only the locations directly in your home directory
-have a leading dot in the location's basename.) Although this is
-backward-compatible with older Emacs versions, modern POSIX platforms
-prefer putting your initialization files under @file{~/.config} so
-that troubleshooting a problem that might be due to a bad init file,
-or archiving a collection of init files, can be done by renaming that
-directory. To help older Emacs versions find configuration files in
-their current default locations, you can execute the following
-Emacs Lisp code:
+have a leading dot in the location's basename.)
+
+Emacs can also look in an XDG-compatible location for @file{init.el},
+the default is the directory @file{~/.config/emacs}. This can be
+overriden by setting @env{XDG_CONFIG_HOME} in your environment, its
+value replaces @file{~/.config} in the name of the default XDG init
+file. However @file{~/.emacs.d} and @file{~/.emacs} are always
+preferred if they exist, which means that you must delete or rename
+them in order to use the XDG location.
+
+Note also that if neither the XDG location nor @file{~/.emacs.d}
+exist, then Emacs will create @file{~/.emacs.d} (and therefore use it
+during subsequent invocations).
+
+Emacs will set @var{user-emacs-directory} to the directory it decides
+to use.
+
+Although this is backward-compatible with older Emacs versions, modern
+POSIX platforms prefer putting your initialization files under
+@file{~/.config} so that troubleshooting a problem that might be due
+to a bad init file, or archiving a collection of init files, can be
+done by renaming that directory. To help older Emacs versions find
+configuration files in their current default locations, you can
+execute the following Emacs Lisp code:
@example
(make-symbolic-link ".config/emacs" "~/.emacs.d")
@@ -2694,7 +2705,7 @@ Find Init
name in the system's data base of users.
For brevity the rest of the Emacs documentation generally uses just
-the current default location @file{~/.config/emacs/init.el} for the
+the current default location @file{~/.emacs.d/init.el} for the
init file.
@c LocalWords: backtab
@@ -2740,7 +2751,7 @@ Early Init File
@xref{Init File}. However, it is sometimes desirable
to have customizations that take effect during Emacs startup earlier than the
normal init file is processed. Such customizations can be put in the early
-init file, @file{~/.config/emacs.d/early-init.el} or @file{~/.emacs.d/early-init.el}. This file is loaded before the
+init file, @file{~/.config/emacs/early-init.el} or @file{~/.emacs.d/early-init.el}. This file is loaded before the
package system and GUI is initialized, so in it you can customize variables
that affect frame appearance as well as the package initialization process,
such as @code{package-enable-at-startup}, @code{package-load-list}, and
diff --git a/etc/NEWS b/etc/NEWS
index cea5d500c7..c247adc285 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -154,25 +154,24 @@ support.
* Startup Changes in Emacs 27.1
+++
-** Emacs now uses the XDG convention for init files.
-For example, it looks for init.el in "~/.config/emacs/init.el", and
-similarly for other init files.
-
-The 'XDG_CONFIG_HOME' environment variable (which defaults to "~/.config")
-specifies the parent directory of these and other configuration files,
-and will override their traditional locations (the home directory,
-"~/.emacs.d", etc.).
-
-Emacs will still look for init files in their traditional locations if
-"$XDG_CONFIG_HOME/emacs" does not exist, but "~/.emacs.d" or
-"~/.emacs" does exist, so invoking Emacs with XDG_CONFIG_HOME='/nowhere'
-might be useful if your new-location init files are scrambled, or if
-you want to force Emacs to ignore files under 'XDG_CONFIG_HOME' for
-some other reason.
-
-If neither "$XDG_CONFIG_HOME/emacs" nor "~/.emacs.d" exist, Emacs will
-now default to "$XDG_CONFIG_HOME/emacs", and will create that directory
-and set 'user-emacs-directory' to point to it.
+** Emacs can now use the XDG convention for init files.
+The 'XDG_CONFIG_HOME' environment variable (which defaults to
+"~/.config") specifies the XDG configuration parent directory. Emacs
+checks for "init.el" and other configuration files inside the "emacs"
+subdirectory of 'XDG_CONFIG_HOME', i.e. "$XDG_CONFIG_HOME/emacs/init.el"
+
+However, Emacs will still initially look for init files in their
+traditional locations if "~/.emacs.d" or "~/.emacs" exist, even if
+"$XDG_CONFIG_HOME/emacs" also exists. This means that you must delete
+or rename any existing "~/.emacs.d" and "~/.emacs" to enable use of
+the XDG directory.
+
+If "~/.emacs.d" does not exist, and Emacs has decided to use it
+(i.e. "$XDG_CONFIG_HOME/emacs" does not exist), Emacs will create it.
+Emacs will never create "$XDG_CONFIG_HOME/emacs".
+
+Whichever directory Emacs decides to use, it will set
+'user-emacs-directory' to point to it.
+++
** Emacs can now be configured using an early init file.
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 645ff04c6d..204064f187 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -924,21 +924,22 @@ open_config (char const *home, char const *xdg, char const *config_file)
char *configname = xmalloc (max (xdgsubdirsize, homesubdirsizemax)
+ strlen (config_file));
FILE *config;
- if (xdg || home)
+
+ if (home)
{
- strcpy ((xdg
- ? stpcpy (stpcpy (configname, xdg), "/emacs/server/")
- : stpcpy (stpcpy (configname, home), "/.config/emacs/server/")),
- config_file);
+ strcpy (stpcpy (stpcpy (configname, home), "/.emacs.d/server/"),
+ config_file);
config = fopen (configname, "rb");
}
else
config = NULL;
- if (! config && home)
+ if (! config && (xdg || home))
{
- strcpy (stpcpy (stpcpy (configname, home), "/.emacs.d/server/"),
- config_file);
+ strcpy ((xdg
+ ? stpcpy (stpcpy (configname, xdg), "/emacs/server/")
+ : stpcpy (stpcpy (configname, home), "/.config/emacs/server/")),
+ config_file);
config = fopen (configname, "rb");
}
diff --git a/lisp/startup.el b/lisp/startup.el
index 2a85c004da..1f545c6692 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -497,28 +497,28 @@ startup--xdg-config-default
(defvar startup--xdg-config-home-emacs)
;; Return the name of the init file directory for Emacs, assuming
-;; XDG-DIR is the XDG location and USER-NAME is the user name.
-;; If USER-NAME is nil or "", use the current user.
-;; Prefer the XDG location unless it does does not exist and the
-;; .emacs.d location does exist.
+;; XDG-DIR is the XDG location and USER-NAME is the user name. If
+;; USER-NAME is nil or "", use the current user. Prefer the XDG
+;; location only if the .emacs.d location does not exist.
(defun startup--xdg-or-homedot (xdg-dir user-name)
- (if (file-exists-p xdg-dir)
- xdg-dir
- (let ((emacs-d-dir (concat "~" user-name
- (if (eq system-type 'ms-dos)
- "/_emacs.d/"
- "/.emacs.d/"))))
- (if (or (file-exists-p emacs-d-dir)
- (if (eq system-type 'windows-nt)
- (if (file-directory-p (concat "~" user-name))
- (directory-files (concat "~" user-name) nil
- "\\`[._]emacs\\(\\.elc?\\)?\\'"))
- (file-exists-p (concat "~" init-file-user
- (if (eq system-type 'ms-dos)
- "/_emacs"
- "/.emacs")))))
- emacs-d-dir
- xdg-dir))))
+ (let ((emacs-d-dir (concat "~" user-name
+ (if (eq system-type 'ms-dos)
+ "/_emacs.d/"
+ "/.emacs.d/"))))
+ (cond
+ ((or (file-exists-p emacs-d-dir)
+ (if (eq system-type 'windows-nt)
+ (if (file-directory-p (concat "~" user-name))
+ (directory-files (concat "~" user-name) nil
+ "\\`[._]emacs\\(\\.elc?\\)?\\'"))
+ (file-exists-p (concat "~" init-file-user
+ (if (eq system-type 'ms-dos)
+ "/_emacs"
+ "/.emacs")))))
+ emacs-d-dir)
+ ((file-exists-p xdg-dir)
+ xdg-dir)
+ (t emacs-d-dir))))
(defun normal-top-level ()
"Emacs calls this function when it first starts up.
--
2.23.0
^ permalink raw reply related [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-16 7:35 ` Robert Pluim
@ 2020-01-16 15:02 ` Eli Zaretskii
2020-01-16 15:08 ` Robert Pluim
0 siblings, 1 reply; 90+ messages in thread
From: Eli Zaretskii @ 2020-01-16 15:02 UTC (permalink / raw)
To: Robert Pluim; +Cc: eggert, emacs-devel
> From: Robert Pluim <rpluim@gmail.com>
> Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org
> Date: Thu, 16 Jan 2020 08:35:02 +0100
>
> >> I found another use of XDG in emacsclient.c that needed fixing. It
> >> works fine in my testing, but Iʼd appreciate another pair of eyeballs.
>
> Eli> I see no changes in emacsclient.c in the patch you sent...
>
> *sigh* Iʼd updated the commit with the log message, and forgotten to
> do 'git add'.
This LGTM, thanks.
^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: Default emacs init file location confusion
2020-01-16 15:02 ` Eli Zaretskii
@ 2020-01-16 15:08 ` Robert Pluim
0 siblings, 0 replies; 90+ messages in thread
From: Robert Pluim @ 2020-01-16 15:08 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: eggert, emacs-devel
>>>>> On Thu, 16 Jan 2020 17:02:56 +0200, Eli Zaretskii <eliz@gnu.org> said:
>> From: Robert Pluim <rpluim@gmail.com>
>> Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org
>> Date: Thu, 16 Jan 2020 08:35:02 +0100
>>
>> >> I found another use of XDG in emacsclient.c that needed fixing. It
>> >> works fine in my testing, but Iʼd appreciate another pair of eyeballs.
>>
Eli> I see no changes in emacsclient.c in the patch you sent...
>>
>> *sigh* Iʼd updated the commit with the log message, and forgotten to
>> do 'git add'.
Eli> This LGTM, thanks.
Pushed as 13995f31a2
Robert
^ permalink raw reply [flat|nested] 90+ messages in thread
end of thread, other threads:[~2020-01-16 15:08 UTC | newest]
Thread overview: 90+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-07 2:51 Default emacs init file location confusion Elias Mårtenson
2020-01-07 3:32 ` Eli Zaretskii
2020-01-07 3:40 ` Elias Mårtenson
2020-01-07 4:40 ` Eli Zaretskii
2020-01-07 14:43 ` Lawrence Liu
2020-01-07 15:26 ` Robert Pluim
2020-01-07 16:12 ` Eli Zaretskii
2020-01-07 16:25 ` Robert Pluim
2020-01-07 17:04 ` Eli Zaretskii
2020-01-07 17:11 ` Elias Mårtenson
2020-01-07 17:21 ` Eli Zaretskii
2020-01-07 17:33 ` Elias Mårtenson
2020-01-07 17:37 ` Eli Zaretskii
2020-01-08 5:28 ` Mingde (Matthew) Zeng
2020-01-08 5:33 ` Elias Mårtenson
2020-01-08 7:22 ` Eli Zaretskii
2020-01-08 10:05 ` Elias Mårtenson
[not found] ` <m2eewajram.fsf@gmail.com>
2020-01-08 10:05 ` Eli Zaretskii
2020-01-08 10:13 ` Elias Mårtenson
2020-01-08 10:22 ` Robert Pluim
2020-01-08 10:49 ` Eli Zaretskii
2020-01-08 12:37 ` Robert Pluim
2020-01-08 13:51 ` Stefan Monnier
2020-01-08 15:58 ` Eli Zaretskii
2020-01-08 16:28 ` Stefan Monnier
2020-01-08 16:32 ` Eli Zaretskii
2020-01-08 16:41 ` Mingde (Matthew) Zeng
2020-01-08 16:49 ` Robert Pluim
2020-01-08 17:01 ` Eli Zaretskii
2020-01-08 17:25 ` Robert Pluim
2020-01-08 17:35 ` Eli Zaretskii
2020-01-08 17:44 ` Robert Pluim
2020-01-08 17:56 ` Yuan Fu
2020-01-08 18:03 ` Robert Pluim
2020-01-09 2:27 ` Yuan Fu
2020-01-08 18:07 ` Eli Zaretskii
2020-01-08 18:12 ` Robert Pluim
2020-01-08 18:19 ` Eli Zaretskii
2020-01-08 19:45 ` Stefan Monnier
2020-01-08 20:03 ` Eli Zaretskii
2020-01-10 16:57 ` Eli Zaretskii
2020-01-11 1:46 ` Paul Eggert
2020-01-11 7:58 ` Eli Zaretskii
2020-01-11 15:43 ` Drew Adams
2020-01-11 16:16 ` Stefan Monnier
2020-01-11 18:08 ` Eli Zaretskii
2020-01-13 7:53 ` Robert Pluim
2020-01-13 14:36 ` Robert Pluim
2020-01-13 15:27 ` Colin Baxter
2020-01-13 15:37 ` Robert Pluim
2020-01-13 15:58 ` Colin Baxter
2020-01-13 16:05 ` Robert Pluim
2020-01-13 16:42 ` Eli Zaretskii
2020-01-13 16:59 ` Colin Baxter
2020-01-13 17:06 ` Robert Pluim
2020-01-13 17:21 ` Colin Baxter
2020-01-13 16:15 ` Eli Zaretskii
2020-01-13 16:39 ` Robert Pluim
2020-01-14 14:00 ` Robert Pluim
2020-01-14 16:05 ` Eli Zaretskii
2020-01-15 13:03 ` Robert Pluim
2020-01-15 17:32 ` Eli Zaretskii
2020-01-16 7:35 ` Robert Pluim
2020-01-16 15:02 ` Eli Zaretskii
2020-01-16 15:08 ` Robert Pluim
2020-01-13 16:52 ` Stefan Kangas
2020-01-13 16:17 ` Eli Zaretskii
2020-01-13 16:29 ` Robert Pluim
2020-01-08 23:26 ` chad
2020-01-08 23:32 ` Stefan Monnier
2020-01-09 3:34 ` Eli Zaretskii
2020-01-09 1:26 ` HaiJun Zhang
2020-01-09 5:07 ` 황병희
2020-01-08 11:03 ` Mario Lang
2020-01-08 15:56 ` Eli Zaretskii
2020-01-08 8:04 ` Robert Pluim
2020-01-07 17:57 ` Stefan Monnier
2020-01-07 18:08 ` Stefan Monnier
2020-01-07 18:09 ` Eli Zaretskii
2020-01-07 18:41 ` Stefan Monnier
2020-01-07 18:57 ` Yuan Fu
2020-01-07 19:15 ` Greg Farough
2020-01-07 20:11 ` Andrea Corallo
2020-01-07 18:53 ` Yuan Fu
2020-01-07 17:12 ` Yuan Fu
2020-01-07 17:26 ` Elias Mårtenson
2020-01-07 3:46 ` Mingde (Matthew) Zeng
2020-01-07 3:50 ` Elias Mårtenson
2020-01-07 3:43 ` VanL
2020-01-07 3:51 ` Elias Mårtenson
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).