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
5
Makefile
5
Makefile
|
@ -21,11 +21,10 @@ compile: init.el clean
|
||||||
@$(EMACS) -l core/core.el -f 'doom/recompile'
|
@$(EMACS) -l core/core.el -f 'doom/recompile'
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@rm -fv init.elc
|
@$(EMACS) -l core/core.el -f 'doom/clear-compiled'
|
||||||
@find {core,modules} -type f -iname '*.elc' -exec rm \-fv {} \;
|
|
||||||
|
|
||||||
clean-cache:
|
clean-cache:
|
||||||
@$(EMACS) -l core/core.el --eval '(delete-directory doom-cache-dir t)'
|
@$(EMACS) -l core/core.el -f 'doom/clear-cache'
|
||||||
|
|
||||||
# This is only useful if your emacs.d is somewhere other than ~/.emacs.d (for
|
# This is only useful if your emacs.d is somewhere other than ~/.emacs.d (for
|
||||||
# development purposes for instance).
|
# development purposes for instance).
|
||||||
|
|
|
@ -115,7 +115,7 @@ to speed up startup."
|
||||||
package-activated-list nil)
|
package-activated-list nil)
|
||||||
|
|
||||||
;; Ensure core folders exist
|
;; 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)
|
(unless (file-directory-p dir)
|
||||||
(make-directory dir t)))
|
(make-directory dir t)))
|
||||||
|
|
||||||
|
@ -458,6 +458,22 @@ This may take a while."
|
||||||
(message "\n%s" (mapconcat (lambda (file) (concat "+ ERROR: " (car file)))
|
(message "\n%s" (mapconcat (lambda (file) (concat "+ ERROR: " (car file)))
|
||||||
(nreverse errors) "\n"))))))
|
(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
|
;; 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/")
|
(defvar doom-modules-dir (concat doom-emacs-dir "modules/")
|
||||||
"Where configuration modules are stored.")
|
"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/")
|
(defvar doom-local-dir (concat doom-emacs-dir ".local/")
|
||||||
"Untracked directory for local Emacs files, including the cache
|
"Root directory for local Emacs files.")
|
||||||
(`doom-cache-dir'), packages (`doom-packages-dir') and autoloads file.")
|
|
||||||
|
(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
|
(defvar doom-cache-dir
|
||||||
(concat doom-local-dir "cache/" (system-name) "/")
|
(concat doom-local-dir "cache/" (system-name) "/")
|
||||||
"Hostname-based directory for temporary files.")
|
"Hostname-based directory for volatile temporary files. They are deleted when
|
||||||
|
`doom/clear-cache' is called. For more stable local storage, use
|
||||||
(defvar doom-packages-dir
|
`doom-local-dir'.")
|
||||||
(concat doom-local-dir "packages/")
|
|
||||||
"Where package.el and quelpa plugins (and their caches) are kept.")
|
|
||||||
|
|
||||||
(defvar doom-autoload-file
|
(defvar doom-autoload-file
|
||||||
(concat doom-local-dir "autoloads.el")
|
(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-ask-about-save nil ; save all buffers on `compile'
|
||||||
compilation-scroll-output t
|
compilation-scroll-output t
|
||||||
confirm-nonexistent-file-or-buffer 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
|
enable-recursive-minibuffers nil
|
||||||
debug-on-error (and (not noninteractive) doom-debug-mode)
|
debug-on-error (and (not noninteractive) doom-debug-mode)
|
||||||
idle-update-delay 1 ; update ui less often
|
idle-update-delay 1 ; update ui less often
|
||||||
|
|
|
@ -108,7 +108,7 @@
|
||||||
(def-package! irony
|
(def-package! irony
|
||||||
:after cc-mode
|
:after cc-mode
|
||||||
:config
|
:config
|
||||||
(setq irony-server-install-prefix (concat doom-cache-dir "irony-server/"))
|
(setq irony-server-install-prefix (concat doom-etc-dir "irony-server/"))
|
||||||
(add-hook! 'irony-mode-hook '(irony-eldoc flycheck-mode))
|
(add-hook! 'irony-mode-hook '(irony-eldoc flycheck-mode))
|
||||||
(add-hook! 'c++-mode-hook
|
(add-hook! 'c++-mode-hook
|
||||||
(make-local-variable 'irony-additional-clang-options)
|
(make-local-variable 'irony-additional-clang-options)
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
(set! :build 'compile-file 'java-mode 'meghanada-compile-file)
|
(set! :build 'compile-file 'java-mode 'meghanada-compile-file)
|
||||||
(set! :build 'compile-project 'java-mode 'meghanada-compile-project)
|
(set! :build 'compile-project 'java-mode 'meghanada-compile-project)
|
||||||
|
|
||||||
(setq meghanada-server-install-dir (expand-file-name "meghanada-server/" doom-cache-dir)
|
(setq meghanada-server-install-dir (concat doom-etc-dir "meghanada-server/")
|
||||||
meghanada-use-company t
|
meghanada-use-company t
|
||||||
meghanada-use-flycheck t
|
meghanada-use-flycheck t
|
||||||
meghanada-use-auto-start t)
|
meghanada-use-auto-start t)
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
:init
|
:init
|
||||||
(add-hook 'php-mode-hook 'eldoc-mode)
|
(add-hook 'php-mode-hook 'eldoc-mode)
|
||||||
:config
|
:config
|
||||||
(setq php-extras-eldoc-functions-file (concat doom-cache-dir "php-extras-eldoc-functions"))
|
(setq php-extras-eldoc-functions-file (concat doom-etc-dir "php-extras-eldoc-functions"))
|
||||||
|
|
||||||
;; company will set up itself
|
;; company will set up itself
|
||||||
(advice-add 'php-extras-company-setup :override 'ignore)
|
(advice-add 'php-extras-company-setup :override 'ignore)
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
:init
|
:init
|
||||||
(add-hook 'python-mode-hook 'anaconda-mode)
|
(add-hook 'python-mode-hook 'anaconda-mode)
|
||||||
(add-hook 'anaconda-mode-hook 'anaconda-eldoc-mode)
|
(add-hook 'anaconda-mode-hook 'anaconda-eldoc-mode)
|
||||||
(setq anaconda-mode-installation-directory (concat doom-cache-dir "anaconda/")
|
(setq anaconda-mode-installation-directory (concat doom-etc-dir "anaconda/")
|
||||||
anaconda-mode-eldoc-as-single-line t)
|
anaconda-mode-eldoc-as-single-line t)
|
||||||
|
|
||||||
:config
|
:config
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue