Function: erc-settings--buffer-match-p
erc-settings--buffer-match-p is a byte-compiled function defined in
erc-settings.el.gz.
Signature
(erc-settings--buffer-match-p CONDITION)
Documentation
Return non-nil if CONDITION matches current buffer.
Act almost like buffer-match-p, except recognize an alternate set of
property-based cons-cell conditions. Additionally, don't pass any
arguments to predicate-type conditions, and interpret CONDITION in the
current buffer, where CONDITION should be among the following:
- the symbol t, which always matches,
- the symbol nil, which never matches,
- a regular expression matched against current buffer's name,
- a predicate taking no arguments and run in the candidate buffer
- a symbol-keyed cons cell described by one the following:
id eq to current buffer's network context ID
network eq to current buffer's erc-network(var)/erc-network(fun)
target equal to current buffer's erc-target
name equal to current buffer's name
and a list of matching conditions
or a list containing at least one matching condition
not a list of a single condition that matches when negated
Source Code
;; Defined in /usr/src/emacs/lisp/erc/erc-settings.el.gz
(defun erc-settings--buffer-match-p (condition)
"Return non-nil if CONDITION matches current buffer.
Act almost like `buffer-match-p', except recognize an alternate set of
property-based cons-cell conditions. Additionally, don't pass any
arguments to predicate-type conditions, and interpret CONDITION in the
current buffer, where CONDITION should be among the following:
- the symbol t, which always matches,
- the symbol nil, which never matches,
- a regular expression matched against current buffer's name,
- a predicate taking no arguments and run in the candidate buffer
- a symbol-keyed cons cell described by one the following:
`id' `eq' to current buffer's network context ID
`network' `eq' to current buffer's `erc-network'
`target' `equal' to current buffer's `erc-target'
`name' `equal' to current buffer's name
`and' a list of matching conditions
`or' a list containing at least one matching condition
`not' a list of a single condition that matches when negated"
(pcase condition
('t t)
((pred stringp) (string-match-p condition (buffer-name)))
((pred functionp) (funcall condition))
(`(id . ,id) (and erc-networks--id
(eq (erc-networks--id-symbol erc-networks--id) id)))
(`(network . ,network) (and erc-network (eq erc-network network)))
(`(target . ,target) (equal target (erc-target)))
(`(name . ,name) (equal name (buffer-name)))
(`(not . ,cond) (not (erc-settings--buffer-match-p cond)))
(`(or . ,args) (seq-some #'erc-settings--buffer-match-p args))
(`(and . ,args) (seq-every-p #'erc-settings--buffer-match-p args))))