changeset 32899:5e2b0129cfde

(undo): Correctly distinguish between numeric and non-numeric prefix args in non-transient-mark-mode, as per the doc string. When in transient-mark-mode, treat all prefix-args as numeric.
author Miles Bader <miles@gnu.org>
date Thu, 26 Oct 2000 07:43:52 +0000
parents 3eba63072790
children 2c1711e23e22
files lisp/simple.el
diffstat 1 files changed, 13 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/simple.el	Thu Oct 26 04:35:48 2000 +0000
+++ b/lisp/simple.el	Thu Oct 26 07:43:52 2000 +0000
@@ -879,9 +879,9 @@
 Repeat this command to undo more changes.
 A numeric argument serves as a repeat count.
 
-Just C-u as argument requests selective undo,
-limited to changes within the current region.
-Likewise in Transient Mark mode when the mark is active."
+In Transient Mark mode when the mark is active, only undo changes within
+the current region.  Similarly, when not in Transient Mark mode, just C-u
+as an argument limits undo to changes within the current region."
   (interactive "*P")
   ;; If we don't get all the way thru, make last-command indicate that
   ;; for the following command.
@@ -890,12 +890,16 @@
 	(recent-save (recent-auto-save-p)))
     (or (eq (selected-window) (minibuffer-window))
 	(message "Undo!"))
-    (or (eq last-command 'undo)
-	(progn (if (or arg (and transient-mark-mode mark-active))
-		   (undo-start (region-beginning) (region-end))
-		 (undo-start))
-	       (undo-more 1)))
-    (undo-more (if arg (prefix-numeric-value arg) 1))
+    (unless (eq last-command 'undo)
+      (if (if transient-mark-mode mark-active (and arg (not (numberp arg))))
+	  (undo-start (region-beginning) (region-end))
+	(undo-start))
+      ;; get rid of initial undo boundary
+      (undo-more 1))
+    (undo-more
+     (if (or transient-mark-mode (numberp arg))
+	 (prefix-numeric-value arg)
+       1))
     ;; 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)