Eli Zaretskii <e...@gnu.org> writes: >> I was referring to some kind of global option that defines cache >> directory, data directory, etc. Something akin XDG. > > We already have xdg-cache-home (and a few others in xdg.el). Is that > what you meant?
Yes, except that `xdg-cache-home' is limited: 1. It cannot be customized by users 2. It may sometimes return nil 3. It is limited to XDG - not all the Emacs platforms What I had in mind is a new custom option for cache dir (defaulting to OS-specific cache like XDG on Linux or something equivalent on Windows) + a new API function like `system-cache-home' that will be guaranteed to return some kind of meaningful dir. >> Also, caching is not as simple, because caches may contain sensitive >> data. (see >> https://list.orgmode.org/orgmode/cam9alr8fusu0yws1sehrw7syxprjfx-r2juxd_dgvcyvkqc...@mail.gmail.com/) >> Some users may want to move caches to read-restricted location >> or even to location dependent on where the cache is originating from >> (separate caches depending on whether default-directory is from >> encrypted volume, remote mount, etc) > > AFAIK, Emacs has APIs for at least some of that, but whether to use > them is up to the application, I think. What are those APIs? >> Finally, we got several requests to have caches cleared up upon exiting >> Emacs, which is also something that should be better managed centrally, >> by Emacs, for all possible kinds of cache/history data. > > Deleting files in a directory, recursively if needed, is already > available. is that what you meant? No. I mean a new user option like `clear-caches-on-exit' that will work across all the packages. Then, concerned users may set it to non-nil to delete *all* the caches upon exiting Emacs. Having to set this for each specific package (with some packages not documenting that they use cache, or users not expecting that cache may be used and not reading _all_ the docs carefully enough) is not ideal, IMHO. > Can we first fix the problems for which I started this thread? The > more general issues should be subjects of separate discussions, IMO. If there is a global Emacs-wide customization how to handle caches, there will be no need to document it in Org mode manual. So, I would like to see if introducing such global customization is feasible before making non-trivial changes to Org manual. (I am not even sure where to document these things in the manual yet; they seem way too generic wrt Org mode's scope) -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>