emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cleaning up and structuring user-emacs-directory


From: David De La Harpe Golden
Subject: Re: Cleaning up and structuring user-emacs-directory
Date: Wed, 19 Aug 2020 15:42:25 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0

On 19/08/2020 09:28, tomas@tuxteam.de wrote:

I've now read the freedesktop thing. If you ask me: please make that
optional.

indeed, existing emacs fd.o support in various contexts is generally optional.

I have none of those $XDG_* env vars set, and I have nothing
of relevance in .local.


They're overrides not mandatory, the normal circumstance for an app that follows the spec is falling back to the standard paths. When emacs uses them, which it may already do in various circumstances, you can see it does that:

https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/xdg.el#n52

At startup, emacs apparently already uses ~/.config/emacs/ if present and .emacs and ~/.emacs.d aren't:

https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/startup.el#n494

However, at time of writing a user using the existing emacs xdg ~/.config/emacs/ dir support will AFAICS actually find various arguably "data" and "cache" files also plonked into the "config" directory ~/.config/emacs/ dir by emacs, as it's basically treated as an alternatively spelled ~/.emacs.d/

That may be consided at least vaguely suspect under the xdg spec conventions, user config, cache and data files are supposed to have those split locations. To concretize, testing with emacs 27.1 (personally I actually still use ~/.emacs and ~/.emacs.d/ normally!):


# keep for restoration!

$ mkdir -p .config/emacs/
$ cp .emacs .config/emacs/init.el
$ mv .emacs .emacs.off
$ mv .emacs.d .emacs.d.off


Run emacs

$ emacs

# intra-emacs do something arguably "cache" and "data" like getting the
# latest elpa package list and installing a package

M-x list-packages
<install something, trie for argument's sake>
C-x C-c


#  let's look inside:

ls ~/.config/emacs/


$ ls -1 ~/.config/emacs/
auto-save-list
elpa
init.el

$ ls -1 ~/.config/emacs/elpa/
archives
gnupg
heap-0.5
heap-0.5.signed
queue-0.2
queue-0.2.signed
tNFA-0.1.1
tNFA-0.1.1.signed
trie-0.4
trie-0.4.signed


# -> user ends up with emacs init.el in config (fine), but also
# elpa package lists stored in xdg config subdir not cache
# elpa packages installed in xdg config subdir not data

This contrasts to e.g. python's "pip install --user", as that will install python packages ~/.local/lib/python3 etc. as "data", and keep its various transient metadata things in ~/.cache/pip/ as "cache"


















Cheers
  - t





reply via email to

[Prev in Thread] Current Thread [Next in Thread]