Refactor doom-resolve-hooks

This commit is contained in:
Henrik Lissner 2017-06-24 16:20:22 +02:00
parent 84f4fdf9e7
commit 779ae60454
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -40,16 +40,13 @@
(t paths))) (t paths)))
(defun doom--resolve-hooks (hooks) (defun doom--resolve-hooks (hooks)
(let ((quoted-p (eq (car-safe hooks) 'quote))) (cl-loop with quoted-p = (eq (car-safe hooks) 'quote)
(when quoted-p for hook in (doom-enlist (doom-unquote hooks))
(setq hooks (cadr hooks)))
(cl-loop with hooks = (if (listp hooks) hooks (list hooks))
for hook in hooks
if (eq (car-safe hook) 'quote) if (eq (car-safe hook) 'quote)
collect (cadr hook) collect (cadr hook)
else if quoted-p else if quoted-p
collect hook collect hook
else collect (intern (format "%s-hook" (symbol-name hook)))))) else collect (intern (format "%s-hook" (symbol-name hook)))))
(defun doom-unquote (exp) (defun doom-unquote (exp)
"Return EXP unquoted." "Return EXP unquoted."