From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: no-spam@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: New undo element (fun . args) Date: Wed, 02 Feb 2005 16:41:05 +0100 Message-ID: References: <87fz0jyn19.fsf-monnier+emacs@gnu.org> <87mzunvyki.fsf-monnier+emacs@gnu.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1107359262 5232 80.91.229.2 (2 Feb 2005 15:47:42 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 2 Feb 2005 15:47:42 +0000 (UTC) Cc: rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Feb 02 16:47:41 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1CwMgW-0003yr-CW for ged-emacs-devel@m.gmane.org; Wed, 02 Feb 2005 16:44:52 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1CwMtb-0001fA-Qk for ged-emacs-devel@m.gmane.org; Wed, 02 Feb 2005 10:58:23 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1CwMrv-00017q-Du for emacs-devel@gnu.org; Wed, 02 Feb 2005 10:56:39 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1CwMrt-00016v-4X for emacs-devel@gnu.org; Wed, 02 Feb 2005 10:56:38 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1CwMrs-00015d-8P for emacs-devel@gnu.org; Wed, 02 Feb 2005 10:56:36 -0500 Original-Received: from [212.88.64.25] (helo=mail-relay.sonofon.dk) by monty-python.gnu.org with smtp (Exim 4.34) id 1CwMcy-0002iI-V9 for emacs-devel@gnu.org; Wed, 02 Feb 2005 10:41:13 -0500 Original-Received: (qmail 38466 invoked from network); 2 Feb 2005 15:41:08 -0000 Original-Received: from unknown (HELO kfs-l.imdomain.dk.cua.dk) (213.83.150.2) by 0 with SMTP; 2 Feb 2005 15:41:08 -0000 Original-To: Stefan Monnier In-Reply-To: <87mzunvyki.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Wed, 02 Feb 2005 09:35:23 -0500") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux) 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 X-MailScanner-To: ged-emacs-devel@m.gmane.org Xref: main.gmane.org gmane.emacs.devel:32758 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:32758 Stefan Monnier writes: >> One of the undoable operations in SES is setting a variable. >> This doesn't relate directly to buffer text, but it might >> be associated with some region somehow. I don't know >> how this is used, and I think it is important to check. > > Most of the vars that are thus set/unset are vars of the form "B6" or "C20", > i.e. vars that hold the content of a cell. So they do have some relation > with one specific region of the buffer: the corresponding cell. So we could > just replace (apply ses-set-with-undo ,sym ,(symbol-value sym)) with (apply > START END 0 ses-set-with-undo ,sym ,(symbol-value sym)) where START and END Should be 0 START END. > are the boundaries of the cell. But since the same code is used for other > vars as well, such as vars that relate to a particular column of > the spreadsheet, it'll take a bit more effort. I've tried to make cua use the new undo machinery, but it is more complicated than I had imagined. One obstacle is this piece of code in primitive-undo (undo.c): It is slightly modified to add (apply cdr . nil) rather than (cdr . nil) to the undo list in this case: /* Make sure this produces at least one undo entry, so the test in `undo' for continuing an undo series will work right. */ if (EQ (oldlist, current_buffer->undo_list)) current_buffer->undo_list = Fcons (list3 (Qapply, Qcdr, nil), current_buffer->undo_list); I don't understand why this is necessary. The primitive-undo continues to the next undo boundary, so why is it important what is recorded "between undo boundaries" ? The problem I have with cua is that I don't record buffer changes as such, but rather a change in where the active rectangle is. It works to some extent, but as soon as undo hits one of the entries I added to the undo list, it gets stuck -- and the pending undo list seems to be stuck at that specific (apply cdr ...) entry. So somehow what I do breaks the test mentioned above. But what exactly is that test trying to differentiate. I've looked at the code in simple.el, and I simply don't get it. Any ideas...?