[Top][All Lists]

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

A cache directory?

From: Yuan Fu
Subject: A cache directory?
Date: Sun, 16 Aug 2020 15:30:10 -0400

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.

Even if we don’t appoint a standard cache directory, we could provide a 
built-in function that searches for possible cache directories, and ask every 
one to use that function. Specifically, something like:

(defun cache-directory ()
  "Return a possible cache directory.
Return nil if none found."
  (catch 'found
    (dolist (candidate '(".cache" "cache"
                         ".tmp" "tmp"
                         ".temp" "temp"))
      (let ((path (expand-file-name candidate user-emacs-directory)))
        (when (and (file-exists-p path)
                   (file-writable-p path)
                   (file-directory-p path))
          (throw 'found path))))))


reply via email to

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