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
|
@ -174,7 +174,7 @@ the word at point should be spell checked. For example:
|
|||
"Return t if point is on a word that should be spell checked.
|
||||
|
||||
Return nil if on a link url, markup, html, or references."
|
||||
(let ((faces (doom-enlist (get-text-property (point) 'face))))
|
||||
(let ((faces (ensure-list (get-text-property (point) 'face))))
|
||||
(or (and (memq 'font-lock-comment-face faces)
|
||||
(memq 'markdown-code-face faces))
|
||||
(not (cl-loop with unsafe-faces = '(markdown-reference-face
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
(defun set-flyspell-predicate! (modes predicate)
|
||||
"TODO"
|
||||
(declare (indent defun))
|
||||
(dolist (mode (doom-enlist modes) +spell--flyspell-predicate-alist)
|
||||
(dolist (mode (ensure-list modes) +spell--flyspell-predicate-alist)
|
||||
(add-to-list '+spell--flyspell-predicate-alist (cons mode predicate))))
|
||||
|
||||
;;;###autoload
|
||||
|
|
|
@ -30,7 +30,7 @@ Examples:
|
|||
|
||||
(set-company-backend! 'sh-mode nil) ; unsets backends for sh-mode"
|
||||
(declare (indent defun))
|
||||
(dolist (mode (doom-enlist modes))
|
||||
(dolist (mode (ensure-list modes))
|
||||
(if (null (car backends))
|
||||
(setq +company-backend-alist
|
||||
(delq (assq mode +company-backend-alist)
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
(declare (indent defun))
|
||||
(after! evil
|
||||
(if (listp modes)
|
||||
(dolist (mode (doom-enlist modes))
|
||||
(dolist (mode (ensure-list modes))
|
||||
(evil-set-initial-state mode state))
|
||||
(evil-set-initial-state modes state))))
|
||||
|
||||
|
|
|
@ -76,9 +76,9 @@
|
|||
(when (and unset (not (gethash name format-all--format-table)))
|
||||
(error "'%s' formatter does not exist to be unset" name))
|
||||
(puthash name function format-all--format-table)
|
||||
(dolist (mode (doom-enlist modes))
|
||||
(dolist (mode (ensure-list modes))
|
||||
(cl-destructuring-bind (m &optional probe)
|
||||
(doom-enlist mode)
|
||||
(ensure-list mode)
|
||||
(if unset
|
||||
(puthash m (assq-delete-all name (gethash key format-all-mode-table))
|
||||
format-all-mode-table)
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
"Declare :symbols, :words or :patterns (all lists of strings) that
|
||||
`rotate-text' will cycle through."
|
||||
(declare (indent defun))
|
||||
(dolist (mode (doom-enlist modes))
|
||||
(dolist (mode (ensure-list modes))
|
||||
(let ((fn-name (intern (format "+rotate-text-init-%s-h" mode))))
|
||||
(fset fn-name
|
||||
(lambda ()
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
(defun set-yas-minor-mode! (modes)
|
||||
"Register minor MODES (one mode symbol or a list of them) with yasnippet so it
|
||||
can have its own snippets category, if the folder exists."
|
||||
(dolist (mode (doom-enlist modes))
|
||||
(dolist (mode (ensure-list modes))
|
||||
(let ((fn (intern (format "+snippets-register-%s-h" mode))))
|
||||
(fset fn (lambda () (yas-activate-extra-mode mode)))
|
||||
(add-hook (intern (format "%s-hook" mode)) fn))))
|
||||
|
|
|
@ -9,7 +9,7 @@ Enables `electric-indent-local-mode' in MODES.
|
|||
|
||||
\(fn MODES &key WORDS CHARS)"
|
||||
(declare (indent defun))
|
||||
(dolist (mode (doom-enlist modes))
|
||||
(dolist (mode (ensure-list modes))
|
||||
(let ((hook (intern (format "%s-hook" mode)))
|
||||
(fn (intern (format "+electric--init-%s-h" mode))))
|
||||
(cond ((null (car-safe plist))
|
||||
|
|
|
@ -26,7 +26,7 @@ exist, and `org-link' otherwise."
|
|||
(apply #'org-link-set-parameters
|
||||
key
|
||||
:complete (lambda ()
|
||||
(if requires (mapc #'require (doom-enlist requires)))
|
||||
(if requires (mapc #'require (ensure-list requires)))
|
||||
(+org--relative-path (+org--read-link-path key (funcall dir-fn))
|
||||
(funcall dir-fn)))
|
||||
:follow (lambda (link)
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
:defer t
|
||||
:config
|
||||
(setq org-cite-global-bibliography
|
||||
(doom-enlist
|
||||
(ensure-list
|
||||
(or (bound-and-true-p citar-bibliography)
|
||||
(bound-and-true-p bibtex-completion-bibliography)))
|
||||
;; Setup export processor; default csl/citeproc-el, with biblatex for
|
||||
|
|
|
@ -119,9 +119,9 @@
|
|||
(pcase-dolist (`((,category . ,modules) :after ,after :require ,libs)
|
||||
+debugger--dap-alist)
|
||||
(when (doom-module-p category (car modules) (cadr modules))
|
||||
(dolist (lib (doom-enlist after))
|
||||
(dolist (lib (ensure-list after))
|
||||
(with-eval-after-load lib
|
||||
(mapc #'require (doom-enlist libs))))))
|
||||
(mapc #'require (ensure-list libs))))))
|
||||
|
||||
(dap-mode 1)
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ recognized:
|
|||
Defaults to `+eval/region', which will run the :send-region specified function
|
||||
or `+eval/send-region-to-repl'."
|
||||
(declare (indent defun))
|
||||
(dolist (mode (doom-enlist modes))
|
||||
(dolist (mode (ensure-list modes))
|
||||
(setf (alist-get mode +eval-repls)
|
||||
(cons command plist))))
|
||||
|
||||
|
@ -59,7 +59,7 @@ MODES can be list of major mode symbols, or a single one.
|
|||
4. If MODE is not a string and COMMANd is a symbol, add it to
|
||||
`+eval-runners', which is used by `+eval/region'."
|
||||
(declare (indent defun))
|
||||
(dolist (mode (doom-enlist modes))
|
||||
(dolist (mode (ensure-list modes))
|
||||
(cond ((symbolp command)
|
||||
(push (cons mode command) +eval-runners))
|
||||
((stringp command)
|
||||
|
|
|
@ -27,7 +27,7 @@ Example:
|
|||
Used by `+lookup/in-docsets' and `+lookup/documentation'."
|
||||
(declare (indent defun))
|
||||
(let ((action (if (keywordp (car docsets)) (pop docsets))))
|
||||
(dolist (mode (doom-enlist modes))
|
||||
(dolist (mode (ensure-list modes))
|
||||
(let ((hook (intern (format "%s-hook" mode)))
|
||||
(fn (intern (format "+lookup-init--%s-%s" (or action "set") mode))))
|
||||
(if (null docsets)
|
||||
|
|
|
@ -66,7 +66,7 @@ This can be passed nil as its second argument to unset handlers for MODES. e.g.
|
|||
|
||||
\(fn MODES &key DEFINITION IMPLEMENTATIONS TYPE-DEFINITION REFERENCES DOCUMENTATION FILE XREF-BACKEND ASYNC)"
|
||||
(declare (indent defun))
|
||||
(dolist (mode (doom-enlist modes))
|
||||
(dolist (mode (ensure-list modes))
|
||||
(let ((hook (intern (format "%s-hook" mode)))
|
||||
(fn (intern (format "+lookup--init-%s-handlers-h" mode))))
|
||||
(if (null (car plist))
|
||||
|
@ -106,7 +106,7 @@ This can be passed nil as its second argument to unset handlers for MODES. e.g.
|
|||
(defun +lookup--set-handler (spec functions-var &optional async enable)
|
||||
(when spec
|
||||
(cl-destructuring-bind (fn . plist)
|
||||
(doom-enlist spec)
|
||||
(ensure-list spec)
|
||||
(if (not enable)
|
||||
(remove-hook functions-var fn 'local)
|
||||
(put fn '+lookup-async (or (plist-get plist :async) async))
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
single one. If a list, the first field found will be returned. Will error out
|
||||
otherwise, unless NOERROR is non-nill."
|
||||
(if-let* ((data (if (listp entry) entry (+pass-get-entry entry))))
|
||||
(cl-loop for key in (doom-enlist fields)
|
||||
(cl-loop for key in (ensure-list fields)
|
||||
when (assoc key data)
|
||||
return (cdr it))
|
||||
(unless noerror
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
'(((lambda (limit)
|
||||
(let (case-fold-search)
|
||||
(and (re-search-forward hl-todo-regexp limit t)
|
||||
(memq 'font-lock-comment-face (doom-enlist (get-text-property (point) 'face))))))
|
||||
(memq 'font-lock-comment-face (ensure-list (get-text-property (point) 'face))))))
|
||||
(1 (hl-todo-get-face) t t))))
|
||||
(when hl-todo-mode
|
||||
(hl-todo-mode -1)
|
||||
|
|
|
@ -33,7 +33,7 @@ Pretty symbols can be unset for emacs-lisp-mode with:
|
|||
(set-ligatures! 'emacs-lisp-mode nil)"
|
||||
(declare (indent defun))
|
||||
(if (null (car-safe plist))
|
||||
(dolist (mode (doom-enlist modes))
|
||||
(dolist (mode (ensure-list modes))
|
||||
(delq! mode +ligatures-extra-alist 'assq))
|
||||
(let (results)
|
||||
(while plist
|
||||
|
@ -42,7 +42,7 @@ Pretty symbols can be unset for emacs-lisp-mode with:
|
|||
(prependq! results (pop plist))
|
||||
(when-let (char (plist-get +ligatures-extra-symbols key))
|
||||
(push (cons (pop plist) char) results)))))
|
||||
(dolist (mode (doom-enlist modes))
|
||||
(dolist (mode (ensure-list modes))
|
||||
(setf (alist-get mode +ligatures-extra-alist)
|
||||
(if-let (old-results (alist-get mode +ligatures-extra-alist))
|
||||
(dolist (cell results old-results)
|
||||
|
|
|
@ -143,7 +143,7 @@ If DEFAULT is non-nil, apply to all future buffers. Modelines are defined with
|
|||
"Set the modeline to NAME on HOOKS.
|
||||
See `def-modeline!' on how modelines are defined."
|
||||
(let ((fn (intern (format "+modeline-set-%s-format-h" name))))
|
||||
(dolist (hook (doom-enlist hooks))
|
||||
(dolist (hook (ensure-list hooks))
|
||||
(when after-init-time
|
||||
(dolist (name (mapcar #'car +modeline-format-alist))
|
||||
(remove-hook hook (intern (format "+modeline-set-%s-format-h" name)))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue