From xemacs-m  Fri Jun 20 10:47:57 1997
Received: from MIT.EDU (PACIFIC-CARRIER-ANNEX.MIT.EDU [18.69.0.28])
	by xemacs.org (8.8.5/8.8.5) with SMTP id KAA04191
	for <xemacs-beta@xemacs.org>; Fri, 20 Jun 1997 10:47:56 -0500 (CDT)
Received: from SUNDIAL.MIT.EDU by MIT.EDU with SMTP
	id AA25516; Thu, 19 Jun 97 11:45:29 EDT
Received: by sundial.MIT.EDU (8.8.5/4.7) id LAA01797; Thu, 19 Jun 1997 11:10:06 -0400 (EDT)
Date: Thu, 19 Jun 1997 11:10:06 -0400 (EDT)
Message-Id: <199706191510.LAA01797@sundial.MIT.EDU>
From: David Bakhash <cadet@MIT.EDU>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="ArNRjFHXma"
Content-Transfer-Encoding: 7bit
To: xemacs-beta@xemacs.org
X-Mailer: VM 6.31 under 20.2 XEmacs Lucid


--ArNRjFHXma
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

hey,
	Here's my proposed modification to `save-some-buffers' in
files.el.  I don't really know how to write a patch, so my appologies
for that.  I hope people are still willing to try it out...

	The only difference is that now, as you're saving your buffers,
you see the buffer for which you are being prompted to save.  Note that
for some reason `map-y-or-n-p' didn't let me leave the minibuffer in any
sort of recursive-edit type way, so if I wasn't sure about saving a
buffer b/c I needed to see it, first, I would have to quit the
`save-some-buffers' dialog and view the buffer to make sure, and then do 
it again.  This is particulary useful when you've had XEmacs going for a 
long time and you do C-x C-c.  Now, at least you get to see the buffer
(at (point)) as you decide...


--ArNRjFHXma
Content-Type: text/plain
Content-Description: new `save-some-buffers'
Content-Disposition: inline;
	filename="save-some-buffers"
Content-Transfer-Encoding: 7bit

(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-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)")))))

--ArNRjFHXma--

