summaryrefslogtreecommitdiff
path: root/tw/home/files
diff options
context:
space:
mode:
authorTimo Wilken2023-04-24 20:08:49 +0200
committerTimo Wilken2023-04-24 20:08:49 +0200
commit1921378227726ac21071e5575d565c3119dc8a38 (patch)
tree2664af159c2b175895192cd0b031240fe265db6c /tw/home/files
parent4a088926ac1b31647682a678777126a603091791 (diff)
Improve Emacs data file locations
Move `native-compile-target-directory' setup to early-init.el to avoid clutter, and move a couple more data dirs to ~/.local/share.
Diffstat (limited to 'tw/home/files')
-rw-r--r--tw/home/files/emacs-early-init.el13
-rw-r--r--tw/home/files/emacs-init.el8
2 files changed, 16 insertions, 5 deletions
diff --git a/tw/home/files/emacs-early-init.el b/tw/home/files/emacs-early-init.el
new file mode 100644
index 00000000..f4d4e765
--- /dev/null
+++ b/tw/home/files/emacs-early-init.el
@@ -0,0 +1,13 @@
+;;; early-init.el --- Emacs early-start initialisation
+;;; Commentary:
+;;; Put native-compiled binaries in the cache. Do this in early-init so that
+;;; Emacs doesn't start compiling stuff and putting it in the wrong directory
+;;; before loading init.el.
+;;; Code:
+
+;; Don't require 'comp (which defines `native-compile-target-directory'), so
+;; that we don't load-and-compile subr.el before the variable is set properly.
+(setq native-compile-target-directory ; not a `customize' option
+ (expand-file-name "emacs/eln" (or (getenv "XDG_CACHE_HOME") "~/.cache/")))
+
+;;; early-init.el ends here
diff --git a/tw/home/files/emacs-init.el b/tw/home/files/emacs-init.el
index 1469dab2..0662b914 100644
--- a/tw/home/files/emacs-init.el
+++ b/tw/home/files/emacs-init.el
@@ -20,10 +20,6 @@
('state (or (getenv "XDG_STATE_HOME") "~/.local/var/lib/"))
(_ (error "Unknown XDG directory type: %S" type)))))
-;; Put native-compiled binaries in the cache. This is NOT a `customize' option.
-(require 'comp) ; for `native-compile-target-directory'
-(setq native-compile-target-directory (tw/xdg-emacs-subdir 'cache "eln/"))
-
;; Global/built-in Custom settings
;; Apply these as early as possible so that e.g. the native-comp files go to the right place.
(mapc (apply-partially #'apply #'customize-set-variable)
@@ -49,7 +45,9 @@
(package-archives nil "Don't fetch packages from the internet; only get them from Guix.")
;; Don't clutter the disk with backup files.
(make-backup-files nil "Don't create backup files. Backup files break hardlinks.")
- ;; Recent files and history.
+ ;; Recent files and history. Keep them out of ~/.config.
+ (package-user-dir ,(tw/xdg-emacs-subdir 'data "elpa") "Save ELPA-related files here.")
+ (auto-save-list-file-prefix ,(tw/xdg-emacs-subdir 'data "auto-save-list/saves-") "Put auto-save lists here.")
(recentf-max-saved-items 1000 "Save lots of recently-opened files.")
(recentf-save-file ,(tw/xdg-emacs-subdir 'data "recentf.el") "Save recently-opened files here.")
(recentf-mode t "Save recently-opened files.")