emacs-devel
[Top][All Lists]
Advanced

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

Cleaning up and structuring user-emacs-directory (was: A cache directory


From: Amin Bandali
Subject: Cleaning up and structuring user-emacs-directory (was: A cache directory?)
Date: Sun, 16 Aug 2020 16:10:12 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Yuan Fu writes:

> Maybe this has been discussed but I can’t find any threads in the
> archive. .emacs.d is pretty crowded: every package puts their
> temporary files under it. I wonder if there could be a standard cache
> directory? I know there are packages that's solely for this purpose:
> resetting every single xxx-file to be under a cache
> directory. However, it would be better if there is just a standard one
> and everybody uses it.
>
[...]

I too have found myself generally displeased with how various packages
create arbitrary files in my `user-emacs-directory'.  I would personally
like to see this issue tackled more generally, for different sorts of
files rather than just cache/temporary files.

Of the packages that aim to do this, I liked the approach of the
"no-littering" package like the most.  Essentially, it designates two
directories, one for config files and another for persistent data files,
defaulting to "etc/" and "var/" under the `user-emacs-directory'
respectively.  It then changes the directory/file location settings for
many packages, dividing up each package's files into one of the two
general categories.  If a package stores multiple files of the same
category, no-littering creates a directory under that category with the
package name to keep those files together.

If we were to tackle this in Emacs itself, maybe we could have two
defcustoms `user-config-directory' and `user-data-directory', defaulting
to "etc/" and "var/" in `user-emacs-directory'.  If a lot of packages
use temporary/cache files, having a third `user-cache-directory' that
defaults to "var/cache/" in `user-emacs-directory' would make sense.
We could then ask packages to use one of these variables when defining
their file locations, rather than `user-emacs-directory' directly.
To avoid disruptions for users with existing files, we could take a
similar approach as the recently added XDG support, using the current
location for existing files, but defaulting to the new location for
each file that doesn't exist.

Perhaps an FHS-like [0] directory structure in `user-emacs-directory'
was always inevitable, since Emacs is an operating system after all. ;-)

[0]: https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard

Attachment: signature.asc
Description: PGP signature


reply via email to

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