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

@ -113,24 +113,23 @@ MATCH is a string regexp. Only entries that match it will be included."
(let (result)
(dolist (file (mapcan (doom-rpartial #'doom-glob "*") (ensure-list paths)))
(cond ((file-directory-p file)
(appendq!
result
(and (memq type '(t dirs))
(string-match-p match file)
(not (and filter (funcall filter file)))
(not (and (file-symlink-p file)
(not follow-symlinks)))
(<= mindepth 0)
(list (if relative-to
(file-relative-name file relative-to)
file)))
(and (>= depth 1)
(apply #'doom-files-in file
(append (list :mindepth (1- mindepth)
:depth (1- depth)
:relative-to relative-to
:map nil)
rest)))))
(cl-callf append result
(and (memq type '(t dirs))
(string-match-p match file)
(not (and filter (funcall filter file)))
(not (and (file-symlink-p file)
(not follow-symlinks)))
(<= mindepth 0)
(list (if relative-to
(file-relative-name file relative-to)
file)))
(and (>= depth 1)
(apply #'doom-files-in file
(append (list :mindepth (1- mindepth)
:depth (1- depth)
:relative-to relative-to
:map nil)
rest)))))
((and (memq type '(t files))
(string-match-p match file)
(not (and filter (funcall filter file)))

View File

@ -151,13 +151,13 @@ properties:
(:cond
(cl-loop for (cond . mods) in (cdr m)
if (eval cond t)
return (prependq! mplist mods)))
return (cl-callf2 append mods mplist)))
(:if (if (eval (cadr m) t)
(push (caddr m) mplist)
(prependq! mplist (cdddr m))))
(cl-callf2 append (cdddr m) mplist)))
(test (if (xor (eval (cadr m) t)
(eq test :unless))
(prependq! mplist (cddr m))))))
(cl-callf2 append (cddr m) mplist)))))
((catch 'doom-modules
(let* ((module (if (listp m) (car m) m))
(flags (if (listp m) (cdr m))))

View File

@ -199,7 +199,7 @@ processed."
(cl-pushnew name doom-disabled-packages)
(when recipe
(straight-override-recipe (cons name recipe)))
(appendq! packages (cons name (straight--get-dependencies name)))))))
(cl-callf append packages (cons name (straight--get-dependencies name)))))))
(dolist (package (cl-delete-duplicates packages :test #'equal))
(straight-register-package package)
(let ((name (symbol-name package)))

View File

@ -45,8 +45,7 @@ name under `pcache-directory' (by default a subdirectory under
"Persist VARIABLES (list of symbols) in LOCATION (symbol).
This populates these variables with cached values, if one exists, and saves them
to file when Emacs quits. This cannot persist buffer-local variables."
(cl-check-type location string)
(dolist (var variables)
(dolist (var (ensure-list variables))
(when (doom-store-member-p var location)
(set var (doom-store-get var location))))
(setf (alist-get location doom-store-persist-alist)
@ -57,12 +56,10 @@ to file when Emacs quits. This cannot persist buffer-local variables."
"Unregisters VARIABLES (list of symbols) in LOCATION (symbol).
Variables to persist are recorded in `doom-store-persist-alist'. Does not affect
the actual variables themselves or their values."
(cl-check-type location string)
(if variables
(setf (alist-get location doom-store-persist-alist)
(setf (alist-get location doom-store-persist-alist nil t)
(if variables
(cl-set-difference (cdr (assq location doom-store-persist-alist))
variables))
(delq! location doom-store-persist-alist 'assoc)))
variables))))
(defun doom--store-init (&optional location)
(cl-check-type location (or null string))