Allow passing a list of modes to `+mapc-some-buffers'
Due to the way this is written, I can't pass one mode by itself---it must be a list.
This commit is contained in:
parent
a6341764f3
commit
8360e66d11
16
lisp/acdw.el
16
lisp/acdw.el
|
@ -99,14 +99,20 @@ If body executes without errors, MESSAGE...Done will be displayed."
|
|||
By default, act on all buffers.
|
||||
|
||||
Both PREDICATE and FUNC are called with no arguments, but within
|
||||
a `with-current-buffer' form on the currently-active buffer."
|
||||
a `with-current-buffer' form on the currently-active buffer.
|
||||
|
||||
As a special case, if PREDICATE is a list, it will be interpreted
|
||||
as a list of major modes. In this case, FUNC will only be called
|
||||
on buffers derived from one of the modes in PREDICATE."
|
||||
(let ((pred (or predicate t)))
|
||||
(dolist (buf (buffer-list))
|
||||
(with-current-buffer buf
|
||||
(when (if (or (eq (car-safe pred) 'closure)
|
||||
(fboundp pred))
|
||||
(funcall pred)
|
||||
pred)
|
||||
(when (cond ((or (eq (car-safe pred) 'closure)
|
||||
(fboundp pred))
|
||||
(funcall pred))
|
||||
((listp pred)
|
||||
(apply #'derived-mode-p pred))
|
||||
(t pred))
|
||||
(funcall func))))))
|
||||
|
||||
;; https://github.com/cstby/emacs.d/blob/main/init.el#L67
|
||||
|
|
Loading…
Reference in New Issue