]> git.eshelyaron.com Git - emacs.git/commitdiff
(save-some-buffers): Turn EXITING into the more general
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 7 Dec 1999 06:31:32 +0000 (06:31 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 7 Dec 1999 06:31:32 +0000 (06:31 +0000)
PRED argument to allow specifying a subset of buffers.

lisp/files.el

index d92313eaec3e54016814ca15599378f11e09d40d..44baf22f8bd31caafd5aeb72d254f16751df21a5 100644 (file)
@@ -2517,11 +2517,14 @@ After saving the buffer, this function runs `after-save-hook'."
                      buffer-file-name nil t buffer-file-truename)))
     setmodes))
 
-(defun save-some-buffers (&optional arg exiting)
+(defun save-some-buffers (&optional arg pred)
   "Save some modified file-visiting buffers.  Asks user about each one.
 Optional argument (the prefix) non-nil means save all with no questions.
-Optional second argument EXITING means ask about certain non-file buffers
- as well as about file buffers."
+Optional second argument PRED determines which buffers are considered:
+If PRED is nil, all the file-visiting buffers are considered.
+If PRED is t, then certain non-file buffers will also be considered.
+If PRED is a zero-argument function, it indicates for each buffer whether
+  to consider it or not."
   (interactive "P")
   (save-window-excursion
     (let* ((queried nil)
@@ -2533,10 +2536,12 @@ Optional second argument EXITING means ask about certain non-file buffers
                     (not (buffer-base-buffer buffer))
                     (or
                      (buffer-file-name buffer)
-                     (and exiting
+                     (and pred
                           (progn
                             (set-buffer buffer)
                             (and buffer-offer-save (> (buffer-size) 0)))))
+                    (or (not (functionp pred))
+                        (with-current-buffer buffer (funcall pred)))
                     (if arg
                         t
                       (setq queried t)