From 43022b56569717f28fa16284f7092f2bbe0830ad Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sat, 16 May 2026 12:20:44 -0500 Subject: refactor: consolidate runtime state into persist/ Six previously-scattered runtime state files now live under persist/ in user-emacs-directory: - theme-file (was .emacs-theme) - pdf-view-restore-filename (was .pdf-view-restore) - time-zones--city-list-file (was .time-zones.el) - calendar-sync--state-file (was data/calendar-sync-state.el) - prescient-save-file (was var/prescient-save.el) - org-id-locations-file (was .org-id-locations) The defaults in each module now expand to persist/ instead of the user-emacs-directory root or ad-hoc subdirs. Existing files moved into persist/ alongside this change so the next launch picks up the state without regenerating. test-ui-theme-default-theme-file-is-emacs-dotfile renamed to test-ui-theme-default-theme-file-is-under-persist and updated to assert the new default path. lsp-session-file is left at the root for now -- prog-lsp.el has no (require) reference anywhere, so the use-package block that would carry the redirect never runs. Tier 3 follow-up: confirm the module is dead, then delete it or wire it into the load chain. The var/ directory is now empty and removed. data/ retains the calendar agenda content (dcal/gcal/pcal.org) and the .rest API examples -- content, not state, stays where it is. --- modules/calendar-sync.el | 2 +- modules/chrono-tools.el | 3 +++ modules/org-config.el | 2 ++ modules/pdf-config.el | 2 +- modules/selection-framework.el | 2 ++ modules/ui-theme.el | 2 +- 6 files changed, 10 insertions(+), 3 deletions(-) (limited to 'modules') diff --git a/modules/calendar-sync.el b/modules/calendar-sync.el index 62d1b5f1..f0d6f786 100644 --- a/modules/calendar-sync.el +++ b/modules/calendar-sync.el @@ -167,7 +167,7 @@ Hash table mapping calendar name (string) to state plist with: Used to detect timezone changes (e.g., when traveling).") (defvar calendar-sync--state-file - (expand-file-name "data/calendar-sync-state.el" user-emacs-directory) + (expand-file-name "persist/calendar-sync-state.el" user-emacs-directory) "File to persist sync state across Emacs sessions.") ;;; Timezone Detection diff --git a/modules/chrono-tools.el b/modules/chrono-tools.el index 8b8c2072..33f2b11e 100644 --- a/modules/chrono-tools.el +++ b/modules/chrono-tools.el @@ -18,6 +18,9 @@ (use-package time-zones :defer :commands time-zones + :init + (setq time-zones--city-list-file + (expand-file-name "persist/time-zones-cities.el" user-emacs-directory)) :bind ("M-S-c" . time-zones)) ;; was M-C, overrides capitalize-word (use-package calendar diff --git a/modules/org-config.el b/modules/org-config.el index 20160d7d..c04683c0 100644 --- a/modules/org-config.el +++ b/modules/org-config.el @@ -25,6 +25,8 @@ (setq org-startup-folded t) ;; all org files should start in the folded state (setq org-cycle-open-archived-trees t) ;; re-enable opening headings with archive tags with TAB (setq org-cycle-hide-drawers 'all) ;; collapse :PROPERTIES: drawers when a heading folds + (setq org-id-locations-file + (expand-file-name "persist/org-id-locations" user-emacs-directory)) (setopt org-outline-path-complete-in-steps nil) (setq org-return-follows-link t) ;; hit return to follow an org-link (setq org-list-allow-alphabetical t) ;; allow alpha ordered lists (i.e., a), A), a., etc.) diff --git a/modules/pdf-config.el b/modules/pdf-config.el index 3835eaa8..cc32f62b 100644 --- a/modules/pdf-config.el +++ b/modules/pdf-config.el @@ -65,7 +65,7 @@ :hook (pdf-view-mode . pdf-view-restore-mode) :config - (setq pdf-view-restore-filename (concat user-emacs-directory "/.pdf-view-restore"))) + (setq pdf-view-restore-filename (expand-file-name "persist/pdf-view-restore" user-emacs-directory))) (provide 'pdf-config) ;;; pdf-config.el ends here. diff --git a/modules/selection-framework.el b/modules/selection-framework.el index 2a714866..15ef0a94 100644 --- a/modules/selection-framework.el +++ b/modules/selection-framework.el @@ -229,6 +229,8 @@ (use-package prescient :demand t + :custom + (prescient-save-file (expand-file-name "persist/prescient-save.el" user-emacs-directory)) :config (prescient-persist-mode)) diff --git a/modules/ui-theme.el b/modules/ui-theme.el index f84d7231..bcc58575 100644 --- a/modules/ui-theme.el +++ b/modules/ui-theme.el @@ -48,7 +48,7 @@ Unloads any other applied themes before applying the chosen theme." "Theme persistence settings." :group 'faces) -(defcustom theme-file (expand-file-name ".emacs-theme" user-emacs-directory) +(defcustom theme-file (expand-file-name "persist/emacs-theme" user-emacs-directory) "The location of the file to persist the theme name. If you want your theme change to persist across instances, put this in a directory that is sync'd across machines with this configuration." -- cgit v1.2.3