From 1b166c5bb8597e1efc2580c7992d5df94532e55a Mon Sep 17 00:00:00 2001 From: Timo Wilken Date: Thu, 19 Jan 2023 23:48:35 +0100 Subject: Fix Emacs data paths --- tw/home/files/emacs-init.el | 44 ++++++++++++++++---------------------------- 1 file changed, 16 insertions(+), 28 deletions(-) (limited to 'tw') diff --git a/tw/home/files/emacs-init.el b/tw/home/files/emacs-init.el index 0bea0e57..3bbd8d0e 100644 --- a/tw/home/files/emacs-init.el +++ b/tw/home/files/emacs-init.el @@ -10,7 +10,7 @@ (defun tw/xdg-emacs-subdir (type name) "Get the name of a subdirectory called NAME under $XDG__HOME/emacs." (expand-file-name - (concat "emacs/" (string-trim-right name "/") "/") + (concat "emacs/" (string-trim-right name "/")) (pcase type ('cache (or (getenv "XDG_CACHE_HOME") "~/.cache/")) ('config (or (getenv "XDG_CONFIG_HOME") "~/.config/")) @@ -41,7 +41,17 @@ (electric-pair-mode t "Auto-pair suitable characters like parentheses.") (completion-cycle-threshold 6 "Allow cycling through completions if there are 6 or fewer of them.") ;; Text formatting. - (sentence-end-double-space nil "Use a single space after a sentence."))) + (sentence-end-double-space nil "Use a single space after a sentence.") + ;; Make Emacs a good Guix citizen. + (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. + (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.") + (savehist-file ,(tw/xdg-emacs-subdir 'data "savehist.el") "Save minibuffer history here.") + (savehist-mode t "Save minibuffer history on quit."))) (defalias 'yes-or-no-p #'y-or-n-p "Always use `y-or-n-p' when asking for confirmation.") @@ -90,33 +100,11 @@ "Make the cursor \"rosewater\", as recommended by Catppuccin upstream, overriding catppuccin/emacs.")) (use-package smart-mode-line - :commands (sml/setup) :demand t + :hook (after-init . sml/setup) :custom (sml/no-confirm-load-theme t "Stop Emacs from constantly asking for user confirmation.") (sml/mode-width 'right "Move the minor-mode list to the right of the modeline.") - (sml/theme 'respectful "Make `smart-mode-line' blend in with the active theme.") - :config (sml/setup)) - -;; Built-in Emacs stuff. -(use-package package - :custom - (package-archives nil "Don't fetch packages from the internet; only get them from Guix.")) - -(use-package recentf - :custom - (recentf-max-saved-items 1000 "Save lots of recently-opened files.") - (recentf-save-file ,(tw/xdg-emacs-subdir 'data "recentf") "Save recently-opened files here.") - (recentf-mode t "Save recently-opened files.")) - -(use-package savehist - :custom - (savehist-file ,(tw/xdg-emacs-subdir 'data "history") "Save minibuffer history here.") - (savehist-mode t "Save minibuffer history on quit.")) - -(use-package files - :custom - (backup-directory-alist `(("." . ,(tw/xdg-emacs-subdir 'data "backup"))) - "Save all backup files in one place to avoid clutter.")) + (sml/theme 'respectful "Make `smart-mode-line' blend in with the active theme.")) ;; General editor behaviour. (use-package ivy @@ -149,7 +137,7 @@ ("dd" . counsel-dash-deactivate-docset)) :hook (python-mode . tw/counsel-dash-is-help) :custom - (counsel-dash-docsets-path (tw/xdg-emacs-subdir 'data "dash-docsets") "Store docsets in the XDG data directory.") + (counsel-dash-docsets-path (tw/xdg-emacs-subdir 'data "dash-docsets/") "Store docsets in the XDG data directory.") (counsel-dash-browser-func 'eww "Open documentation pages using `eww' instead of an external browser.") (counsel-dash-enable-debugging nil "Disable popping up useless warnings.")) @@ -173,7 +161,7 @@ :bind (("U" . undo-tree-visualize)) :custom (undo-tree-history-directory-alist - `(("." . ,(tw/xdg-emacs-subdir 'data "undo-tree-history"))) + `(("." . ,(tw/xdg-emacs-subdir 'data "undo-tree-history/"))) "Store all `undo-tree' history in a single directory, instead of next to the associated file.") :commands (global-undo-tree-mode) :demand t ; this is required so that the :config stanza is actually run asap despite :bind -- cgit v1.2.3