From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#16411: undo-only bugs Date: Wed, 14 May 2014 14:45:43 -0400 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1400093191 12843 80.91.229.3 (14 May 2014 18:46:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 14 May 2014 18:46:31 +0000 (UTC) Cc: 16411 <16411@debbugs.gnu.org> To: Barry OReilly Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed May 14 20:46:24 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WkeC6-00037r-Ff for geb-bug-gnu-emacs@m.gmane.org; Wed, 14 May 2014 20:46:22 +0200 Original-Received: from localhost ([::1]:53719 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkeC6-0002Ea-40 for geb-bug-gnu-emacs@m.gmane.org; Wed, 14 May 2014 14:46:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50705) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkeBv-00025m-Cc for bug-gnu-emacs@gnu.org; Wed, 14 May 2014 14:46:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WkeBn-0002NF-Rg for bug-gnu-emacs@gnu.org; Wed, 14 May 2014 14:46:11 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:41714) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkeBn-0002NA-IJ for bug-gnu-emacs@gnu.org; Wed, 14 May 2014 14:46:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WkeBn-0000ZO-0m for bug-gnu-emacs@gnu.org; Wed, 14 May 2014 14:46:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 14 May 2014 18:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16411 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 16411-submit@debbugs.gnu.org id=B16411.14000931492158 (code B ref 16411); Wed, 14 May 2014 18:46:02 +0000 Original-Received: (at 16411) by debbugs.gnu.org; 14 May 2014 18:45:49 +0000 Original-Received: from localhost ([127.0.0.1]:34778 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WkeBY-0000Yk-Gg for submit@debbugs.gnu.org; Wed, 14 May 2014 14:45:48 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:36844) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WkeBV-0000YX-GS for 16411@debbugs.gnu.org; Wed, 14 May 2014 14:45:47 -0400 Original-Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id s4EIjir5006072; Wed, 14 May 2014 14:45:44 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id EC064601E4; Wed, 14 May 2014 14:45:43 -0400 (EDT) In-Reply-To: (Barry OReilly's message of "Tue, 13 May 2014 11:01:32 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4942=0 X-NAI-Spam-Version: 2.3.0.9378 : core <4942> : inlines <869> : streams <1182802> : uri <1756765> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:89095 Archived-At: > Item 1 is the crucial one. The undo-redo-table is somewhat like > undo-equiv-table, except that instead of mapping equal buffer states, > it maps undo elements to what they undid. I'm having trouble understanding it (I guess it's just that my mind i caught in a rut, after having come up with undo-equiv-table). > +(defvar undo-redo-table (make-hash-table :test 'eq :weakness t) > + "Hash table mapping undo elements created by an undo command to > +the undo element they undid. Specifically, the keys and values > +are eq to cons of buffer-undo-list. The hash table is weak so as > +truncated undo elements can be garbage collected.") [ Nitpick: the first line of the docstring should stand on its own. ] You talk here about "undo element", but AFAICT this actually points to "a list of undo elements" (where the first element of that list is presumably the "undo element" you mean). Please clarify. It's hard for me to really understand how this undo-redo-table would work without seeing it in use. My guess is that the "undo-only" case would skip redo entries in much the same way as undo-in-region skips "out of bounds" entries (i.e. in a fairly expensive way, adjusting all subsequent elements). Combined with the fact that undo-redo-table contains entries for every redo element rather than for every redo group, I'm slightly worried about the resource use, but I guess that since undo-in-region is fast enough, that won't be a problem. Stefan