unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Add a comment to simple.el to explain the workings of `undo'.
@ 2008-10-21 21:09 Alan Mackenzie
  2008-10-21 21:07 ` Chong Yidong
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Mackenzie @ 2008-10-21 21:09 UTC (permalink / raw)
  To: emacs-devel

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).




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-10-22  8:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-21 21:09 Add a comment to simple.el to explain the workings of `undo' Alan Mackenzie
2008-10-21 21:07 ` Chong Yidong
2008-10-21 21:25   ` Alan Mackenzie
2008-10-22  1:35     ` Stefan Monnier
2008-10-22  8:03       ` Alan Mackenzie

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).