On 02/11/2021 17:55, Ihor Radchenko wrote:
Max Nikulin writes:
Ihor, your fix affects linux as well. .cache directory may be missed in
fresh accounts. E.g. I just have created a new test container (my old
one has emacs-25):
After second thought, I am not sure anymore if using XDG is a good idea.
Emacs itself only recently started supporting XDG and the support is
somewhat limited. Similar to the described case with non-existing .cache
directory, Emacs ignores non-existing .config/emacs folder for init.el.
Emacs never creates .config directory.
...
4. Same as 3, but create $XDG_CACHE_DIR if possible. It is similar to
other XDG-complient software (at least, that's what I saw in
qutebrowser code).
I like the idea to put temporary automatically created files to a
dedicated directory. Backups are easier when hand-written config files
are separated from stuff that can be recreated on demand. Since enough
applications follow XDG conventions, I suppose, XDG_CACHE_HOME=~/.cache
is a reasonable variant consistent with user expectations. Emacs
directory may be a fallback when XDG_CACHE_HOME can not be created. I am
against using ~/.cache only if it already exists. It may result in stale
cache in the emacs directory populated before another application
created ~/.cache, so user would have 2 directories with cache files.
I agree that xdg.el lacks some useful features. Even parts of emacs such
as startup.el and files.el do not use this package. Similar libraries
for other programming languages offer wider support of OSes and create
directories on demand, e.g. https://github.com/adrg/xdg for Go.
Maybe org-macs.el is a better place for code dealing initialization of
cache directory.
P.S. `org-open-file' may benefit from using of xdg.el. MIME handlers
obtained from .desktop files should be more consistent with expectations
of users of desktop environments.