From: Karl Fogel <kfogel@red-bean.com>
To: emacs-devel@gnu.org
Subject: Curious behavior in find-alternate-file.
Date: Fri, 04 Sep 2009 18:00:24 -0400 [thread overview]
Message-ID: <87ws4e74lj.fsf@red-bean.com> (raw)
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
next reply other threads:[~2009-09-04 22:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-04 22:00 Karl Fogel [this message]
2009-09-05 7:03 ` Curious behavior in find-alternate-file Andreas Schwab
2009-09-08 16:10 ` Stefan Monnier
2009-09-08 21:43 ` Karl Fogel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ws4e74lj.fsf@red-bean.com \
--to=kfogel@red-bean.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).