Rewrite with-eval-after-loads

This commit is contained in:
Case Duckworth 2021-09-28 19:52:09 -05:00
parent 40bcdfc60c
commit 2c82543973

View File

@ -80,12 +80,20 @@ When not specified, ELLIPSIS defaults to '...'."
,@forms))
(add-function :after after-focus-change-function #',func-name))))
(defmacro with-eval-after-loads (files &rest body)
"Execute BODY after FILES are loaded.
(defmacro with-eval-after-loads (features &rest body)
"Execute BODY after FEATURES are loaded.
This macro simplifies `with-eval-after-load' for multiple nested
features."
(declare (indent 1) (debug (form def-body)))
(waterfall-list 'with-eval-after-load files body))
(declare (indent 1)
(debug (form def-body)))
(unless (listp features)
(setq features (list features)))
(if (null features)
(macroexp-progn body)
(let* ((this (car features))
(rest (cdr features)))
`(with-eval-after-load ',this
(with-eval-after-all ,rest ,@body)))))
(defmacro with-message (message &rest body)
"Execute BODY, messaging 'MESSAGE...' before and 'MESSAGE... Done.' after."