From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Misery with undo. Help, please! Date: Tue, 21 Oct 2008 20:34:45 +0000 Message-ID: <20081021203445.GA12051@muc.de> References: <20081020190626.GA3558@muc.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1224620806 27619 80.91.229.12 (21 Oct 2008 20:26:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 21 Oct 2008 20:26:46 +0000 (UTC) Cc: Richard Stallman , emacs-devel@gnu.org To: Andreas Schwab Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 21 22:27:47 2008 connect(): Connection refused 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 1KsNpS-00026g-7A for ged-emacs-devel@m.gmane.org; Tue, 21 Oct 2008 22:27:46 +0200 Original-Received: from localhost ([127.0.0.1]:33064 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KsNoM-0001MN-4b for ged-emacs-devel@m.gmane.org; Tue, 21 Oct 2008 16:26:38 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KsNoH-0001MA-3M for emacs-devel@gnu.org; Tue, 21 Oct 2008 16:26:33 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KsNoB-0001Ly-QX for emacs-devel@gnu.org; Tue, 21 Oct 2008 16:26:31 -0400 Original-Received: from [199.232.76.173] (port=38559 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KsNoB-0001Lv-LM for emacs-devel@gnu.org; Tue, 21 Oct 2008 16:26:27 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:4474 helo=mail.muc.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KsNo9-0002NC-Nd for emacs-devel@gnu.org; Tue, 21 Oct 2008 16:26:27 -0400 Original-Received: (qmail 34789 invoked by uid 3782); 21 Oct 2008 20:25:16 -0000 Original-Received: from acm.muc.de (pD9E52C09.dip.t-dialin.net [217.229.44.9]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Tue, 21 Oct 2008 22:25:14 +0200 Original-Received: (qmail 12609 invoked by uid 1000); 21 Oct 2008 20:34:46 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) X-Primary-Address: acm@muc.de X-detected-operating-system: by monty-python.gnu.org: FreeBSD 4.6-4.9 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:104781 Archived-At: Hi, Andreas! On Mon, Oct 20, 2008 at 11:49:23PM +0200, Andreas Schwab wrote: > Alan Mackenzie writes: > > [*] Actually, it inserts an extra, spurious, nil too, or I've badly > > misunderstood something. This seems to be a bug in the macro `push'. > No, it isn't. The command loop automatically inserts an undo boundary. > You should use ielm for your experiments. Ah, thanks! How come I didn't know about ielm? I understand what's been happening, now. While primitive-undo is busily pulling stuff off pending-undo-list, it's piling stuff back onto buffer-undo-list. That's not obvious from looking at the source code. The problem, with a buffer-undo-list of (nil 6 nil ......) is that primitive-undo piles nothing onto it, merely moving point to 6. buffer-undo-list thus remains unaltered after C-_. This is a bug. There seem two alternative ways to fix this: (i) In the Elisp manual declare a buffer-undo-list of this form as malformed, and not to be passed to `undo'. (ii) In `undo', check for (not (car buffer-undo-list)), and strip off the initial nil from b-u-l. I think (ii) is better. What do others think? > Andreas. -- Alan Mackenzie (Nuremberg, Germany).