From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Brockman Newsgroups: gmane.emacs.devel Subject: [rant] Should reverting a buffer really discard undo history? Date: Mon, 30 May 2005 21:57:21 +0200 Message-ID: <87ll5w5vxa.fsf@wigwam.deepwood.net> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1117483117 8385 80.91.229.2 (30 May 2005 19:58:37 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 30 May 2005 19:58:37 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 30 21:58:31 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DcqO2-00087N-VF for ged-emacs-devel@m.gmane.org; Mon, 30 May 2005 21:57:23 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DcqSz-0002i3-77 for ged-emacs-devel@m.gmane.org; Mon, 30 May 2005 16:02:29 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DcqSb-0002dt-Ld for emacs-devel@gnu.org; Mon, 30 May 2005 16:02:06 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DcqSY-0002cM-Rq for emacs-devel@gnu.org; Mon, 30 May 2005 16:02:03 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DcqSY-0002bO-Mi for emacs-devel@gnu.org; Mon, 30 May 2005 16:02:02 -0400 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtp (TLS-1.0:RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1DcqQB-00029P-OW for emacs-devel@gnu.org; Mon, 30 May 2005 15:59:35 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1DcqKs-0007kV-Fe for emacs-devel@gnu.org; Mon, 30 May 2005 21:54:06 +0200 Original-Received: from c-4fb670d5.028-10-67766c2.cust.bredbandsbolaget.se ([213.112.182.79]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 30 May 2005 21:54:06 +0200 Original-Received: from daniel by c-4fb670d5.028-10-67766c2.cust.bredbandsbolaget.se with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 30 May 2005 21:54:06 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Lines: 56 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: c-4fb670d5.028-10-67766c2.cust.bredbandsbolaget.se X-Face: :&2UWGm>e24)ip~'K@iOsA&JT3JX*v@1-#L)=dUb825\Fwg#`^N!Y*g-TqdS AevzjFJe96f@V'ya8${57/T'"mTd`1o{TGYhHnVucLq!D$r2O{IN)7>.0op_Y`%r;/Q +(]`3F-t10N7NF\.Mm0q}p1:%iqTi:5]1E]rDF)R$9.!,Eu'9K':y9^U3F8UCS1M+A$ 8[[[WT^`$P[vu>P+8]aQMh9giu&fPCqLW2FSsGs User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:BaETykGG/kjoa4Xf0zI05q5sqTM= 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:37899 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:37899 Steps to reproduce: 1. C-x C-f foo RET original contents C-x C-s 2. M-! echo new contents > foo RET 3. Try to change the buffer. 4. Answer `r' to the question about really editing the buffer. 5. Note that at this point you cannot retrieve the original buffer contents by undoing. I managed to lose my ~/.emacs last night. It was all my fault, and I'm still trying to forgive myself for not keeping a recent backup. Luckily, I use Customize to tweak everything that uses `defcustom', so I was able to reproduce a lot from my running Emacs instance. Unfortunately, you cannot use Customize to, e.g., bind keys. (Has implementing this ever been considered, by the way?) Please skip the following three paragraphs unless you are interested in the details of how the accident happened. I was using a broken FTP program to upload some files to my machine (of course, I did not at the time know that the program was broken), and without my noticing it, the FTP program uploaded the two files `.emacs' and `.emacs~', overwriting the ones in my home directory. A few hours later, I'm tweaking something in a Customize buffer and hit the button ``Save for future sessions''. Emacs tells me that the file `.emacs' changed on disk, and asks me if I want to revert it. Here's where I make my fatal mistake --- I say `yes'. Yes, I did understand the question, and I did know that reverting a buffer is a potentially dangerous opreation. (If it weren't, Emacs probably wouldn't even ask me about it.) But, I reasoned, if the file had changed on disk, that must be because *I* had changed it somehow. I did not consider the possibility that a broken FTP program might have replaced the file and its backup with what amounts to garbage. Now this is a pretty unlikely scenario. But all it really takes for the equivalent to happen is that you mess up some file that you have in an Emacs buffer, and then revert that Emacs buffer. My ~/.emacs would have been saved had Emacs kept the buffer contents in undo history when reverting the file. I'd like to if there is any way to enable this, and (if so) why Emacs does not do it by default. By the way, the first thing I did following this incident was to set `version-control' to t, and curse myself for not doing so earlier. -- Daniel Brockman