emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 32f0149: * lisp/simple.el (undo): Use undo--last-change-was-undo-


From: Stefan Monnier
Subject: master 32f0149: * lisp/simple.el (undo): Use undo--last-change-was-undo-p
Date: Fri, 14 Feb 2020 10:53:04 -0500 (EST)

branch: master
commit 32f0149266162f8cfd161b35a1fe3744dcd36625
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

    * lisp/simple.el (undo): Use undo--last-change-was-undo-p
---
 lisp/simple.el | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/lisp/simple.el b/lisp/simple.el
index 0217ae7..688dbcc 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2532,6 +2532,11 @@ A redo record for ordinary undo maps to the following 
(earlier) undo.")
   "Within a run of consecutive undo commands, list remaining to be undone.
 If t, we undid all the way to the end of it.")
 
+(defun undo--last-change-was-undo-p (undo-list)
+  (while (and (consp undo-list) (eq (car undo-list) nil))
+    (setq undo-list (cdr undo-list)))
+  (gethash undo-list undo-equiv-table))
+
 (defun undo (&optional arg)
   "Undo some previous changes.
 Repeat this command to undo more changes.
@@ -2567,12 +2572,7 @@ as an argument limits undo to changes within the current 
region."
                 (or (eq pending-undo-list t)
                     ;; If something (a timer or filter?) changed the buffer
                     ;; since the previous command, don't continue the undo seq.
-                    (let ((list buffer-undo-list))
-                      (while (eq (car list) nil)
-                        (setq list (cdr list)))
-                      ;; If the last undo record made was made by undo
-                      ;; it shows nothing else happened in between.
-                      (gethash list undo-equiv-table))))
+                    (undo--last-change-was-undo-p buffer-undo-list)))
       (setq undo-in-region
            (and (or (region-active-p) (and arg (not (numberp arg))))
                  (not inhibit-region)))
@@ -2662,11 +2662,6 @@ Contrary to `undo', this will not redo a previous undo."
   (interactive "*p")
   (let ((undo-no-redo t)) (undo arg)))
 
-(defun undo--last-change-was-undo-p (undo-list)
-  (while (and (consp undo-list) (eq (car undo-list) nil))
-    (setq undo-list (cdr undo-list)))
-  (gethash undo-list undo-equiv-table))
-
 (defun undo-redo (&optional arg)
   "Undo the last ARG undos."
   (interactive "*p")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]