aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier1999-12-07 06:31:32 +0000
committerStefan Monnier1999-12-07 06:31:32 +0000
commit707ad06002b6d134339b1df083fad19ba274d41d (patch)
tree426b9ba0b8a43d924bc7a5e830106b558bd1584c
parenta1eb02bddb07ce904f803c8b6fa2c1282e98938e (diff)
downloademacs-707ad06002b6d134339b1df083fad19ba274d41d.tar.gz
emacs-707ad06002b6d134339b1df083fad19ba274d41d.zip
(save-some-buffers): Turn EXITING into the more general
PRED argument to allow specifying a subset of buffers.
-rw-r--r--lisp/files.el13
1 files changed, 9 insertions, 4 deletions
diff --git a/lisp/files.el b/lisp/files.el
index d92313eaec3..44baf22f8bd 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2517,11 +2517,14 @@ After saving the buffer, this function runs `after-save-hook'."
2517 buffer-file-name nil t buffer-file-truename))) 2517 buffer-file-name nil t buffer-file-truename)))
2518 setmodes)) 2518 setmodes))
2519 2519
2520(defun save-some-buffers (&optional arg exiting) 2520(defun save-some-buffers (&optional arg pred)
2521 "Save some modified file-visiting buffers. Asks user about each one. 2521 "Save some modified file-visiting buffers. Asks user about each one.
2522Optional argument (the prefix) non-nil means save all with no questions. 2522Optional argument (the prefix) non-nil means save all with no questions.
2523Optional second argument EXITING means ask about certain non-file buffers 2523Optional second argument PRED determines which buffers are considered:
2524 as well as about file buffers." 2524If PRED is nil, all the file-visiting buffers are considered.
2525If PRED is t, then certain non-file buffers will also be considered.
2526If PRED is a zero-argument function, it indicates for each buffer whether
2527 to consider it or not."
2525 (interactive "P") 2528 (interactive "P")
2526 (save-window-excursion 2529 (save-window-excursion
2527 (let* ((queried nil) 2530 (let* ((queried nil)
@@ -2533,10 +2536,12 @@ Optional second argument EXITING means ask about certain non-file buffers
2533 (not (buffer-base-buffer buffer)) 2536 (not (buffer-base-buffer buffer))
2534 (or 2537 (or
2535 (buffer-file-name buffer) 2538 (buffer-file-name buffer)
2536 (and exiting 2539 (and pred
2537 (progn 2540 (progn
2538 (set-buffer buffer) 2541 (set-buffer buffer)
2539 (and buffer-offer-save (> (buffer-size) 0))))) 2542 (and buffer-offer-save (> (buffer-size) 0)))))
2543 (or (not (functionp pred))
2544 (with-current-buffer buffer (funcall pred)))
2540 (if arg 2545 (if arg
2541 t 2546 t
2542 (setq queried t) 2547 (setq queried t)