From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Miles Bader Newsgroups: gmane.emacs.devel Subject: Re: undo weirdness with insert-file-contents Date: Thu, 28 Feb 2008 20:01:35 +0900 Message-ID: References: <47C6856B.7080405@gmx.at> Reply-To: Miles Bader NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1204196541 28483 80.91.229.12 (28 Feb 2008 11:02:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 28 Feb 2008 11:02:21 +0000 (UTC) Cc: emacs-devel@gnu.org To: martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Feb 28 12:02:44 2008 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 1JUgXD-0002nW-Be for ged-emacs-devel@m.gmane.org; Thu, 28 Feb 2008 12:02:43 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JUgWg-0000gO-V0 for ged-emacs-devel@m.gmane.org; Thu, 28 Feb 2008 06:02:11 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JUgWL-0000TR-B9 for emacs-devel@gnu.org; Thu, 28 Feb 2008 06:01:49 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JUgWI-0000RW-3z for emacs-devel@gnu.org; Thu, 28 Feb 2008 06:01:47 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JUgWH-0000RJ-SY for emacs-devel@gnu.org; Thu, 28 Feb 2008 06:01:45 -0500 Original-Received: from tyo201.gate.nec.co.jp ([202.32.8.193]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JUgWD-0007ne-G5; Thu, 28 Feb 2008 06:01:42 -0500 Original-Received: from relay11.aps.necel.com ([10.29.19.46]) by tyo201.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id m1SB1UA4007983; Thu, 28 Feb 2008 20:01:36 +0900 (JST) Original-Received: from relay11.aps.necel.com ([10.29.19.20] [10.29.19.20]) by relay11.aps.necel.com with ESMTP; Thu, 28 Feb 2008 20:01:36 +0900 Original-Received: from dhapc248.dev.necel.com ([10.114.112.215] [10.114.112.215]) by relay11.aps.necel.com with ESMTP; Thu, 28 Feb 2008 20:01:36 +0900 Original-Received: by dhapc248.dev.necel.com (Postfix, from userid 31295) id D2D403F6; Thu, 28 Feb 2008 20:01:35 +0900 (JST) System-Type: i686-pc-linux-gnu Blat: Foop In-Reply-To: <47C6856B.7080405@gmx.at> (martin rudalics's message of "Thu, 28 Feb 2008 10:56:59 +0100") Original-Lines: 44 X-detected-kernel: by monty-python.gnu.org: Solaris 8 (1) 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:90714 Archived-At: martin rudalics writes: >> I looked at the C code for insert-file-contents, and its handling of the >> undo list looks pretty messy, it seems to be saving it and restoring >> multiple times (sometimes nested?) using multiple methods of restoring >> the old value.... > > ... which is messy because I tried to avoid that intermediate steps of the > decoding process show up in the undo-list. Please try the attached patch. That avoids the "undo disabled" effect, but the resulting undo list seems to be screwed up: hitting undo as the first thing in the resulting buffer ends up deleting a buffer range that is pretty clearly bogus (the deleted range is from the first character in the buffer to part-way through a word). Not sure what's ending up where, but here's the (head of the) message buffer as first displayed: Foo: bar Blat: Foop To: Subject: From: Miles Bader --text follows this line-- The "Foo: bar\n" was inserted by the (insert...) call inside the hook, the "Blat: Foop\n" was inserted by the call to insert-file-contents (I made it point to a file other than ~/.profile :-), and the rest inserted by message-mode (not sure whether before or after the hook was called). The value of buffer-undo-list is: (nil (10 . 21) (1 . 21) (t 0 . 0)) -Miles -- "An atheist doesn't have to be someone who thinks he has a proof that there can't be a god. He only has to be someone who believes that the evidence on the God question is at a similar level to the evidence on the werewolf question." [John McCarthy]