about summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2021-09-29 17:18:35 -0500
committerCase Duckworth2021-09-29 17:18:35 -0500
commit0763e40986ef9ccd592d33df9106fb9c8b0eee00 (patch)
tree12cb91211e4c7640233217849868d00c8e476296 /lisp
parentMove sort-setups to acdw.el (diff)
downloademacs-0763e40986ef9ccd592d33df9106fb9c8b0eee00.tar.gz
emacs-0763e40986ef9ccd592d33df9106fb9c8b0eee00.zip
Correct with-eval-after-loads
From this reddit comment:
https://old.reddit.com/r/emacs/comments/pxe9pr/need_help_writing_a_macro/hemygul/
Diffstat (limited to 'lisp')
-rw-r--r--lisp/acdw.el16
1 files changed, 12 insertions, 4 deletions
diff --git a/lisp/acdw.el b/lisp/acdw.el index 6e66838..792b9ef 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el
@@ -80,12 +80,20 @@ When not specified, ELLIPSIS defaults to '...'."
80 ,@forms)) 80 ,@forms))
81 (add-function :after after-focus-change-function #',func-name)))) 81 (add-function :after after-focus-change-function #',func-name))))
82 82
83(defmacro with-eval-after-loads (files &rest body) 83(defmacro with-eval-after-loads (features &rest body)
84 "Execute BODY after FILES are loaded. 84 "Execute BODY after FEATURES are loaded.
85This macro simplifies `with-eval-after-load' for multiple nested 85This macro simplifies `with-eval-after-load' for multiple nested
86features." 86features."
87 (declare (indent 1) (debug (form def-body))) 87 (declare (indent 1)
88 (waterfall-list 'with-eval-after-load files body)) 88 (debug (form def-body)))
89 (unless (listp features)
90 (setq features (list features)))
91 (if (null features)
92 (macroexp-progn body)
93 (let* ((this (car features))
94 (rest (cdr features)))
95 `(with-eval-after-load ',this
96 (with-eval-after-loads ,rest ,@body)))))
89 97
90(defmacro with-message (message &rest body) 98(defmacro with-message (message &rest body)
91 "Execute BODY, messaging 'MESSAGE...' before and 'MESSAGE... Done.' after." 99 "Execute BODY, messaging 'MESSAGE...' before and 'MESSAGE... Done.' after."