unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Curious behavior in find-alternate-file.
@ 2009-09-04 22:00 Karl Fogel
  2009-09-05  7:03 ` Andreas Schwab
  2009-09-08 16:10 ` Stefan Monnier
  0 siblings, 2 replies; 4+ messages in thread
From: Karl Fogel @ 2009-09-04 22:00 UTC (permalink / raw)
  To: emacs-devel

While debugging emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=4061,
I ran across a curious behavior in files.el:`find-alternate-file':

  (when (and (buffer-modified-p) (buffer-file-name))
    (if (yes-or-no-p (format "Buffer %s is modified; kill anyway? "
			     (buffer-name)))
	(unless (yes-or-no-p "Kill and replace the buffer without saving it? ")
	  (error "Aborted"))
      (save-buffer)))

IOW, the user is prompted "Buffer foo is modified; kill anyway? ", and
if she answers "no", the buffer is... saved and then killed!

That's not quite the behavior one would expect, given the prompt.  And
it's different from how regular kill-buffer (C-x k) behaves.  In regular
kill-buffer, if the buffer is modified and is visiting a file, then
you're prompted with the same question as above, but if you answer "no"
the kill is canceled and you're left sitting in the original buffer.

Here is my proposed behavior:

  "Buffer foo is modified; save before killing and replacing? "
     yes ==> save it and proceed to end
     no  ==> "Kill and replace the buffer without saving it? "
               yes ==> kill it and proceed to end
               no  ==> abort

Any objections if I make it so?

-Karl




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-09-08 21:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-04 22:00 Curious behavior in find-alternate-file Karl Fogel
2009-09-05  7:03 ` Andreas Schwab
2009-09-08 16:10 ` Stefan Monnier
2009-09-08 21:43   ` Karl Fogel

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).