emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Curious behavior in find-alternate-file.


From: Karl Fogel
Subject: Curious behavior in find-alternate-file.
Date: Fri, 04 Sep 2009 18:00:24 -0400

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]