aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Bader <[email protected]>2000-10-26 07:44:46 +0000
committerMiles Bader <[email protected]>2000-10-26 07:44:46 +0000
commit3c1b77ca339ad317c30425a641c837be00c24827 (patch)
treeda60b11001eb4d555b6f844d3b442ae1bc82fee8
parente276a14ac53a1f5b9bb8ebb81de908e9dcbcbfcc (diff)
(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.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/simple.el22
2 files changed, 18 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index dd2c3907dc..73dc391a5c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,10 @@
2000-10-26 Miles Bader <[email protected]>
+ * simple.el (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.
+
* simple.el (previous-matching-history-element): Position point on
match. Handle N == 0 correctly. Miscellaneous cleanup.
diff --git a/lisp/simple.el b/lisp/simple.el
index c95fd36c86..8bf1a78dab 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -879,9 +879,9 @@ Return 0 if current buffer is not a mini-buffer."
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 @@ Likewise in Transient Mark mode when the mark is active."
(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)