about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--lisp/acdw.el16
1 files changed, 11 insertions, 5 deletions
diff --git a/lisp/acdw.el b/lisp/acdw.el index e47770b..ac17e46 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el
@@ -99,14 +99,20 @@ If body executes without errors, MESSAGE...Done will be displayed."
99By default, act on all buffers. 99By default, act on all buffers.
100 100
101Both PREDICATE and FUNC are called with no arguments, but within 101Both PREDICATE and FUNC are called with no arguments, but within
102a `with-current-buffer' form on the currently-active buffer." 102a `with-current-buffer' form on the currently-active buffer.
103
104As a special case, if PREDICATE is a list, it will be interpreted
105as a list of major modes. In this case, FUNC will only be called
106on buffers derived from one of the modes in PREDICATE."
103 (let ((pred (or predicate t))) 107 (let ((pred (or predicate t)))
104 (dolist (buf (buffer-list)) 108 (dolist (buf (buffer-list))
105 (with-current-buffer buf 109 (with-current-buffer buf
106 (when (if (or (eq (car-safe pred) 'closure) 110 (when (cond ((or (eq (car-safe pred) 'closure)
107 (fboundp pred)) 111 (fboundp pred))
108 (funcall pred) 112 (funcall pred))
109 pred) 113 ((listp pred)
114 (apply #'derived-mode-p pred))
115 (t pred))
110 (funcall func)))))) 116 (funcall func))))))
111 117
112;; https://github.com/cstby/emacs.d/blob/main/init.el#L67 118;; https://github.com/cstby/emacs.d/blob/main/init.el#L67