From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Phil Sainty <psainty@orcon.net.nz>
Cc: 10047@debbugs.gnu.org
Subject: bug#10047: Looking for help debugging an undo issue
Date: Tue, 29 Nov 2011 15:22:10 -0500 [thread overview]
Message-ID: <jwvy5uypxqt.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <4ED36734.5060608@orcon.net.nz> (Phil Sainty's message of "Mon, 28 Nov 2011 23:49:24 +1300")
> 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
> <backspace> (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
next prev parent reply other threads:[~2011-11-29 20:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-14 10:52 bug#10047: Looking for help debugging an undo issue Phil Sainty
2011-11-18 17:36 ` Stefan Monnier
2011-11-28 10:49 ` Phil Sainty
2011-11-29 20:22 ` Stefan Monnier [this message]
2011-12-01 14:16 ` Phil Sainty
2011-12-01 16:16 ` Stefan Monnier
2012-08-09 7:35 ` Chong Yidong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvy5uypxqt.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=10047@debbugs.gnu.org \
--cc=psainty@orcon.net.nz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).