[Top][All Lists]

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


From: address@hidden
Subject: xdg-directories.el
Date: Tue, 6 Sep 2016 16:24:56 +0100


I have written several years ago a package called xdg-paths.el.  I have rewritten it as xdg-directories.el.

* WHAT IS xdg-directories.el

xdg-directories.el allows the package writers to locate a file in
Emacs user directories for different domains: data, configuration,
cache and runtime.  It also locates files in the domains defined by the
utility xdg-user-dir, which is executed when finding the domain.

Using this package, an emacs-lisp package writer can put different
files under different directories, according to the domain thereof.  A
cache file, which is normally not wanted in backups, can be named
under ~/.cache/emacs/<filename>, whereas a configuration file would be
under a different directory, in ~/.config/emacs/.  Passwords and
security sensible files can also made to be in a directory where, as
the user logs out, is normally erased.

* BRIEF USAGE (see README.md at the Github repository)

Files form several domains can be located.  Located means here, at the
lack of a better term, named, since the file name will be returned,
regardless of the file existence.

- User documents:

> (locate-user-document-file "org/agenda.txt")
> "/home/francisco.colaco/Documentos/org/agenda.txt"

- Configuration files:

> (locate-user-emacs-config-file "init.el")
> "/home/francisco.colaco/.config/emacs/emacs/init.el"

- Data files:

> (locate-user-emacs-data-file "recentf")
> "/home/francisco.colaco/.local/share/emacs/emacs/recentf"

- Cache files:

> (locate-user-emacs-cache-file "elfeed/index")
> "/home/francisco.colaco/.cache/emacs/emacs/elfeed/index"

- Runtime files:

> (locate-user-emacs-runtime-file "credentials.txt")
> "/run/user/1000/emacs/emacs/credentials.txt"

For example, init.el could be marked as a configuration file (and reside under ~/.config/emacs) and recentf as data file (being under ~/.local/share/emacs).

There is more to the library.  I have grated a Github repository, at


*  ABOUT user-init-file

I would request that this package (after revision and a possible API change) becomes part of GNU Emacs.  I would also suggest that ~/.config/emacs/init.el (the result of "(locate-user-emacs-config-file "init.el") becomes in vanilla emacs part of the chain to determine user-init-file.

As an advantage, one could weed out cache files from user backups or line transmissions.  This package breaks no existing functions, and so, as the package writers adopt it, the separation of domains is assured.  I see no real advantage in keeping almost everything under ~/.emacs.d/, the present situation, but I am open to other arguments.

  Thanks for your attention.

    Francisco Colaço

Attachment: xdg-directories.el
Description: Text Data

reply via email to

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