aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--generic/pg-user.el6
1 files changed, 5 insertions, 1 deletions
diff --git a/generic/pg-user.el b/generic/pg-user.el
index f0358239..513b477b 100644
--- a/generic/pg-user.el
+++ b/generic/pg-user.el
@@ -1273,7 +1273,11 @@ assuming the undo-in-region behavior will apply if ARG is non-nil."
buffer-undo-list))) ; can be nil
(if (or (null undo-list) (equal undo-list (list nil)))
nil ; there is clearly no undo elt
- (while (eq (car undo-list) nil)
+ (while (and undo-list ; to ensure it will terminate
+ (let ((elt (car undo-list)))
+ (not (and (consp elt)
+ (or (stringp (car elt))
+ (integerp (car elt)))))))
(setq undo-list (cdr undo-list))) ; get the last undo record
(if (and (eq last-command 'undo)
(or (eq pending-undo-list t)