aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2005-01-29 17:24:41 +0000
committerRichard M. Stallman2005-01-29 17:24:41 +0000
commita7fe694c133749bc7f736fcd078a9f33fa1b4287 (patch)
treeb82f78a0d60276fe69db3e3153d32dba499d6e4a
parent6f95a835181f3352c524e2cc5c48dd7648fd6e9d (diff)
downloademacs-a7fe694c133749bc7f736fcd078a9f33fa1b4287.tar.gz
emacs-a7fe694c133749bc7f736fcd078a9f33fa1b4287.zip
(undo): Fix the test for continuing a series of undos.
(undo-more): Set pending-undo-list to t when we reach end. (pending-undo-list): defvar moved up.
-rw-r--r--lisp/simple.el30
1 files changed, 17 insertions, 13 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 3db2a418f3b..b195874e2f6 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1235,6 +1235,10 @@ Return 0 if current buffer is not a mini-buffer."
1235(defvar undo-no-redo nil 1235(defvar undo-no-redo nil
1236 "If t, `undo' doesn't go through redo entries.") 1236 "If t, `undo' doesn't go through redo entries.")
1237 1237
1238(defvar pending-undo-list nil
1239 "Within a run of consecutive undo commands, list remaining to be undone.
1240t if we undid all the way to the end of it.")
1241
1238(defun undo (&optional arg) 1242(defun undo (&optional arg)
1239 "Undo some previous changes. 1243 "Undo some previous changes.
1240Repeat this command to undo more changes. 1244Repeat this command to undo more changes.
@@ -1258,14 +1262,15 @@ as an argument limits undo to changes within the current region."
1258 (setq this-command 'undo-start) 1262 (setq this-command 'undo-start)
1259 1263
1260 (unless (and (eq last-command 'undo) 1264 (unless (and (eq last-command 'undo)
1261 ;; If something (a timer or filter?) changed the buffer 1265 (or (eq pending-undo-list t)
1262 ;; since the previous command, don't continue the undo seq. 1266 ;; If something (a timer or filter?) changed the buffer
1263 (let ((list buffer-undo-list)) 1267 ;; since the previous command, don't continue the undo seq.
1264 (while (eq (car list) nil) 1268 (let ((list buffer-undo-list))
1265 (setq list (cdr list))) 1269 (while (eq (car list) nil)
1266 ;; If the last undo record made was made by undo 1270 (setq list (cdr list)))
1267 ;; it shows nothing else happened in between. 1271 ;; If the last undo record made was made by undo
1268 (gethash list undo-equiv-table))) 1272 ;; it shows nothing else happened in between.
1273 (gethash list undo-equiv-table))))
1269 (setq undo-in-region 1274 (setq undo-in-region
1270 (if transient-mark-mode mark-active (and arg (not (numberp arg))))) 1275 (if transient-mark-mode mark-active (and arg (not (numberp arg)))))
1271 (if undo-in-region 1276 (if undo-in-region
@@ -1340,9 +1345,6 @@ Contrary to `undo', this will not redo a previous undo."
1340;; no idea whereas to bind it. Any suggestion welcome. -stef 1345;; no idea whereas to bind it. Any suggestion welcome. -stef
1341;; (define-key ctl-x-map "U" 'undo-only) 1346;; (define-key ctl-x-map "U" 'undo-only)
1342 1347
1343(defvar pending-undo-list nil
1344 "Within a run of consecutive undo commands, list remaining to be undone.")
1345
1346(defvar undo-in-progress nil 1348(defvar undo-in-progress nil
1347 "Non-nil while performing an undo. 1349 "Non-nil while performing an undo.
1348Some change-hooks test this variable to do something different.") 1350Some change-hooks test this variable to do something different.")
@@ -1351,12 +1353,14 @@ Some change-hooks test this variable to do something different.")
1351 "Undo back N undo-boundaries beyond what was already undone recently. 1353 "Undo back N undo-boundaries beyond what was already undone recently.
1352Call `undo-start' to get ready to undo recent changes, 1354Call `undo-start' to get ready to undo recent changes,
1353then call `undo-more' one or more times to undo them." 1355then call `undo-more' one or more times to undo them."
1354 (or pending-undo-list 1356 (or (listp pending-undo-list)
1355 (error (format "No further undo information%s" 1357 (error (format "No further undo information%s"
1356 (if (and transient-mark-mode mark-active) 1358 (if (and transient-mark-mode mark-active)
1357 " for region" "")))) 1359 " for region" ""))))
1358 (let ((undo-in-progress t)) 1360 (let ((undo-in-progress t))
1359 (setq pending-undo-list (primitive-undo count pending-undo-list)))) 1361 (setq pending-undo-list (primitive-undo count pending-undo-list))
1362 (if (null pending-undo-list)
1363 (setq pending-undo-list t))))
1360 1364
1361;; Deep copy of a list 1365;; Deep copy of a list
1362(defun undo-copy-list (list) 1366(defun undo-copy-list (list)