From xemacs-m  Thu Jun 19 19:52:26 1997
Received: from MIT.EDU (SOUTH-STATION-ANNEX.MIT.EDU [18.72.1.2])
	by xemacs.org (8.8.5/8.8.5) with SMTP id TAA09799
	for <xemacs-beta@xemacs.org>; Thu, 19 Jun 1997 19:52:25 -0500 (CDT)
Received: from W20-575-41.MIT.EDU by MIT.EDU with SMTP
	id AA08187; Thu, 19 Jun 97 19:54:36 EDT
Received: by w20-575-41.MIT.EDU (5.x/4.7) id AA17987; Thu, 19 Jun 1997 19:54:34 -0400
Date: Thu, 19 Jun 1997 19:54:34 -0400
Message-Id: <9706192354.AA17987@w20-575-41.MIT.EDU>
From: David Bakhash <cadet@MIT.EDU>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
To: xemacs-beta@xemacs.org
Subject: new `save-some-buffers' for files.el
X-Mailer: VM 6.31 under 20.2 XEmacs Lucid

I posted this 2 the newsgroup, but since I'm so annoyingly adamant about 
it, I'm putting it here too...

it's just a minor patch to `save-some-buffers' which lets you see the
buffers that you're being prompted to save.  It's kinda helpful since
sometimes you're not sure what was in the buffer.  Like maybe you havn't 
seen your *scratch* buffer for a while, but you might have something
interesting in there that's worth saving.  so now you'll have a better
idea.  It really can't hurt.

dave
............

(defun save-some-buffers (&optional arg exiting)
  "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."
  (interactive "P")
  (save-excursion
    (save-window-excursion
    ;; XEmacs - do not use queried flag
    (let ((files-done
	   (map-y-or-n-p
	    (function
	     (lambda (buffer)
	       (and (buffer-modified-p buffer)
		    (not (buffer-base-buffer buffer))
		    ;; XEmacs addition:
		    (not (symbol-value-in-buffer 'save-buffers-skip buffer))
		    (or
		     (buffer-file-name buffer)
		     (and exiting
			  (progn
			    (set-buffer buffer)
			    (and buffer-offer-save (> (buffer-size) 0)))))
		    (if arg
			t
		      (switch-to-buffer buffer)
		      (delete-other-windows)
		      (if (buffer-file-name buffer)
			  (format "Save file %s? "
				  (buffer-file-name buffer))
			(format "Save buffer %s? "
				(buffer-name buffer)))))))
	    (function
	     (lambda (buffer)
	       (set-buffer buffer)
	       (condition-case ()
		   (save-buffer)
		 (error nil))))
	    (buffer-list)
	    '("buffer" "buffers" "save")
	    ;instead of this we just say "yes all", "no all", etc.
	    ;"save all the rest"
	    ;"save only this buffer" "save no more buffers")
	    ; this is rather bogus. --ben
	    ; (it makes the dialog box too big, and you get an error
	    ; "wrong type argument: framep, nil" when you hit q after
	    ; choosing the option from the dialog box)
;	    (list (list ?\C-r (lambda (buf)
;				(view-buffer buf)
;				(setq view-exit-action
;				      '(lambda (ignore)
;					 (exit-recursive-edit)))
;				(recursive-edit)
;				;; Return nil to ask about BUF again.
;				nil)
;			"display the current buffer"))
	    ))
	  (abbrevs-done
	   (and save-abbrevs abbrevs-changed
		(progn
		  (if (or arg
			  (y-or-n-p (format "Save abbrevs in %s? " abbrev-file-name)))
		      (write-abbrev-file nil))
		  ;; Don't keep bothering user if he says no.
		  (setq abbrevs-changed nil)
		  t))))
      (or (> files-done 0) abbrevs-done
	  (message "(No files need saving)"))))))


