diff options
author | Case Duckworth | 2021-08-14 12:40:52 -0500 |
---|---|---|
committer | Case Duckworth | 2021-08-14 12:40:52 -0500 |
commit | 4b3ebd99a0f0a3ea95e2d60c63d8d6f9273922e0 (patch) | |
tree | 453619319913fdadb9de9d40c015b543972b1dbd /lisp | |
parent | Use `unfill' package and delete `kill-ring-save-unfilled' (diff) | |
download | emacs-4b3ebd99a0f0a3ea95e2d60c63d8d6f9273922e0.tar.gz emacs-4b3ebd99a0f0a3ea95e2d60c63d8d6f9273922e0.zip |
Implement `with-eval-after-loads' macro
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/acdw.el | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lisp/acdw.el b/lisp/acdw.el index 4c17bcb..2aa6c1f 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el | |||
@@ -108,6 +108,22 @@ is unfocused." | |||
108 | ,@body) | 108 | ,@body) |
109 | (message "%s... Done." ,message))) | 109 | (message "%s... Done." ,message))) |
110 | 110 | ||
111 | (defmacro with-eval-after-loads (files &rest body) | ||
112 | "Execute BODY after FILES are loaded. | ||
113 | This macro simplifies `with-eval-after-load' for multiple nested | ||
114 | features." | ||
115 | (declare (indent 1) (debug (form def-body))) | ||
116 | (waterfall-list 'with-eval-after-load files body)) | ||
117 | |||
118 | (defun waterfall-list (car list rest) | ||
119 | "Cons CAR with each element in LIST in a waterfall fashion, end with REST. | ||
120 | For use with the `with-eval-after-loads' function." | ||
121 | (cond ((atom list) `(,car ',list ,@rest)) | ||
122 | ((= 1 (length list)) `(,car ',(car list) ,@rest)) | ||
123 | (t | ||
124 | `(,car ',(car list) | ||
125 | ,(waterfall-list car (cdr list) rest))))) | ||
126 | |||
111 | 127 | ||
112 | ;;; Comment-or-uncomment-sexp | 128 | ;;; Comment-or-uncomment-sexp |
113 | ;; from https://endlessparentheses.com/a-comment-or-uncomment-sexp-command.html | 129 | ;; from https://endlessparentheses.com/a-comment-or-uncomment-sexp-command.html |