From 01df630f6bfa8939b2df53f31882e3ef9fd7dfa1 Mon Sep 17 00:00:00 2001 From: Philip K Date: Thu, 16 Jul 2020 10:03:35 +0200 Subject: [PATCH] Handle symbols in project-kill-buffers-ignores --- lisp/progmodes/project.el | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 67ce3dc7d9..811c18cb56 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -847,10 +847,11 @@ project-kill-buffers-ignores '("\\*Help\\*") "Conditions for buffers `project-kill-buffers' should not kill. Each condition is either a regular expression matching a buffer -name, or a predicate function that takes a buffer object as -argument and returns non-nil if it matches. Buffers that match -any of the conditions will not be killed." - :type '(repeat (choice regexp function)) +name, a predicate function that takes a buffer object as argument +and returns non-nil if it matches, or a symbol protecting buffers +of certain major modes. Buffers that match any of the conditions +will not be killed." + :type '(repeat (choice regexp function symbol)) :version "28.1" :package-version '(project . "0.5.0")) @@ -877,7 +878,12 @@ project-kill-buffers (lambda (c) (cond ((stringp c) (string-match-p c (buffer-name buf))) - ((functionp c) + ((and (symbolp c) + (provided-mode-derived-p + (buffer-local-value 'major-mode buf) + c))) + ((and (not (symbolp c)) + (functionp c)) (funcall c buf)))) project-kill-buffers-ignores) (push buf bufs))) -- 2.20.1