# HG changeset patch # User Stefan Monnier # Date 1236995494 0 # Node ID 78bd54d14660be6936313393fdff9b7a02a52dfd # Parent 1ed8eba93aec284656714512292d2bb135dd4df6 (undo): Don't loop when encountering empty undo records. diff -r 1ed8eba93aec -r 78bd54d14660 lisp/ChangeLog --- a/lisp/ChangeLog Sat Mar 14 00:26:34 2009 +0000 +++ b/lisp/ChangeLog Sat Mar 14 01:51:34 2009 +0000 @@ -1,3 +1,7 @@ +2009-03-14 Stefan Monnier + + * simple.el (undo): Don't loop when encountering empty undo records. + 2009-03-13 Tassilo Horn * doc-view.el (doc-view-mode-map): Bind RET to image-next-line. diff -r 1ed8eba93aec -r 78bd54d14660 lisp/simple.el --- a/lisp/simple.el Sat Mar 14 00:26:34 2009 +0000 +++ b/lisp/simple.el Sat Mar 14 01:51:34 2009 +0000 @@ -1682,9 +1682,13 @@ ;; In the ordinary case (not within a region), map the redo ;; record to the following undos. ;; I don't know how to do that in the undo-in-region case. - (puthash buffer-undo-list - (if undo-in-region t pending-undo-list) - undo-equiv-table) + (let ((list buffer-undo-list)) + ;; Strip any leading undo boundaries there might be, like we do + ;; above when checking. + (while (eq (car list) nil) + (setq list (cdr list))) + (puthash list (if undo-in-region t pending-undo-list) + undo-equiv-table)) ;; Don't specify a position in the undo record for the undo command. ;; Instead, undoing this should move point to where the change is. (let ((tail buffer-undo-list)