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#10047: Looking for help debugging an undo issue Date: Tue, 29 Nov 2011 15:22:10 -0500 Message-ID: References: <4EC0F2F3.5000607@orcon.net.nz> <4ED36734.5060608@orcon.net.nz> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1322598194 29319 80.91.229.12 (29 Nov 2011 20:23:14 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 29 Nov 2011 20:23:14 +0000 (UTC) Cc: 10047@debbugs.gnu.org To: Phil Sainty Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Nov 29 21:23:10 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RVUCr-0000qx-JS for geb-bug-gnu-emacs@m.gmane.org; Tue, 29 Nov 2011 21:23:09 +0100 Original-Received: from localhost ([::1]:39482 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RVUCr-00058M-51 for geb-bug-gnu-emacs@m.gmane.org; Tue, 29 Nov 2011 15:23:09 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:41751) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RVUCn-000582-UC for bug-gnu-emacs@gnu.org; Tue, 29 Nov 2011 15:23:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RVUCi-0002kE-L7 for bug-gnu-emacs@gnu.org; Tue, 29 Nov 2011 15:23:05 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44563) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RVUCi-0002kA-IQ for bug-gnu-emacs@gnu.org; Tue, 29 Nov 2011 15:23:00 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1RVUEf-00009g-LW for bug-gnu-emacs@gnu.org; Tue, 29 Nov 2011 15:25:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Nov 2011 20:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10047 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 10047-submit@debbugs.gnu.org id=B10047.1322598256535 (code B ref 10047); Tue, 29 Nov 2011 20:25:01 +0000 Original-Received: (at 10047) by debbugs.gnu.org; 29 Nov 2011 20:24:16 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RVUDw-00008Z-IB for submit@debbugs.gnu.org; Tue, 29 Nov 2011 15:24:16 -0500 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RVUDt-00008Q-KQ for 10047@debbugs.gnu.org; Tue, 29 Nov 2011 15:24:14 -0500 Original-Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id pATKMAwK004316; Tue, 29 Nov 2011 15:22:10 -0500 Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id A865EB42AC; Tue, 29 Nov 2011 15:22:10 -0500 (EST) In-Reply-To: <4ED36734.5060608@orcon.net.nz> (Phil Sainty's message of "Mon, 28 Nov 2011 23:49:24 +1300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.91 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4056=0 X-NAI-Spam-Version: 2.2.0.9286 : core <4056> : streams <706334> : uri <1018517> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 29 Nov 2011 15:25:01 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) 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:54439 Archived-At: > As it turned out, most of my code & context was irrelevant. > You should be able to reproduce the bug like this: > emacs -Q > M-: (add-hook 'post-command-hook 'align-current) RET > (until the scratch buffer message is gone) > C-/ (or otherwise undo, until it fails with the message > "No further undo information") OK, here's my analysis: 1- align-current uses several (call it M) temporary markers. 2- they all get added to the undo-list whenever you DEL (because their position is modified). 3- so after N uses of DEL, you have M * N^2 entries. In my tests, M is 10, so after deleting 50 chars, you have 10 * 2500 = 25000 "marker-update" entries in your undo-log. 4- at the beginning of GC, the log is considered too long (because of those spurious entries) and gets truncated. 5- at the end of GC, those spurious entries are removed from the log because those markers were temporary and only the undo-log still had references to them. The problem can be fixed in 2 ways, both of which are desired: - change align.el so it doesn't leave so many temporary markers around (it could use fewer markers, and it could also unset them explicitly at the end). - swap 4 and 5 (actually it was swapped in Emacs-22, so that would revert to the behavior of Emacs-21). I've installed a patch which reduces align.el's use of markers a little bit. It seems sufficient to get your test case to work, but I can't guarantee it will solve the problem in your more general case. It'd take a bit more analysis of align.el's code to figure out how to fix it further. Stefan