diff options
author | Dmitry Gutov <dgutov@yandex.ru> | 2022-06-17 15:22:29 +0300 |
---|---|---|
committer | Dmitry Gutov <dgutov@yandex.ru> | 2022-06-17 15:23:01 +0300 |
commit | 4aca0d818f2d0b7dd7dc511907cc19f63758e482 (patch) | |
tree | ef98174ad098d3a537568f72331da8f1a7dcc2d7 /lisp/subr.el | |
parent | 5e567af8e0608ccd6db37d548ccb36098eda95c4 (diff) | |
download | emacs-4aca0d818f2d0b7dd7dc511907cc19f63758e482.tar.gz emacs-4aca0d818f2d0b7dd7dc511907cc19f63758e482.tar.bz2 emacs-4aca0d818f2d0b7dd7dc511907cc19f63758e482.zip |
buffer-match-p: Resolve backward compat concerns
* doc/lispref/buffers.texi (Buffer List): Document 'major-mode'
and 'derived-mode' predicates. Fix some typos.
* lisp/subr.el (buffer-match-p): Use the structure initially
pioneered by project-kill-buffer-conditions as-is (bug#54296).
* lisp/progmodes/project.el (project-kill-buffer-conditions)
(project--buffer-check): Revert the latest change.
(project--buffer-check): Add support for lambda predicates.
Diffstat (limited to 'lisp/subr.el')
-rw-r--r-- | lisp/subr.el | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index 50ae357a136..c1c9759b03d 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -6855,9 +6855,11 @@ CONDITION is either: arguments, and returns non-nil if the buffer matches, - a cons-cell, where the car describes how to interpret the cdr. The car can be one of the following: - * `major-mode': the buffer matches if the buffer's major - mode is derived from the major mode denoted by the cons-cell's - cdr + * `derived-mode': the buffer matches if the buffer's major mode + is derived from the major mode in the cons-cell's cdr. + * `major-mode': the buffer matches if the buffer's major mode + is eq to the cons-cell's cdr. Prefer using `derived-mode' + instead when both can work. * `not': the cdr is interpreted as a negation of a condition. * `and': the cdr is a list of recursive conditions, that all have to be met. @@ -6877,6 +6879,10 @@ CONDITION is either: (funcall condition buffer) (funcall condition buffer arg))) ((eq (car-safe condition) 'major-mode) + (eq + (buffer-local-value 'major-mode buffer) + (cdr condition))) + ((eq (car-safe condition) 'derived-mode) (provided-mode-derived-p (buffer-local-value 'major-mode buffer) (cdr condition))) |