all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Kangas <stefan@marxist.se>
Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org
Subject: Re: user-directory: New library to find user {conf, data, state, ...} files
Date: Mon, 08 Nov 2021 15:55:31 +0200	[thread overview]
Message-ID: <83fss67nvw.fsf@gnu.org> (raw)
In-Reply-To: <CADwFkmkMLudccCN8eehVfd1N8Az8gNE8dEgpSo0WocCgEkuG1g@mail.gmail.com> (message from Stefan Kangas on Sun, 7 Nov 2021 21:04:42 -0600)

> From: Stefan Kangas <stefan@marxist.se>
> Date: Sun, 7 Nov 2021 21:04:42 -0600
> Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> Note that on GNU/Linux, even if the user has their configuration file in
> >> "~/.emacs.d/", the library currently prefers the XDG paths here:
> >>
> >>     (user-file 'cache "image-dired")
> >>     => "~/.cache/emacs/image-dired"
> >
> > This contradicts how Emacs by default finds the init file: its
> > preference is the other way around, and it sets user-emacs-directory
> > according to the directory from which it loaded the init file.  I
> > don't think I understand why this package should behave differently by
> > default (it could do that as an opt-in option, of course, if that is
> > considered useful to someone).
> 
> It should because it is a change for the better.  We have a chance to
> decide what this should look like for the foreseeable future, and I
> don't think we are bound by past decisions if they do not produce
> optimal (or even good) results.

The problem is that changes which break users' configurations will not
be appreciated.

> The `user-emacs-directory' directory currently contains a grab-bag of,
> well, everything, which among other things makes it hard for a user to
> know what is safe to delete and what is not, which files you would need
> to backup, etc.  You basically need to manually inspect the files and
> consider their content one by one.
> 
> The big use-case here, though, is that we want to be able to easily
> synchronize our Emacs configuration file between several machines.  You
> don't want to synchronize things like your completion history or
> recently opened files, because it is not very useful, and you will have
> an infinite amounts of conflicts.  (It's somewhat easier with version
> control, which is what I use, but less so if you want to use rsync or
> unison.)
> 
> The solution is to proscribe that:
> 
> The categories data, cache and state files belong in specific `data',
> `state' and `cache' directories.  This means that e.g. my bookmarks file
> goes to the data directory, the recentf and saveplace file goes to
> `state', while my image-dired thumbnails go to `cache'.  As for runtime
> files, I note that `server-socket-dir' already uses XDG_RUNTIME_DIR (but
> gets it manually).
> 
> IOW, all this should be orthogonal to where your init file is placed.
> You can put it in any of the accepted locations, including the XDG one
> if you like.  (Personally, I keep mine in "~/.emacs.d/init.el" and will
> continue to do so.)  You should still be able to get all of the above,
> by default and with no hassle.

My problem is that Emacs computes user-emacs-directory from the place
where it loaded the init file, and then uses the value of
user-emacs-directory to look for other files.  Search the sources for
user-emacs-directory and you will see how we use it.  If the changes
you propose will modify those users of user-emacs-directory to use
user-file machinery instead, and if user-file machinery prefers the
XDG directories, Emacs will not find the files it found previously,
and some of the user customizations will mysteriously stop working.

> With all that being said, we must take great care not to cause
> unnecessary churn.  In particular, we should absolutely not break
> anything that's currently working.  This means that we should respect
> locations of already existing files, and ensure they continue working
> seamlessly.

That is fine, but I'm not sure how you can achieve that goal and still
prefer the XDG directories.

> PS. Note that (user-directory 'config) in particular already just falls
>     back to use whatever `user-emacs-directory' was set to.  There is no
>     need to duplicate what is happening in startup.el, or to try to
>     outsmart it.

What do you mean by "falls back"?  To respect the current behavior,
the value of user-emacs-directory should be used in preference to
everything else.  But if we do that, then in which cases will the XDG
directories be used, since user-emacs-directory always exists and is
defined.



  parent reply	other threads:[~2021-11-08 13:55 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-25 13:14 master f8fed41 2/3: image-dired: Improve XDG compliance Eli Zaretskii
2021-10-25 16:14 ` Philip Kaludercic
2021-10-25 16:39   ` Eli Zaretskii
2021-10-25 17:52     ` Philip Kaludercic
2021-10-25 18:30       ` Eli Zaretskii
2021-10-26 10:24         ` Stefan Kangas
2021-10-26 13:09           ` Eli Zaretskii
2021-10-26 13:28             ` Stefan Kangas
2021-10-26 14:11               ` Eli Zaretskii
2021-10-26 14:35                 ` Stefan Kangas
2021-10-27  4:37                   ` Po Lu
2021-10-26 16:47         ` Philip Kaludercic
2021-10-26  2:07       ` Po Lu
2021-10-25 17:48   ` Stefan Monnier
2021-10-25 17:55     ` Philip Kaludercic
2021-10-25 17:58       ` Gregory Heytings
2021-10-25 18:04       ` Stefan Monnier
2021-10-26 10:25 ` Default for image-dired-main-image-directory Stefan Kangas
2021-10-26 13:12   ` Eli Zaretskii
2021-10-26 13:42     ` Ihor Radchenko
2021-10-26 14:15       ` Eli Zaretskii
2021-10-26 14:22         ` Stefan Kangas
2021-10-26 14:58         ` Ihor Radchenko
2021-10-26 16:15           ` Eli Zaretskii
2021-10-27 13:04             ` Ihor Radchenko
2021-10-27 13:26               ` Eli Zaretskii
2021-10-27 13:42                 ` Ihor Radchenko
2021-10-27 16:53                   ` XDG config dir [Was: Re: Default for image-dired-main-image-directory] Alexandre Garreau
2021-10-28  3:45                     ` Ihor Radchenko
2021-10-28  3:48                     ` Phil Sainty
2021-10-28  5:57                       ` Alexandre Garreau
2021-10-28  6:46                         ` Stefan Kangas
2021-10-26 14:14     ` Default for image-dired-main-image-directory Stefan Kangas
2021-10-26 15:37       ` Eli Zaretskii
2021-10-26 14:01 ` master f8fed41 2/3: image-dired: Improve XDG compliance Stefan Kangas
2021-10-26 14:19   ` Eli Zaretskii
2021-10-26 14:24     ` Stefan Kangas
2021-10-26 16:00       ` Eli Zaretskii
2021-10-26 16:13         ` Stefan Kangas
2021-10-26 16:21           ` Eli Zaretskii
2021-10-26 14:28   ` Eli Zaretskii
2021-10-26 14:45     ` Stefan Kangas
2021-10-26 16:12       ` Eli Zaretskii
2021-10-26 16:31         ` Eli Zaretskii
2021-10-26 19:17         ` Stefan Monnier
2021-10-26 19:28           ` Eli Zaretskii
2021-11-06  1:38           ` user-directory: New library to find user {conf,data,state,...} files Stefan Kangas
2021-11-06  1:52             ` Lars Ingebrigtsen
2021-11-06  2:56               ` user-directory: New library to find user {conf, data, state, ...} files Stefan Kangas
2021-11-06  3:11             ` Stefan Kangas
2021-11-07 19:31             ` Stefan Kangas
2021-11-07 19:52               ` Eli Zaretskii
2021-11-08  3:04                 ` Stefan Kangas
2021-11-08 12:19                   ` Eric S Fraga
2021-11-08 13:55                   ` Eli Zaretskii [this message]
2021-11-08 15:26                     ` Stefan Kangas
2021-11-08 18:31                       ` Eli Zaretskii
2021-11-09  7:05                         ` Stefan Kangas
2021-11-09 18:23                           ` Eli Zaretskii
2021-11-09 20:38                             ` Stefan Kangas
2021-11-11 10:34                               ` Eli Zaretskii
2021-11-08  3:35               ` Stefan Kangas
2021-11-08 15:40                 ` 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=83fss67nvw.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=stefan@marxist.se \
    /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.