From: Stefan Kangas <stefan@marxist.se>
To: Stefan Monnier <monnier@iro.umontreal.ca>, Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: user-directory: New library to find user {conf, data, state, ...} files
Date: Sun, 7 Nov 2021 11:31:50 -0800 [thread overview]
Message-ID: <CADwFkmkY=uk8EtFqLof2iV1h+t48qQcC3QyZ7_dPMvP+N0dYhg@mail.gmail.com> (raw)
In-Reply-To: <CADwFkmnCRScoSa+TnFVqoge=Z-pex=JHXFUQX+dMSB42a66PWQ@mail.gmail.com>
Stefan Kangas <stefan@marxist.se> writes:
> I hacked something quick together and pushed it to
> features/user-directory, mostly so that we can decide on the basic API.
> It needs more work, but the interface should hopefully be clear.
>
> The one I propose is:
>
> (user-directory 'cache)
> => "/home/skangas/.cache"
>
> (user-file 'cache "foo")
> => "/home/skangas/.cache/foo"
>
> There's also a defcustom `user-directory-alist' for overrides:
>
> (let ((user-directory-alist '((downloads "/foo"))))
> (user-directory 'downloads))
> => "/foo"
OK, I think this is ready for merging to master so that we can start
experimenting with it, obviously based on the assumption that this is
tentative and open for change. I guess someone will want to look at
adding MS-Windows support to this, for example.
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 is a feature. If users prefer not to have a clean "~/.emacs.d/"
they can say:
(setq user-directory-alist '((cache . user-emacs-directory)
(config . user-emacs-directory)
(data . user-emacs-directory)
(runtime . user-emacs-directory)
(state . user-emacs-directory)))
I also think we should consider adding some heuristics to `user-file' to
be able to find the old name if it exists. I considered some
alternatives, but I thought I'd see what people think first. Currently,
application code would say:
(user-file 'cache "image-dired"
(locate-user-emacs-file "image-dired"))
Which could, if we want to be smart, be simplified to:
(user-file 'cache "image-dired" "image-dired")
Or even:
(user-file 'cache "image-dired")
Unfortunately, in this case I think it's harder to be smart:
(user-file 'data "bookmarks"
(locate-user-emacs-file "bookmarks" ".emacs.bmk"))
But perhaps we can think of something even for that.
next prev parent reply other threads:[~2021-11-07 19:31 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 [this message]
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
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='CADwFkmkY=uk8EtFqLof2iV1h+t48qQcC3QyZ7_dPMvP+N0dYhg@mail.gmail.com' \
--to=stefan@marxist.se \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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.