From 175a3a5144ab17bc8c854cd0cc6c1771d79a9f9c Mon Sep 17 00:00:00 2001 From: Barry O'Reilly Date: Sat, 12 Apr 2014 15:20:44 -0400 Subject: [PATCH] * simple.el (undo): Prevent insertion of identity mapping into undo-equiv-table so as undo-only does not inf loop in the presence of consecutive nils in undo list. Fixes: debbugs:17236 --- lisp/ChangeLog | 6 ++++++ lisp/simple.el | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e90693180a8..f5f3208256e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2014-04-12 Barry O'Reilly + + * simple.el (undo): Prevent insertion of identity mapping into + undo-equiv-table so as undo-only does not inf loop in the presence + of consecutive nils in undo list. + 2014-04-12 Matthias Dahl * faces.el (make-face): Deprecate optional argument as it is no diff --git a/lisp/simple.el b/lisp/simple.el index 68bfd7b14f4..a5e8381eaaa 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2143,7 +2143,12 @@ as an argument limits undo to changes within the current region." ;; above when checking. (while (eq (car list) nil) (setq list (cdr list))) - (puthash list (if undo-in-region t pending-undo-list) + (puthash list + ;; Prevent identity mapping. This can happen if + ;; consecutive nils are erroneously in undo list. + (if (or undo-in-region (eq list pending-undo-list)) + 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. -- 2.39.2