From b072daf63f65d59580b7bc96ff128677bec79ee5 Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Sun, 17 Mar 2024 13:10:19 +0100 Subject: Double-down on macros to reduce customization boilerplate --- .emacs | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/.emacs b/.emacs index c8c2260..e6d10bd 100644 --- a/.emacs +++ b/.emacs @@ -31,10 +31,9 @@ ;; to the default list, unless I cautiously audit every release. ;; ;; Examples: erc-modules, git-commit-setup-hook, package-archives. -(defun my/list-update (l to-add &optional to-remove) - (declare (indent 1)) - (thread-first - l (seq-union to-add) (seq-difference to-remove))) +(defmacro my/setopt-update-list (l to-add &optional to-remove) + `(my/setopt ,l (thread-first + ,l (seq-union ,to-add) (seq-difference ,to-remove)))) (load-theme 'eighters t) @@ -725,9 +724,8 @@ UPSTREAMS is a list of fetch URLs." (when (<= emacs-major-version 29) '(eglot use-package)))) :config - (my/setopt package-archives - (my/list-update package-archives - '(("melpa" . "https://melpa.org/packages/"))))) + (my/setopt-update-list + package-archives '(("melpa" . "https://melpa.org/packages/")))) (use-package calendar :custom @@ -806,11 +804,8 @@ UPSTREAMS is a list of fetch URLs." (erc-insert-timestamp-function 'erc-insert-timestamp-left) (erc-timestamp-format "[%F %H:%M] ") :config - (my/setopt - erc-modules - (my/list-update erc-modules '(log notifications stamp track) '(fill)) - erc-track-exclude-types - (my/list-update erc-track-exclude-types '("JOIN" "PART" "QUIT")))) + (my/setopt-update-list erc-modules '(log notifications stamp track) '(fill)) + (my/setopt-update-list erc-track-exclude-types '("JOIN" "PART" "QUIT"))) (use-package generic-x :demand t @@ -828,10 +823,9 @@ UPSTREAMS is a list of fetch URLs." (use-package git-commit :config - (my/setopt git-commit-setup-hook - (my/list-update git-commit-setup-hook - '(git-commit-turn-on-flyspell - my/git-commit-maybe-set-fill-column)))) + (my/setopt-update-list + git-commit-setup-hook '(git-commit-turn-on-flyspell + my/git-commit-maybe-set-fill-column))) (use-package isearch :delight "🔍" @@ -957,13 +951,10 @@ UPSTREAMS is a list of fetch URLs." (use-package whitespace :config - (my/setopt - whitespace-style - (my/list-update whitespace-style - nil '(lines missing-newline-at-eof))) + (my/setopt-update-list whitespace-style nil '(lines missing-newline-at-eof)) :delight - ;; FIXME: without :demand t, enabling whitespace-mode in a diff - ;; buffer first causes diff-mode's settings to be applied globally. + ;; FIXME: without :demand t, enabling whitespace-mode in a diff + ;; buffer first causes diff-mode's settings to be applied globally. :demand t) ;;; TODO: -- cgit v1.2.3