From 778692c9e0a0310326b98bf087a1da7feea7b1ed Mon Sep 17 00:00:00 2001 From: Madeleine Sydney Date: Wed, 15 Jan 2025 16:56:12 -0700 Subject: [PATCH] feat: Keep eln-cache out of my config directory. For early-init reasons, we had to split part of syd-prelude.el out into a new file, syd-constants.el. --- users/crumb/programs/emacs/early-init.el | 7 +++++++ users/crumb/programs/emacs/init.el | 4 +++- users/crumb/programs/emacs/lib/syd-constants.el | 13 +++++++++++++ users/crumb/programs/emacs/lib/syd-prelude.el | 9 +-------- 4 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 users/crumb/programs/emacs/lib/syd-constants.el diff --git a/users/crumb/programs/emacs/early-init.el b/users/crumb/programs/emacs/early-init.el index 030db43..0fc0160 100644 --- a/users/crumb/programs/emacs/early-init.el +++ b/users/crumb/programs/emacs/early-init.el @@ -1,5 +1,8 @@ ;;; early-init.el -*- lexical-binding: t; -*- +(add-to-list 'load-path (file-name-concat user-emacs-directory "lib")) +(require 'syd-constants) + ;; Disable package.el; we use Straight. (setq package-enable-at-startup nil) @@ -9,3 +12,7 @@ (setq gc-cons-threshold ;; (4 gibibytes) (* 4 (expt 1024 3))) + +;; By default, Emacs will cache compilation artifacts in my personal config +;; directory — I'm not keen on that! Redirect it to a dedicated cache directory. +(startup-redirect-eln-cache (file-name-concat syd-cache-dir "eln-cache")) diff --git a/users/crumb/programs/emacs/init.el b/users/crumb/programs/emacs/init.el index 311f689..7e269ca 100644 --- a/users/crumb/programs/emacs/init.el +++ b/users/crumb/programs/emacs/init.el @@ -9,7 +9,9 @@ ;; Personal modules. (add-to-list 'load-path (file-name-concat user-emacs-directory "modules")) -(add-to-list 'load-path (file-name-concat user-emacs-directory "lib")) + +;; Must come before the rest! +(require 'syd-use-package) (require 'syd-age) (require 'syd-autosave) diff --git a/users/crumb/programs/emacs/lib/syd-constants.el b/users/crumb/programs/emacs/lib/syd-constants.el new file mode 100644 index 0000000..8e2180a --- /dev/null +++ b/users/crumb/programs/emacs/lib/syd-constants.el @@ -0,0 +1,13 @@ +;;; syd-constants.el -*- lexical-binding: t; -*- + +(defvar syd-data-dir + (or (getenv "EMACS_DATA_DIR") + (error "Need $EMACS_DATA_DIR")) + "Directory analogous to XDG_DATA_HOME for miscellaneous Emacs things.") + +(defvar syd-cache-dir + (or (getenv "EMACS_CACHE_DIR") + (error "Need $EMACS_CACHE_DIR"))) + +(provide 'syd-constants) +;;; syd-constants.el ends here diff --git a/users/crumb/programs/emacs/lib/syd-prelude.el b/users/crumb/programs/emacs/lib/syd-prelude.el index 9768a6f..908832d 100644 --- a/users/crumb/programs/emacs/lib/syd-prelude.el +++ b/users/crumb/programs/emacs/lib/syd-prelude.el @@ -2,14 +2,7 @@ (eval-when-compile (require 'cl-lib)) -(defvar syd-data-dir - (or (getenv "EMACS_DATA_DIR") - (error "Need $EMACS_DATA_DIR")) - "Directory analogous to XDG_DATA_HOME for miscellaneous Emacs things.") - -(defvar syd-cache-dir - (or (getenv "EMACS_CACHE_DIR") - (error "Need $EMACS_CACHE_DIR"))) +(require 'syd-constants) (cl-defmacro syd-define-stub (name &key (desc "implement me!") interactive)