Extract make clean/clean-cache into elisp; new doom-etc-dir for non-volatile temp files
This commit is contained in:
parent
4ae0513020
commit
923d4585fa
7 changed files with 43 additions and 16 deletions
|
@ -115,7 +115,7 @@ to speed up startup."
|
|||
package-activated-list nil)
|
||||
|
||||
;; Ensure core folders exist
|
||||
(dolist (dir (list doom-local-dir doom-cache-dir package-user-dir))
|
||||
(dolist (dir (list doom-local-dir doom-etc-dir doom-cache-dir package-user-dir))
|
||||
(unless (file-directory-p dir)
|
||||
(make-directory dir t)))
|
||||
|
||||
|
@ -458,6 +458,22 @@ This may take a while."
|
|||
(message "\n%s" (mapconcat (lambda (file) (concat "+ ERROR: " (car file)))
|
||||
(nreverse errors) "\n"))))))
|
||||
|
||||
(defun doom/clear-cache ()
|
||||
"Clear local cache (`doom-cache-dir'). You may need to restart Emacs for some
|
||||
components to feel its effects."
|
||||
(delete-directory doom-cache-dir t)
|
||||
(make-directory doom-cache-dir t))
|
||||
|
||||
(defun doom/clear-compiled ()
|
||||
"Delete all compiled elc files in DOOM emacs, excluding compiled ELPA/QUELPA
|
||||
package files."
|
||||
(interactive)
|
||||
(when-let (elc-files (cl-remove-if (lambda (file) (file-in-directory-p file doom-local-dir))
|
||||
(directory-files-recursively doom-emacs-dir "\\.elc$")))
|
||||
(dolist (file elc-files)
|
||||
(delete-file file)
|
||||
(message "Deleting %s" (abbreviate-file-name file)))))
|
||||
|
||||
|
||||
;;
|
||||
;; Package.el modifications
|
||||
|
|
28
core/core.el
28
core/core.el
|
@ -32,17 +32,29 @@ line or use --debug-init to enable this.")
|
|||
(defvar doom-modules-dir (concat doom-emacs-dir "modules/")
|
||||
"Where configuration modules are stored.")
|
||||
|
||||
|
||||
;; Multi-host directories: I namespace `doom-etc-dir' and `doom-cache-dir' with
|
||||
;; host names because I use the same (often symlinked) emacs.d across several
|
||||
;; computers -- often simultaneously. Cache or other temporary files would
|
||||
;; conflict otherwise.
|
||||
|
||||
(defvar doom-local-dir (concat doom-emacs-dir ".local/")
|
||||
"Untracked directory for local Emacs files, including the cache
|
||||
(`doom-cache-dir'), packages (`doom-packages-dir') and autoloads file.")
|
||||
"Root directory for local Emacs files.")
|
||||
|
||||
(defvar doom-packages-dir (concat doom-local-dir "packages/")
|
||||
"Where package.el and quelpa plugins (and their caches) are kept.")
|
||||
|
||||
(defvar doom-etc-dir
|
||||
(concat doom-local-dir "etc/" (system-name) "/")
|
||||
"Hostname-based directory for non-volatile temporary files. These are not
|
||||
deleted or tampored with by DOOM functions. It should not be used for transient
|
||||
or unstable files.")
|
||||
|
||||
(defvar doom-cache-dir
|
||||
(concat doom-local-dir "cache/" (system-name) "/")
|
||||
"Hostname-based directory for temporary files.")
|
||||
|
||||
(defvar doom-packages-dir
|
||||
(concat doom-local-dir "packages/")
|
||||
"Where package.el and quelpa plugins (and their caches) are kept.")
|
||||
"Hostname-based directory for volatile temporary files. They are deleted when
|
||||
`doom/clear-cache' is called. For more stable local storage, use
|
||||
`doom-local-dir'.")
|
||||
|
||||
(defvar doom-autoload-file
|
||||
(concat doom-local-dir "autoloads.el")
|
||||
|
@ -71,7 +83,7 @@ line or use --debug-init to enable this.")
|
|||
compilation-ask-about-save nil ; save all buffers on `compile'
|
||||
compilation-scroll-output t
|
||||
confirm-nonexistent-file-or-buffer t
|
||||
custom-file (concat doom-cache-dir "custom.el")
|
||||
custom-file (concat doom-etc-dir "custom.el")
|
||||
enable-recursive-minibuffers nil
|
||||
debug-on-error (and (not noninteractive) doom-debug-mode)
|
||||
idle-update-delay 1 ; update ui less often
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue