From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Karl Fogel Newsgroups: gmane.emacs.devel Subject: Curious behavior in find-alternate-file. Date: Fri, 04 Sep 2009 18:00:24 -0400 Message-ID: <87ws4e74lj.fsf@red-bean.com> Reply-To: Karl Fogel NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1252101649 5027 80.91.229.12 (4 Sep 2009 22:00:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 4 Sep 2009 22:00:49 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Sep 05 00:00:42 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Mjgpl-0005Qi-TI for ged-emacs-devel@m.gmane.org; Sat, 05 Sep 2009 00:00:42 +0200 Original-Received: from localhost ([127.0.0.1]:51105 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mjgpl-0005bD-Gl for ged-emacs-devel@m.gmane.org; Fri, 04 Sep 2009 18:00:41 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mjgpd-0005Ze-Pq for emacs-devel@gnu.org; Fri, 04 Sep 2009 18:00:33 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MjgpX-0005Yu-Pl for emacs-devel@gnu.org; Fri, 04 Sep 2009 18:00:32 -0400 Original-Received: from [199.232.76.173] (port=42794 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MjgpX-0005Yr-NU for emacs-devel@gnu.org; Fri, 04 Sep 2009 18:00:27 -0400 Original-Received: from sanpietro.red-bean.com ([66.146.206.141]:46660) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MjgpX-0008LS-7p for emacs-devel@gnu.org; Fri, 04 Sep 2009 18:00:27 -0400 Original-Received: from localhost ([127.0.0.1]:49233 helo=kfogel-work ident=kfogel) by sanpietro.red-bean.com with esmtp (Exim 4.69) (envelope-from ) id 1MjgpW-0001um-0a for emacs-devel@gnu.org; Fri, 04 Sep 2009 17:00:26 -0500 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:115036 Archived-At: 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