branch: elpa/undo-fu
commit ef3a83943c999007ee9f16b36d8f85178ae306e3
Author: Campbell Barton <[email protected]>
Commit: Campbell Barton <[email protected]>
Cleanup: bind the undo/redo step count before the checkpoint setup
Binding it with the other command state lets the count be checked
before any state is changed, without calculating it twice.
No functional changes.
---
undo-fu.el | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/undo-fu.el b/undo-fu.el
index 024c64efa3..2330a339e9 100644
--- a/undo-fu.el
+++ b/undo-fu.el
@@ -348,7 +348,8 @@ Optional argument ARG The number of steps to redo."
(undo-fu--undo-enabled-or-error)
;; Assign `was-undo-or-redo', `was-redo' & `was-undo' for convenience.
- (let* ((was-undo-or-redo (undo-fu--was-undo-or-redo))
+ (let* ((steps (or arg 1))
+ (was-undo-or-redo (undo-fu--was-undo-or-redo))
(was-redo (and was-undo-or-redo undo-fu--was-redo))
(was-undo (and was-undo-or-redo (null was-redo))))
@@ -360,8 +361,7 @@ Optional argument ARG The number of steps to redo."
(substitute-command-keys
(format "\\[%s]" (symbol-name
(undo-fu--quit-command)))))))
- (let* ((steps (or arg 1))
- (last-command
+ (let* ((last-command
(cond
(was-undo
;; Break undo chain, avoid having to press [keyboard-quit].
@@ -411,15 +411,15 @@ Optional argument ARG the number of steps to undo."
(undo-fu--undo-enabled-or-error)
;; Assign `was-undo-or-redo' & `was-redo' for convenience.
- (let* ((was-undo-or-redo (undo-fu--was-undo-or-redo))
+ (let* ((steps (or arg 1))
+ (was-undo-or-redo (undo-fu--was-undo-or-redo))
(was-redo (and was-undo-or-redo undo-fu--was-redo)))
(undo-fu--checkpoint-update was-undo-or-redo "Undo checkpoint ignored!")
- (let* ((steps (or arg 1))
- ;; Swap in 'undo' for our own function name.
- ;; Without this undo won't stop once the first undo step is reached.
- (last-command
+ ;; Swap in 'undo' for our own function name.
+ ;; Without this undo won't stop once the first undo step is reached.
+ (let* ((last-command
(cond
;; Special case, to avoid being locked out of the undo-redo chain.
;; Without this, continuously redoing will end up in a state
where undo & redo fails.