aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Kaludercic2022-04-14 10:24:27 +0200
committerPhilip Kaludercic2022-04-15 10:06:36 +0200
commit1a3bad431d841e52a61e5f1f09b4ebe7fbbd70da (patch)
tree2856674b2e1df5d4899748175139733d2402a24c
parent59ecf25fc86081c9df05b84194c36414c225c265 (diff)
downloademacs-1a3bad431d841e52a61e5f1f09b4ebe7fbbd70da.tar.gz
emacs-1a3bad431d841e52a61e5f1f09b4ebe7fbbd70da.zip
Update project-kill-buffer-conditions to match buffer-match-p
* project.el (project-kill-buffer-conditions): Document the deprecation of the use of derived-mode (project--buffer-check): Have `major-mode' behave like `derived-mode' did previously, and issue a warning of `derived-mode' is used.
-rw-r--r--lisp/progmodes/project.el40
1 files changed, 24 insertions, 16 deletions
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index daaf86f3277..ac6aa0ced24 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1201,18 +1201,22 @@ displayed."
1201 (display-buffer-other-frame buffer-or-name)) 1201 (display-buffer-other-frame buffer-or-name))
1202 1202
1203(defcustom project-kill-buffer-conditions 1203(defcustom project-kill-buffer-conditions
1204 '(buffer-file-name ; All file-visiting buffers are included. 1204 `(buffer-file-name ; All file-visiting buffers are included.
1205 ;; Most of the temp buffers in the background: 1205 ;; Most of the temp buffers in the background:
1206 (major-mode . fundamental-mode) 1206 ,(lambda (buf)
1207 (not (eq (buffer-local-value 'major-mode buf)
1208 'fundamental-mode)))
1207 ;; non-text buffer such as xref, occur, vc, log, ... 1209 ;; non-text buffer such as xref, occur, vc, log, ...
1208 (and (derived-mode . special-mode) 1210 (and (major-mode . special-mode)
1209 (not (major-mode . help-mode))) 1211 ,(lambda (buf)
1210 (derived-mode . compilation-mode) 1212 (not (eq (buffer-local-value 'major-mode buf)
1211 (derived-mode . dired-mode) 1213 'help-mode))))
1212 (derived-mode . diff-mode) 1214 (major-mode . compilation-mode)
1213 (derived-mode . comint-mode) 1215 (major-mode . dired-mode)
1214 (derived-mode . eshell-mode) 1216 (major-mode . diff-mode)
1215 (derived-mode . change-log-mode)) 1217 (major-mode . comint-mode)
1218 (major-mode . eshell-mode)
1219 (major-mode . change-log-mode))
1216 "List of conditions to kill buffers related to a project. 1220 "List of conditions to kill buffers related to a project.
1217This list is used by `project-kill-buffers'. 1221This list is used by `project-kill-buffers'.
1218Each condition is either: 1222Each condition is either:
@@ -1222,10 +1226,11 @@ Each condition is either:
1222- a cons-cell, where the car describes how to interpret the cdr. 1226- a cons-cell, where the car describes how to interpret the cdr.
1223 The car can be one of the following: 1227 The car can be one of the following:
1224 * `major-mode': the buffer is killed if the buffer's major 1228 * `major-mode': the buffer is killed if the buffer's major
1225 mode is eq to the cons-cell's cdr
1226 * `derived-mode': the buffer is killed if the buffer's major
1227 mode is derived from the major mode denoted by the cons-cell's 1229 mode is derived from the major mode denoted by the cons-cell's
1228 cdr 1230 cdr.
1231 * `derived-mode': the buffer is killed if the buffer's major
1232 mode is eq to the cons-cell's cdr (this is deprecated and will
1233 result in a warning if used).
1229 * `not': the cdr is interpreted as a negation of a condition. 1234 * `not': the cdr is interpreted as a negation of a condition.
1230 * `and': the cdr is a list of recursive conditions, that all have 1235 * `and': the cdr is a list of recursive conditions, that all have
1231 to be met. 1236 to be met.
@@ -1285,10 +1290,13 @@ form of CONDITIONS."
1285 (string-match-p c (buffer-name buf))) 1290 (string-match-p c (buffer-name buf)))
1286 ((symbolp c) 1291 ((symbolp c)
1287 (funcall c buf)) 1292 (funcall c buf))
1288 ((eq (car-safe c) 'major-mode)
1289 (eq (buffer-local-value 'major-mode buf)
1290 (cdr c)))
1291 ((eq (car-safe c) 'derived-mode) 1293 ((eq (car-safe c) 'derived-mode)
1294 (warn "The use of `derived-mode' in \
1295`project--buffer-check' is deprecated.")
1296 (provided-mode-derived-p
1297 (buffer-local-value 'major-mode buf)
1298 (cdr c)))
1299 ((eq (car-safe c) 'major-mode)
1292 (provided-mode-derived-p 1300 (provided-mode-derived-p
1293 (buffer-local-value 'major-mode buf) 1301 (buffer-local-value 'major-mode buf)
1294 (cdr c))) 1302 (cdr c)))