summaryrefslogtreecommitdiff
path: root/tw/home/files/emacs-init.el
diff options
context:
space:
mode:
authorTimo Wilken2023-01-19 23:48:35 +0100
committerTimo Wilken2023-01-19 23:48:35 +0100
commit1b166c5bb8597e1efc2580c7992d5df94532e55a (patch)
treeebec45b8cfbe2bac8d464ecbfa57eb645fa21c81 /tw/home/files/emacs-init.el
parenta743a559aaaaa51be1a233b26c6c67acef69ea5a (diff)
Fix Emacs data paths
Diffstat (limited to 'tw/home/files/emacs-init.el')
-rw-r--r--tw/home/files/emacs-init.el44
1 files changed, 16 insertions, 28 deletions
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_<TYPE>_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 @@
("<leader>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 (("<leader>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