(defun buffer-match-p (condition buffer-or-name &optional arg)
"Return non-nil if BUFFER-OR-NAME matches CONDITION.
CONDITION is either:
+- the symbol t, to always match
- a regular expression, to match a buffer name,
- a predicate function that takes a buffer object and ARG as
arguments, and returns non-nil if the buffer matches,
(catch 'match
(dolist (condition conditions)
(when (cond
+ ((eq condition t))
((stringp condition)
(string-match-p condition (buffer-name buffer)))
((functionp condition)