Refactor after! macro

KISS
This commit is contained in:
Henrik Lissner 2018-06-27 22:46:49 +02:00
parent 5a7c8803d9
commit 07d37f97fb
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -253,21 +253,18 @@ compilation. This will no-op on features that have been disabled by the user."
(load next :no-message :no-error))))) (load next :no-message :no-error)))))
#'progn #'progn
#'with-no-warnings) #'with-no-warnings)
(cond ((symbolp targets) (if (symbolp targets)
`(with-eval-after-load ',targets `(with-eval-after-load ',targets ,@body)
,@body)) (pcase (car-safe targets)
((and (consp targets) ((or :or :any)
(memq (car targets) '(:or :any))) (macroexp-progn
`(progn (cl-loop for next in (cdr targets)
,@(cl-loop for next in (cdr targets)
collect `(after! ,next ,@body)))) collect `(after! ,next ,@body))))
((and (consp targets) ((or :and :all)
(memq (car targets) '(:and :all)))
(dolist (next (cdr targets)) (dolist (next (cdr targets))
(setq body `((after! ,next ,@body)))) (setq body `((after! ,next ,@body))))
(car body)) (car body))
((listp targets) (_ `(after! (:and ,@targets) ,@body)))))))
`(after! (:all ,@targets) ,@body))))))
(defmacro quiet! (&rest forms) (defmacro quiet! (&rest forms)
"Run FORMS without making any output." "Run FORMS without making any output."