From: Eli Zaretskii <eliz@gnu.org>
To: eggert@cs.ucla.edu
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH] Implement XDG Base Directory specification for user-emacs-directory
Date: Sun, 25 Aug 2019 11:46:51 +0300 [thread overview]
Message-ID: <83r259hbt0.fsf@gnu.org> (raw)
In-Reply-To: <83ef2akyf1.fsf@gnu.org> (message from Eli Zaretskii on Sun, 28 Jul 2019 17:48:34 +0300)
Ping! This seems to have stalled. Can we please revive it and make
the changes in the repository?
TIA
> Date: Sun, 28 Jul 2019 17:48:34 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> CC: emacs-devel@gnu.org
>
> > From: Paul Eggert <eggert@cs.ucla.edu>
> > Date: Sat, 27 Jul 2019 11:46:31 -0700
> >
> > I'll give it a whirl. Proposed patch attached.
>
> Thanks.
>
> > They can set XDG_CONFIG_DIR to /nowhere to go back to the old way,
> > as an emergency fix to get Emacs up and running well enough to fix
> > their configuration.
>
> I think we should mention this part in NEWS.
>
> > --- a/doc/emacs/custom.texi
> > +++ b/doc/emacs/custom.texi
> > @@ -2219,28 +2219,33 @@ Init File
> > @cindex init file
> > @cindex .emacs file
> > @cindex ~/.emacs file
> > -@cindex ~/.config/emacs file
> > +@cindex ~/.config/emacs/init.el file
> > @cindex Emacs initialization file
> > @cindex startup (init file)
> > +@cindex XDG_CONFIG_HOME
> >
> > When Emacs is started, it normally tries to load a Lisp program from
> > an @dfn{initialization file}, or @dfn{init file} for short. This
> > -file, if it exists, specifies how to initialize Emacs for you. Emacs
> > -looks for your init file using the filenames
> > -@file{~/.config/emacs},. @file{~/.emacs}, @file{~/.config/emacs.el},
> > -@file{~/.emacs.el}, @file{~/.config/emacs.d/init.el} or
> > -@file{~/.emacs.d/init.el}; you can choose to use any one of these
> > -names (@pxref{Find Init}). Here, @file{~/} stands for your home
> > +file, if it exists, specifies how to initialize Emacs for you.
> > +If the directory @file{@var{xdghome}/.config/emacs} exists, Emacs uses
> > +@file{@var{xdghome}/.config/emacs/init.el} as the init file. Here,
> > +@var{xdghome} stands for the value of the environment variable
> > +@env{XDG_CONFIG_HOME}, or for @file{~/.config} if
> > +@env{XDG_CONFIG_HOME} is unset; @file{~/} stands for your home
> > directory.
> >
> > - While the @file{~/.emacs} and @file{~/.emacs.d/init.el} locations
> > -are backward-compatible to older Emacs versions, and the rest of this
> > -chapter will use them to name your initialization file, it is better practice
> > -to group all of your dotfiles under @file{.config} so that if you have
> > + If @file{~/.config/emacs} does not exist, Emacs looks for your init
> > +file using the filenames @file{~/.emacs}, @file{~/.emacs.el}, or
> > +@file{~/.emacs.d/init.el}; you can choose to use any one of these
> > +names (@pxref{Find Init}). Although this is backward-compatible
> > +with older Emacs versions, modern POSIX platforms prefer putting your
> > +initialization files under @file{.config} so that if you have
> > to troubleshoot a problem that might be due to a bad init file, or
> > archive a collection of them, it can be done by renaming or
> > copying that directory. Note that the @file{.config} versions
> > don't have a leading dot on the basename part of the file.
> > +For convenience the rest of this section assumes @env{XDG_CONFIG_HOME}
> > +is unset or has a value equivalent to @file{~/.config}.
>
> I think the test which describes in detail how Emacs finds the init
> file should be in the section by that name; otherwise it makes no
> sense to have that section in the first place. The "Init File"
> section should just mention the possible places and refer to that
> other section for the details.
>
> > diff --git a/etc/NEWS b/etc/NEWS
> > index d876c95e68..7703fc1e79 100644
> > --- a/etc/NEWS
> > +++ b/etc/NEWS
> > @@ -135,6 +135,14 @@ builds respectively.
> > \f
> > * 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.
> > +Emacs continues to look for init files in their traditional locations
> > +if ~/.config/emacs does not exist. The XDG_CONFIG_HOME environment
> > +variable (default ~/.config) specifies the parent directory of these
> > +configuration files.
>
> As mentioned above, I think we should tell here how to get back the
> old behavior.
>
> > diff --git a/lisp/subr.el b/lisp/subr.el
> > index eea4e045dd..8b50748a59 100644
> > --- a/lisp/subr.el
> > +++ b/lisp/subr.el
> > @@ -2930,10 +2930,15 @@ temp-buffer-setup-hook
> > mode.")
> >
> > (defconst user-emacs-directory
> > - (if (eq system-type 'ms-dos)
> > - ;; MS-DOS cannot have initial dot.
> > - "~/_emacs.d/"
> > - "~/.emacs.d/")
> > + (let ((config-dir (concat (or (getenv-internal "XDG_CONFIG_HOME")
> > + "~/.config")
> > + "/emacs/")))
> > + (if (file-exists-p config-dir)
> > + config-dir
>
> Can this be a defconst? It probes the existence of an environment
> variable and a directory, so it must be done at run time, not at build
> time, I think.
next prev parent reply other threads:[~2019-08-25 8:46 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20190525172356.30070.65317@vcs0.savannah.gnu.org>
[not found] ` <20190525172357.86D4F207F5@vcs0.savannah.gnu.org>
2019-05-26 22:40 ` [Emacs-diffs] master d68ed15: Implement and document XDG-style startup files under ~/.config Stefan Monnier
2019-06-03 2:32 ` Eli Zaretskii
2019-06-09 7:01 ` [PATCH] Implement XDG Base Directory specification for user-emacs-directory (was: [Emacs-diffs] master d68ed15: Implement and document XDG-style startup files under ~/.config.) Amin Bandali
2019-06-09 8:10 ` Eli Zaretskii
2019-06-09 18:59 ` [PATCH] Implement XDG Base Directory specification for user-emacs-directory Stefan Monnier
2019-06-09 19:16 ` Eli Zaretskii
2019-06-09 20:16 ` Noam Postavsky
2019-06-10 16:22 ` Eli Zaretskii
2019-06-10 18:55 ` Noam Postavsky
2019-06-10 19:21 ` Lars Ingebrigtsen
2019-06-10 19:26 ` Eli Zaretskii
2019-07-02 16:55 ` Noam Postavsky
2019-07-02 17:26 ` Eli Zaretskii
2019-07-23 14:36 ` Eli Zaretskii
2019-07-27 2:58 ` Amin Bandali
2019-07-27 7:55 ` Eli Zaretskii
2019-07-27 18:46 ` Paul Eggert
2019-07-27 21:22 ` Basil L. Contovounesios
2019-07-28 14:41 ` Eli Zaretskii
2019-07-28 15:21 ` Basil L. Contovounesios
2019-07-28 16:34 ` Eli Zaretskii
2019-07-28 14:48 ` Eli Zaretskii
2019-07-29 1:00 ` Elias Mårtenson
2019-07-29 2:36 ` Eli Zaretskii
2019-07-29 4:24 ` Elias Mårtenson
2019-07-29 14:21 ` Eli Zaretskii
2019-08-25 8:46 ` Eli Zaretskii [this message]
2019-08-27 21:50 ` Paul Eggert
2019-08-28 5:59 ` Eli Zaretskii
2019-09-01 1:24 ` bug#583: " Paul Eggert
2019-06-13 11:34 ` [PATCH] Implement XDG Base Directory specification for user-emacs-directory (was: [Emacs-diffs] master d68ed15: Implement and document XDG-style startup files under ~/.config.) Stefan Kangas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83r259hbt0.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=eggert@cs.ucla.edu \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.