refactor: replace doom-enlist with ensure-list
doom-enlist is now a deprecated alias for ensure-list, which is built into Emacs 28.1+ and is its drop-in replacement. We've already backported it for 27.x users in doom-lib (in4bf4978
). Ref:4bf49785fd
This commit is contained in:
parent
1abcf913aa
commit
057e6c531c
28 changed files with 41 additions and 46 deletions
|
@ -118,7 +118,7 @@ list remains lean."
|
|||
(dolist (,recipe-var ,recipes-var (nreverse built))
|
||||
(cl-block nil
|
||||
(straight--with-plist (append (list :recipe ,recipe-var) ,recipe-var)
|
||||
,(doom-enlist binds)
|
||||
,(ensure-list binds)
|
||||
,@body))))))
|
||||
|
||||
(defvar doom-packages--cli-updated-recipes nil)
|
||||
|
|
|
@ -216,7 +216,7 @@ execution. Can be generated from a `doom-cli-context' with
|
|||
|
||||
This means that all non-keywords are strings, any prefixes provided by PLIST are
|
||||
prepended, and the keyword is in front."
|
||||
(let* ((command (doom-enlist command))
|
||||
(let* ((command (ensure-list command))
|
||||
(prefix (plist-get plist :prefix))
|
||||
(prefix (if prefix (doom-cli-command-normalize
|
||||
prefix (append `(:prefix nil) plist))))
|
||||
|
@ -435,14 +435,14 @@ If RECURSIVE, includes breadcrumbs leading up to COMMANDSPEC."
|
|||
collect command)))
|
||||
(seq-reduce (lambda (init next)
|
||||
(nconc (cl-loop with firstlen = (length (car init))
|
||||
for seg in (doom-enlist next)
|
||||
for seg in (ensure-list next)
|
||||
nconc
|
||||
(cl-loop for command in init
|
||||
while (= (length command) firstlen)
|
||||
collect (append command (list seg))))
|
||||
init))
|
||||
(cdr commandspec)
|
||||
`(,@(mapcar #'list (doom-enlist (car commandspec)))))))
|
||||
`(,@(mapcar #'list (ensure-list (car commandspec)))))))
|
||||
|
||||
(defun doom-cli--parse-docs (docs)
|
||||
(when (and (stringp docs)
|
||||
|
@ -1639,7 +1639,7 @@ yet. They won't be included in command listings (by help documentation)."
|
|||
(push `(cl-callf plist-put doom-cli--plist
|
||||
,key ,(if (eq key :prefix)
|
||||
`(append (plist-get doom-cli--plist ,key)
|
||||
(doom-enlist ,val))
|
||||
(ensure-list ,val))
|
||||
val))
|
||||
forms)))
|
||||
(nreverse forms))
|
||||
|
|
|
@ -290,9 +290,9 @@ For example, :nvi will map to (list 'normal 'visual 'insert). See
|
|||
(:desc
|
||||
(setq desc (pop rest)))
|
||||
(:map
|
||||
(doom--map-set :keymaps `(quote ,(doom-enlist (pop rest)))))
|
||||
(doom--map-set :keymaps `(quote ,(ensure-list (pop rest)))))
|
||||
(:mode
|
||||
(push (cl-loop for m in (doom-enlist (pop rest))
|
||||
(push (cl-loop for m in (ensure-list (pop rest))
|
||||
collect (intern (concat (symbol-name m) "-map")))
|
||||
rest)
|
||||
(push :map rest))
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
If a mode is quoted, it is left as is. If the entire HOOKS list is quoted, the
|
||||
list is returned as-is."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(let ((hook-list (doom-enlist (doom-unquote hooks))))
|
||||
(let ((hook-list (ensure-list (doom-unquote hooks))))
|
||||
(if (eq (car-safe hooks) 'quote)
|
||||
hook-list
|
||||
(cl-loop for hook in hook-list
|
||||
|
@ -53,11 +53,6 @@ list is returned as-is."
|
|||
(setq exp (cadr exp)))
|
||||
exp)
|
||||
|
||||
(defun doom-enlist (exp)
|
||||
"Return EXP wrapped in a list, or as-is if already a list."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(if (proper-list-p exp) exp (list exp)))
|
||||
|
||||
(defun doom-keyword-intern (str)
|
||||
"Converts STR (a string) into a keyword (`keywordp')."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
|
@ -760,7 +755,7 @@ DOCSTRING and BODY are as in `defun'.
|
|||
(setq docstring nil))
|
||||
(let (where-alist)
|
||||
(while (keywordp (car body))
|
||||
(push `(cons ,(pop body) (doom-enlist ,(pop body)))
|
||||
(push `(cons ,(pop body) (ensure-list ,(pop body)))
|
||||
where-alist))
|
||||
`(progn
|
||||
(defun ,symbol ,arglist ,docstring ,@body)
|
||||
|
@ -780,7 +775,7 @@ testing advice (when combined with `rotate-text').
|
|||
(unless (stringp docstring)
|
||||
(push docstring body))
|
||||
(while (keywordp (car body))
|
||||
(push `(cons ,(pop body) (doom-enlist ,(pop body)))
|
||||
(push `(cons ,(pop body) (ensure-list ,(pop body)))
|
||||
where-alist))
|
||||
`(dolist (targets (list ,@(nreverse where-alist)))
|
||||
(dolist (target (cdr targets))
|
||||
|
|
|
@ -140,7 +140,7 @@ uses a straight or package.el command directly).")
|
|||
(print! (start "Installing straight..."))
|
||||
(print-group!
|
||||
(cl-destructuring-bind (depth . options)
|
||||
(doom-enlist straight-vc-git-default-clone-depth)
|
||||
(ensure-list straight-vc-git-default-clone-depth)
|
||||
(let ((branch-switch (if (memq 'single-branch options)
|
||||
"--single-branch"
|
||||
"--no-single-branch")))
|
||||
|
@ -341,7 +341,7 @@ non-nil."
|
|||
|
||||
(defun doom-package-is-type-p (package type)
|
||||
"TODO"
|
||||
(memq type (doom-enlist (doom-package-get package :type))))
|
||||
(memq type (ensure-list (doom-package-get package :type))))
|
||||
|
||||
(defun doom-package-in-module-p (package category &optional module)
|
||||
"Return non-nil if PACKAGE was installed by the user's private config."
|
||||
|
@ -585,7 +585,7 @@ should use it!"
|
|||
(cl-loop for target in targets
|
||||
if (or (keywordp target) (listp target))
|
||||
append
|
||||
(cl-loop with (category . modules) = (doom-enlist target)
|
||||
(cl-loop with (category . modules) = (ensure-list target)
|
||||
for (name . plist) in doom-packages
|
||||
for pkg-modules = (plist-get plist :modules)
|
||||
if (and (assq category pkg-modules)
|
||||
|
|
|
@ -160,7 +160,7 @@ See `doom-real-buffer-p' for details on what that means."
|
|||
"Return a list of buffers whose `major-mode' is `eq' to MODE(S).
|
||||
|
||||
If DERIVED-P, test with `derived-mode-p', otherwise use `eq'."
|
||||
(let ((modes (doom-enlist modes)))
|
||||
(let ((modes (ensure-list modes)))
|
||||
(cl-remove-if-not (if derived-p
|
||||
(lambda (buf)
|
||||
(apply #'provided-mode-derived-p
|
||||
|
|
|
@ -101,7 +101,7 @@ The search recurses up to DEPTH and no further. DEPTH is an integer.
|
|||
|
||||
MATCH is a string regexp. Only entries that match it will be included."
|
||||
(let (result)
|
||||
(dolist (file (mapcan (doom-rpartial #'doom-glob "*") (doom-enlist paths)))
|
||||
(dolist (file (mapcan (doom-rpartial #'doom-glob "*") (ensure-list paths)))
|
||||
(cond ((file-directory-p file)
|
||||
(appendq!
|
||||
result
|
||||
|
|
|
@ -111,7 +111,7 @@ selection of all minor-modes, active or not."
|
|||
"TODO"
|
||||
(require 'org)
|
||||
(let* ((default-directory doom-docs-dir)
|
||||
(org-agenda-files (mapcar #'expand-file-name (doom-enlist files)))
|
||||
(org-agenda-files (mapcar #'expand-file-name (ensure-list files)))
|
||||
(depth (if (integerp depth) depth))
|
||||
(mindepth (if (integerp mindepth) mindepth))
|
||||
(org-inhibit-startup t))
|
||||
|
|
|
@ -316,7 +316,7 @@ editorconfig or dtrt-indent installed."
|
|||
(editorconfig-set-indentation nil width)))
|
||||
((require 'dtrt-indent nil t)
|
||||
(when-let (vars (nth 2 (assq major-mode dtrt-indent-hook-mapping-list)))
|
||||
(dolist (var (doom-enlist vars))
|
||||
(dolist (var (ensure-list vars))
|
||||
(doom-log "Updated %s = %d" var width)
|
||||
(set var width)))))
|
||||
(message "Changed indentation to %d" width))
|
||||
|
|
|
@ -28,7 +28,7 @@ all themes. It will apply to all themes once they are loaded."
|
|||
`(progn
|
||||
(defun ,fn ()
|
||||
(let (custom--inhibit-theme-enable)
|
||||
(dolist (theme (doom-enlist (or ,theme 'user)))
|
||||
(dolist (theme (ensure-list (or ,theme 'user)))
|
||||
(when (or (eq theme 'user)
|
||||
(custom-theme-enabled-p theme))
|
||||
(apply #'custom-theme-set-faces theme
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue