From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: C-x C-v considered harmful Date: Sun, 5 Jul 2009 00:13:36 -0700 Message-ID: References: <19020.2798.523236.406366@rgr.rgrjr.com><72597301DECF498C8943373F597732A6@us.oracle.com><19021.23100.86775.844823@rgr.rgrjr.com><19022.27409.779079.636945@rgr.rgrjr.com> <19023.58051.10608.629206@rgr.rgrjr.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1246778036 30820 80.91.229.12 (5 Jul 2009 07:13:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 5 Jul 2009 07:13:56 +0000 (UTC) Cc: emacs-devel@gnu.org To: "'Bob Rogers'" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 05 09:13:49 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 1MNLv3-0001TL-6s for ged-emacs-devel@m.gmane.org; Sun, 05 Jul 2009 09:13:49 +0200 Original-Received: from localhost ([127.0.0.1]:35465 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MNLv2-0004Ce-GC for ged-emacs-devel@m.gmane.org; Sun, 05 Jul 2009 03:13:48 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MNLux-0004CR-8q for emacs-devel@gnu.org; Sun, 05 Jul 2009 03:13:43 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MNLus-0004CF-JZ for emacs-devel@gnu.org; Sun, 05 Jul 2009 03:13:42 -0400 Original-Received: from [199.232.76.173] (port=39031 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MNLus-0004CC-EO for emacs-devel@gnu.org; Sun, 05 Jul 2009 03:13:38 -0400 Original-Received: from mx20.gnu.org ([199.232.41.8]:46500) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MNLur-0007Xv-UM for emacs-devel@gnu.org; Sun, 05 Jul 2009 03:13:38 -0400 Original-Received: from rcsinet12.oracle.com ([148.87.113.124] helo=rgminet12.oracle.com) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MNLur-000748-AK for emacs-devel@gnu.org; Sun, 05 Jul 2009 03:13:37 -0400 Original-Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rgminet12.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id n657DEuj026803 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 5 Jul 2009 07:13:15 GMT Original-Received: from abhmt009.oracle.com (abhmt009.oracle.com [141.146.116.18]) by acsinet15.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id n657FGPO010763; Sun, 5 Jul 2009 07:15:16 GMT Original-Received: from dradamslap1 (/24.23.164.86) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 05 Jul 2009 00:13:32 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <19023.58051.10608.629206@rgr.rgrjr.com> Thread-Index: Acn8/a+dF3Kth/vzQbykpk0Zfi+osAAP4DwA X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-Source-IP: abhmt009.oracle.com [141.146.116.18] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A010204.4A50529D.001A:SCFSTAT5015188,ss=1,fgs=0 X-Detected-Operating-System: by mx20.gnu.org: GNU/Linux 2.6 (newer, 1) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) 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:112033 Archived-At: > Does `C-x k' warn you the way you would like, when you use > it in a *shell* buffer? If not, then that is the problem, > not something else. > > It does indeed kill the *shell* buffer without prompting, Then the command-behavior problem has nothing to do with `find-alternate-file', per se - any buffer-killing command will present the same problem. There remains the other problem: that of key confusion raising the risk of accidentally using some buffer-killing command. > which seems odd, given that it prompts for modified files. > I notice that this code uses the C equivalent of "(and > (buffer-modified-p) (buffer-file-name))", Donc, meme combat. > though it queries only if interactive, Yes, as I stated earlier, testing `interactive-p' should probably be part of the mix. Non-interactive use of a command that kills a buffer should not necessarily (or usually) query. It is the interactive use that we want to protect against. > so a case could be made for dropping the the "(buffer-file-name)" > for symmetry. (Not just for symmetry.) At least you and I agree about dropping `buffer-file-name' - dunno about others. I maintain, however, that the proper test is `(or buffer-read-only (buffer-modified-p))'. As I mentioned, there are some "modified" buffers that one doesn't necessarily need to be warned about losing - things like *Buffer List* and Dired. The problem here is the concept of buffer "modification". If the aim is to prevent data loss, then that aim is typically not advanced by not allowing a modified read-only buffer to be dropped without query. > But I have never had the problem of invoking "C-x k" by accident > (that I recall), so I'm not sure such a case ought to be made. Well, sure, you got stung because you use the version-control prefix, `C-x v', a lot. If you used the kmacro prefix, `C-x C-k', a lot, then `C-x k' would sting you. Any way of accidentally invoking any buffer-killing command presents the same problem. > And as you mentioned, `find-alternate-file' tests `(and > (buffer-modified-p) (buffer-file-name))'. I agree with you that the > problem you are seeing is coming from `(buffer-file-name)' > being nil, and that removing that might be an improvement. > > As far as I am concerned, removing "(buffer-file-name)" would be > sufficient. We agree, modulo my wanting to be able to drop modified read-only buffers without warning. Another way to look at that is that those buffers typically do not have undo, which is another indication that we don't expect their contents to be something we want to worry about saving. The proper test is, I think, `(or buffer-read-only (buffer-modified-p))'.