From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: undo bug? Date: Tue, 01 Apr 2008 22:53:27 +0200 Message-ID: <47F2A0C7.7030402@gmx.at> References: <47F21FEB.401@gmx.at> <47F28479.3030605@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1207097805 7767 80.91.229.12 (2 Apr 2008 00:56:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 2 Apr 2008 00:56:45 +0000 (UTC) Cc: Katsumi Yamaoka , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 02 02:57:16 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 1JgrHv-0002a2-RA for ged-emacs-devel@m.gmane.org; Wed, 02 Apr 2008 02:57:16 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JgrHJ-0003Ny-R4 for ged-emacs-devel@m.gmane.org; Tue, 01 Apr 2008 20:56:37 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JgrDo-0000S1-3I for emacs-devel@gnu.org; Tue, 01 Apr 2008 20:53:00 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JgrDm-0000Pt-72 for emacs-devel@gnu.org; Tue, 01 Apr 2008 20:52:59 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JgrDm-0000Ph-1c for emacs-devel@gnu.org; Tue, 01 Apr 2008 20:52:58 -0400 Original-Received: from mail.gmx.net ([213.165.64.20]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1JgrDk-0003V9-Sn for emacs-devel@gnu.org; Tue, 01 Apr 2008 20:52:57 -0400 Original-Received: (qmail invoked by alias); 01 Apr 2008 20:52:54 -0000 Original-Received: from 62-47-50-160.adsl.highway.telekom.at (EHLO [62.47.50.160]) [62.47.50.160] by mail.gmx.net (mp049) with SMTP; 01 Apr 2008 22:52:54 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX1+XPFBaPaWXJKC3GSiL2oZE8a4P+hV/A8tN2JISVk qpJTSYLXC6lICj User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en In-Reply-To: X-Y-GMX-Trusted: 0 X-detected-kernel: by monty-python.gnu.org: 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:94148 Archived-At: >>Couldn't we do away with undo-boundaries and always undo until the next >>recorded position of `point'? > > > In theory we could, but that may break various packages: of all the > supported undo records, the "undo-boundary" is probably the only one > that is used by external packages ;-( What I had in mind was that `undo-boundary' would simply `record-point' instead of inserting nil. > Instead the current code tries to only insert a point-record when > it's actually necessary. Sometimes. For example I use the patch below to handle the (pretty annoying) problem that when I redo an earlier insertion `point' ends up _before_ the inserted text (my `undo' binds `undo-is-redo' to `equiv' when calling `undo-more'). *** undo.c.~1.83.~ Sun Jan 20 10:33:56 2008 --- undo.c Fri Mar 7 19:38:40 2008 *************** *** 57,62 **** --- 57,66 ---- int undo_inhibit_record_point; + /* Nonzero means undo is redo. */ + + int undo_is_redo; + /* Record point as it was at beginning of this command (if necessary) and prepare the undo info for recording a change. PT is the position of point that will naturally occur as a result of the *************** *** 637,643 **** so that undoing the marker adjustments put the markers back in the right place. */ Finsert (1, &membuf); ! SET_PT (pos); } } else if (MARKERP (car) && INTEGERP (cdr)) --- 641,648 ---- so that undoing the marker adjustments put the markers back in the right place. */ Finsert (1, &membuf); ! if (! undo_is_redo) ! SET_PT (pos); } } else if (MARKERP (car) && INTEGERP (cdr)) *************** *** 735,740 **** --- 740,749 ---- DEFVAR_BOOL ("undo-inhibit-record-point", &undo_inhibit_record_point, doc: /* Non-nil means do not record `point' in `buffer-undo-list'. */); undo_inhibit_record_point = 0; + + DEFVAR_BOOL ("undo-is-redo", &undo_is_redo, + doc: /* Non-nil means undo is redo. */); + undo_is_redo = 0; } /* arch-tag: d546ee01-4aed-4ffb-bb8b-eefaae50d38a