Skip to content

Commit 1bb0639

Browse files
sunlin7Lin Sun
authored and
Lin Sun
committed
* core/core-load-paths.el: Support customize spacemacs-cache-directory
1 parent 063a915 commit 1bb0639

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

core/core-load-paths.el

+15-5
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
;; Define various PATH variables, and set up load path.
2626

2727
;;; Code:
28+
(defgroup spacemacs nil
29+
"Spacemacs customizations."
30+
:group 'emacs
31+
:prefix 'spacemacs-)
2832

2933
;;;; PATH variables/constants
3034

@@ -94,16 +98,22 @@
9498
;;
9599
;; This is based on `user-emacs-directory', not `spacemacs-start-directory',
96100
;; because Spacemacs may be installed to a shared location and this directory
97-
;; and its children should be per-user.
98-
(defconst spacemacs-cache-directory
101+
;; and its children should be per-user. Allow user to define their own path.
102+
(defcustom spacemacs-cache-directory
99103
(concat user-emacs-directory ".cache/")
100-
"Spacemacs storage area for persistent files.")
104+
"Spacemacs storage area for persistent files."
105+
:group 'spacemacs
106+
:type 'directory)
101107

102108
;; ~/.emacs.d/.cache/auto-save
103-
(defconst spacemacs-auto-save-directory
104-
(concat spacemacs-cache-directory "auto-save/")
109+
(defconst spacemacs-auto-save-directory nil
105110
"Spacemacs auto-save directory.")
106111

112+
(defun spacemacs/auto-save-directory ()
113+
"Spacemacs auto-save directory."
114+
(or spacemacs-auto-save-directory
115+
(concat spacemacs-cache-directory "auto-save/")))
116+
107117

108118
;;;; Setup cache directories
109119

core/core-spacemacs.el

-5
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@
2222

2323
(setq message-log-max 16384)
2424

25-
(defgroup spacemacs nil
26-
"Spacemacs customizations."
27-
:group 'emacs
28-
:prefix 'spacemacs-)
29-
3025
(require 'subr-x nil 'noerror)
3126
(require 'core-versions)
3227
(require 'core-load-paths)

layers/+spacemacs/spacemacs-defaults/config.el

+3-3
Original file line numberDiff line numberDiff line change
@@ -203,18 +203,18 @@ or `nil' to only save and not visit the file."
203203

204204
;; Auto-save file
205205
(setq auto-save-default (not (null dotspacemacs-auto-save-file-location)))
206-
(setq auto-save-list-file-prefix (concat spacemacs-auto-save-directory))
206+
(setq auto-save-list-file-prefix (spacemacs/auto-save-directory))
207207
;; always save TRAMP URLs to cache directory no matter what is the value
208208
;; of `dotspacemacs-auto-save-file-location'
209-
(let ((autosave-dir (concat spacemacs-auto-save-directory "dist/")))
209+
(let ((autosave-dir (concat (spacemacs/auto-save-directory) "dist/")))
210210
(setq auto-save-file-name-transforms
211211
`(("\\`/[^/]*:\\([^/]*/\\)*\\([^/]*\\)\\'" ,autosave-dir t)))
212212
(unless (or (file-exists-p autosave-dir)
213213
(null dotspacemacs-auto-save-file-location))
214214
(make-directory autosave-dir t)))
215215
;; Choose auto-save location
216216
(cl-case dotspacemacs-auto-save-file-location
217-
(cache (let ((autosave-dir (concat spacemacs-auto-save-directory "site/")))
217+
(cache (let ((autosave-dir (concat (spacemacs/auto-save-directory) "site/")))
218218
(add-to-list 'auto-save-file-name-transforms
219219
`(".*" ,autosave-dir t) 'append)
220220
(unless (file-exists-p autosave-dir)

0 commit comments

Comments
 (0)