[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Thu, 26 Oct 2000 17:01:19 +0900 (JST)
I made some changes to `undo', as described by the appended patch.
Since undo is an important command, I wanted to see if there are any
problems with this.
One change is a bug-fix, to follow what the doc-string said and treat
numeric and non-numeric prefix args separately (the former means
`repeat', the latter (e.g., a lone `C-u') means `use selective undo
mode'), when transient-mark-mode is not enabled.
The other change, which may be more contentious, is to make it treat
even non-numeric prefix args as being repeat counts in transient-mark
mode. I did this because the special interpretation of bare C-u is
unnecessary in transient-mark-mode, and it's somewhat inconsistent with
Because the old code didn't really work correctly in this case -- it
treated a bare `C-u' as *both* the special indicator, *and* a repeat
count -- I have a feeling that this feature was not used heavily...
[indeed, as it would signal an error if the region wasn't active in
transient-mark-mode, users of t-m-m could only use a `C-u' prefix when
the region was active, and as the C-u would also (incorrectly) be used
as a repeat count, I think it's the case that the *actual*, as opposed
to documented, behavior hasn't changed with my patch!]
2000-10-26 Miles Bader <address@hidden>
* 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
--- simple.el.#1.444# Thu Oct 26 13:32:57 2000
+++ simple.el Thu Oct 26 16:37:39 2000
@@ -879,9 +879,9 @@ Return 0 if current buffer is not a mini
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 argument limits undo to changes within the current region."
;; 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
(or (eq (selected-window) (minibuffer-window))
- (or (eq last-command 'undo)
- (progn (if (or arg (and transient-mark-mode mark-active))
+ (unless (eq last-command 'undo)
+ (if (if transient-mark-mode mark-active (and arg (not (numberp arg))))
(undo-start (region-beginning) (region-end))
- (undo-more 1)))
- (undo-more (if arg (prefix-numeric-value arg) 1))
+ ;; get rid of initial undo boundary
+ (undo-more 1))
+ (if (or transient-mark-mode (numberp arg))
+ (prefix-numeric-value arg)
;; 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)
Love is a snowmobile racing across the tundra. Suddenly it flips over,
pinning you underneath. At night the ice weasels come. --Nietzsche
|[Prev in Thread]
||[Next in Thread]|
- `undo' changes,
Miles Bader <=