refactor: deprecate appendq!, prependq!, & delq! macros

In the interest of slimming down Doom's core (as we near v3), I've
deprecated these macros. They doesn't really need to exist. Sure, the
alternatives aren't as ergonomic or elegant, but they're good enough
that we don't need these trivial wrappers. Their local uses have been
refactored out as well.
This commit is contained in:
Henrik Lissner
2025-03-25 00:31:41 -04:00
parent 2f7f37d49b
commit dac6e05b87
27 changed files with 85 additions and 131 deletions

View File

@@ -5,7 +5,7 @@
;; `elisp-mode' is loaded at startup. In order to lazy load its config we need
;; to pretend it isn't loaded
(delq! 'ispell features)
(cl-callf2 delq 'ispell features)
(global-set-key [remap ispell-word] #'+spell/correct)

View File

@@ -149,7 +149,7 @@
;; Don't show documentation in echo area, because company-box displays its own
;; in a child frame.
(delq! 'company-echo-metadata-frontend company-frontends)
(cl-callf2 delq 'company-echo-metadata-frontend company-frontends)
(defun +company-box-icons--elisp-fn (candidate)
(when (derived-mode-p 'emacs-lisp-mode)

View File

@@ -351,7 +351,7 @@ If ARG (universal argument), include all files, even hidden or compressed ones."
:require-match t
:action (lambda (cand)
(let ((mark (cdr cand)))
(delq! (marker-buffer mark) buffers)
(cl-callf2 delq (marker-buffer mark) buffers)
(mapc #'kill-buffer buffers)
(setq buffers nil)
(with-current-buffer (switch-to-buffer (marker-buffer mark))

View File

@@ -109,7 +109,7 @@
(dolist (hook (cdr deferral-list))
(advice-remove hook #',fn)
(remove-hook hook #',fn))
(delq! deferral-list doom--deferred-packages-alist)
(cl-callf2 delq deferral-list doom--deferred-packages-alist)
(unintern ',fn nil)))))
(let (forms)
(dolist (hook hooks forms)

View File

@@ -182,7 +182,7 @@ directives. By default, this only recognizes C directives.")
(advice-add #'evil-open-below :around #'+evil--insert-newline-below-and-respect-comments-a)
;; Lazy load evil ex commands
(delq! 'evil-ex features)
(cl-callf2 delq 'evil-ex features)
(add-transient-hook! 'evil-ex (provide 'evil-ex))
(after! evil-ex (load! "+commands")))

View File

@@ -45,7 +45,7 @@
(advice-add #'yas-snippet-dirs :filter-return #'delete-dups)
;; Remove GUI dropdown prompt (prefer ivy/helm)
(delq! 'yas-dropdown-prompt yas-prompt-functions)
(cl-callf2 delq 'yas-dropdown-prompt yas-prompt-functions)
;; Prioritize private snippets in `+snippets-dir' over built-in ones if there
;; are multiple choices.
(add-to-list 'yas-prompt-functions #'+snippets-prompt-private)

View File

@@ -115,7 +115,7 @@ Fixes #3939: unsortable dired entries on Windows."
(when (modulep! +icons)
(setq dirvish-subtree-always-show-state t)
(appendq! dirvish-attributes '(nerd-icons subtree-state)))
(cl-callf append dirvish-attributes '(nerd-icons subtree-state)))
(setq dirvish-hide-details '(dirvish dirvish-side)
dirvish-hide-cursor '(dirvish dirvish-side))

View File

@@ -630,7 +630,6 @@ See `+mu4e-msg-gmail-p' and `mu4e-sent-messages-behavior'.")
(defvar +mu4e--last-invalid-gmail-action 0)
(delq! 'delete mu4e-marks #'assq)
(setf (alist-get 'delete mu4e-marks)
(list
:char '("D" . "")

View File

@@ -217,9 +217,8 @@ Math faces should stay fixed by the mixed-pitch blacklist, this is mostly for
(defadvice! +latex--dont-indent-itemize-and-enumerate-and-description-a (fn &rest args)
:around #'LaTeX-fill-region-as-paragraph
(let ((LaTeX-indent-environment-list LaTeX-indent-environment-list))
(delq! "itemize" LaTeX-indent-environment-list 'assoc)
(delq! "enumerate" LaTeX-indent-environment-list 'assoc)
(delq! "description" LaTeX-indent-environment-list 'assoc)
(dolist (item '("itemize" "enumerate" "description"))
(setf (alist-get item LaTeX-indent-environment-list nil t #'equal) nil))
(apply fn args))))

View File

@@ -760,7 +760,7 @@ mutating hooks on exported output, like formatters."
"Restart `org-mode', but only once."
(remove-hook 'doom-switch-buffer-hook #'+org--restart-mode-h 'local)
(quiet! (org-mode-restart))
(delq! (current-buffer) org-agenda-new-buffers)
(cl-callf2 delq (current-buffer) org-agenda-new-buffers)
(run-hooks 'find-file-hook))
(add-hook! 'org-agenda-finalize-hook

View File

@@ -20,4 +20,4 @@
(use-package! company-solidity
:when (modulep! :completion company)
:config (delq! 'company-solidity company-backends)))
:config (cl-callf2 delq 'company-solidity company-backends)))

View File

@@ -62,7 +62,7 @@
collect (cons (car pair)
(string-trim-right (cdr pair)
"\\(?:>\\|]\\|}\\)+\\'")))))
(delq! nil web-mode-engines-auto-pairs))
(cl-callf2 delq nil web-mode-engines-auto-pairs))
(add-to-list 'web-mode-engines-alist '("elixir" . "\\.eex\\'"))
(add-to-list 'web-mode-engines-alist '("phoenix" . "\\.[lh]eex\\'"))

View File

@@ -54,7 +54,7 @@ QUERY must be a string, and PROVIDER must be a key of
(and (fboundp backend)
(funcall backend query))
(error
(delq! major-mode +lookup--last-provider 'assq)
(setf (alist-get major-mode +lookup--last-provider nil t) nil)
(signal (car e) (cdr e))))
(throw 'done t)))))))

View File

@@ -35,7 +35,7 @@ Note that this will keep all ligatures in `+ligatures-prog-mode-list' active, as
(declare (indent defun))
(if (null (car-safe plist))
(dolist (mode (ensure-list modes))
(delq! mode +ligatures-extra-alist 'assq))
(setf (alist-get mode +ligatures-extra-alist nil t) nil))
(let ((results))
(while plist
(let ((key (pop plist)))

View File

@@ -474,7 +474,7 @@ lines are selected, or the NxM dimensions of a block selection.")
(defun +modeline-add-selection-segment-h ()
(add-to-list '+modeline-format-left '+modeline-selection-info 'append))
(defun +modeline-remove-selection-segment-h ()
(delq! '+modeline-selection-info +modeline-format-left))
(cl-callf2 delq '+modeline-selection-info +modeline-format-left))
(if (featurep 'evil)
(progn