From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: undo-equiv change Date: Tue, 12 Apr 2005 10:36:52 -0400 Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1113316540 7197 80.91.229.2 (12 Apr 2005 14:35:40 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 12 Apr 2005 14:35:40 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 12 16:35:39 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DLMTn-0001aF-DU for ged-emacs-devel@m.gmane.org; Tue, 12 Apr 2005 16:35:03 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DLM47-0000Ke-SF for ged-emacs-devel@m.gmane.org; Tue, 12 Apr 2005 10:08:31 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DLM3w-0000J6-PH for emacs-devel@gnu.org; Tue, 12 Apr 2005 10:08:20 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DLM3u-0000IB-Rt for emacs-devel@gnu.org; Tue, 12 Apr 2005 10:08:19 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DLM3u-0000Hg-KD for emacs-devel@gnu.org; Tue, 12 Apr 2005 10:08:18 -0400 Original-Received: from [206.47.199.164] (helo=simmts6-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DLMVj-0005Hv-IW for emacs-devel@gnu.org; Tue, 12 Apr 2005 10:37:03 -0400 Original-Received: from empanada.home ([67.68.217.126]) by simmts6-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20050412143652.ESAN1597.simmts6-srv.bellnexxia.net@empanada.home>; Tue, 12 Apr 2005 10:36:52 -0400 Original-Received: by empanada.home (Postfix, from userid 502) id 824604F28CC; Tue, 12 Apr 2005 10:36:52 -0400 (EDT) Original-To: emacs-devel@gnu.org User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (darwin) 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:35898 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:35898 Could someone explain to me what the recent change in simple.el (appended below) does? I'm especially wondering why we turned a check for `equiv' into a check for (listp equiv), thus allowing nil values through: the following code doesn't seem to make uch sense when equiv is nil. Stefan 2005-04-11 Richard M. Stallman * simple.el (undo): Record t in undo-equiv-table for the redo record made by an undo-in-region. Index: lisp/simple.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/simple.el,v retrieving revision 1.708 retrieving revision 1.709 diff -u -r1.708 -r1.709 --- lisp/simple.el 7 Apr 2005 15:15:15 -0000 1.708 +++ lisp/simple.el 11 Apr 2005 18:09:45 -0000 1.709 @@ -1279,7 +1279,9 @@ (defalias 'advertised-undo 'undo) (defconst undo-equiv-table (make-hash-table :test 'eq :weakness t) - "Table mapping redo records to the corresponding undo one.") + "Table mapping redo records to the corresponding undo one. +A redo record for undo-in-region maps to t. +A redo record for ordinary undo maps to the following (earlier) undo.") (defvar undo-in-region nil "Non-nil if `pending-undo-list' is not just a tail of `buffer-undo-list'.") @@ -1339,7 +1341,7 @@ (message (if undo-in-region (if equiv "Redo in region!" "Undo in region!") (if equiv "Redo!" "Undo!")))) - (when (and equiv undo-no-redo) + (when (and (listp equiv) undo-no-redo) ;; The equiv entry might point to another redo record if we have done ;; undo-redo-undo-redo-... so skip to the very last equiv. (while (let ((next (gethash equiv undo-equiv-table))) @@ -1350,10 +1352,13 @@ (prefix-numeric-value arg) 1)) ;; Record the fact that the just-generated undo records come from an - ;; undo operation, so we can skip them later on. + ;; undo operation--that is, they are redo records. + ;; In the ordinary case (not within a region), map the redo + ;; record to the following undos. ;; I don't know how to do that in the undo-in-region case. - (unless undo-in-region - (puthash buffer-undo-list pending-undo-list undo-equiv-table)) + (puthash buffer-undo-list + (if undo-in-region t pending-undo-list) + undo-equiv-table) ;; Don't specify a position in the undo record for the undo command. ;; Instead, undoing this should move point to where the change is. (let ((tail buffer-undo-list)