From: Alan Mackenzie <acm@muc.de>
To: emacs-devel@gnu.org
Subject: Add a comment to simple.el to explain the workings of `undo'.
Date: Tue, 21 Oct 2008 21:09:43 +0000 [thread overview]
Message-ID: <20081021210943.GB12051@muc.de> (raw)
Hi, Emacs!
I've suffered some pain over the last couple of days trying to make
sense of `undo'. The things which were bugging me were:
(i) Why does undo copy buffer-undo-list to pending-undo-list before
calling `primitive-undo' rather than just using buffer-undo-list
directly?
(ii) What on Earth is `undo' doing, after the call to `undo-more',
comparing (car buffer-undo-list) to nil, when it always has this nil,
and clearly "hasn't been changed" (tm) by `undo-more'.
Had the following short comment already been in simple.el, I would have
had little difficulty understanding `undo':
2008-10-21 Alan Mackenzie <acm@muc.de>
* simple.el (undo-more): Add comment explaining the operations on
pending-undo-list and buffer-undo-list.
*** /home/acm/emacs/emacs/lisp/simple.el~ 2008-10-21 20:37:17.466580872 +0000
--- /home/acm/emacs/emacs/lisp/simple.el 2008-10-21 20:49:24.843002848 +0000
***************
*** 1725,1730 ****
--- 1725,1733 ----
(error (concat "No further undo information"
(and undo-in-region " for region"))))
(let ((undo-in-progress t))
+ ;; Note: The following, while pulling elements off
+ ;; `pending-undo-list' will call primitive change functions which
+ ;; will push more elements onto `buffer-undo-list'.
(setq pending-undo-list (primitive-undo n pending-undo-list))
(if (null pending-undo-list)
(setq pending-undo-list t))))
Can I install this, please?
--
Alan Mackenzie (Nuremberg, Germany).
next reply other threads:[~2008-10-21 21:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-21 21:09 Alan Mackenzie [this message]
2008-10-21 21:07 ` Add a comment to simple.el to explain the workings of `undo' Chong Yidong
2008-10-21 21:25 ` Alan Mackenzie
2008-10-22 1:35 ` Stefan Monnier
2008-10-22 8:03 ` Alan Mackenzie
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=20081021210943.GB12051@muc.de \
--to=acm@muc.de \
--cc=emacs-devel@gnu.org \
/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).