[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/undo-fu d81063c96d 42/82: Cleanup: remove unnecessary chec
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/undo-fu d81063c96d 42/82: Cleanup: remove unnecessary checkpoint-is-blocking variable |
Date: |
Thu, 7 Jul 2022 12:04:52 -0400 (EDT) |
branch: elpa/undo-fu
commit d81063c96dcdd410be01428e5967786e0d7c6414
Author: Campbell Barton <ideasman42@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>
Cleanup: remove unnecessary checkpoint-is-blocking variable
Instead check redo step count of zero to determine
if undo can no longer continue.
---
undo-fu.el | 50 ++++++++++++++++----------------------------------
1 file changed, 16 insertions(+), 34 deletions(-)
diff --git a/undo-fu.el b/undo-fu.el
index a8bf1421b7..247037b1e1 100644
--- a/undo-fu.el
+++ b/undo-fu.el
@@ -60,8 +60,6 @@ causing undo-fu to work with reduced functionality when a
selection exists."
(defvar-local undo-fu--checkpoint nil)
;; The length of 'undo-fu--checkpoint' (lazy initialize).
(defvar-local undo-fu--checkpoint-length nil)
-;; We have reached the checkpoint, don't redo.
-(defvar-local undo-fu--checkpoint-is-blocking nil)
;; Apply undo/redo constraints to stop redo from undoing or
;; passing the initial undo checkpoint.
(defvar-local undo-fu--respect t)
@@ -86,7 +84,6 @@ causing undo-fu to work with reduced functionality when a
selection exists."
"Disable using the checkpoint, allowing the initial boundary to be crossed
when redoing."
(setq undo-fu--respect nil)
(setq undo-fu--in-region nil)
- (setq undo-fu--checkpoint-is-blocking nil)
(undo-fu--checkpoint-unset))
(defmacro undo-fu--with-message-suffix (suffix &rest body)
@@ -197,26 +194,6 @@ Optional argument ARG The number of steps to redo."
(undo-fu--checkpoint-disable)
(message "Redo end-point stepped over!")))
- ;; Ensure the undo checkpoint is usable.
- (when undo-fu--respect
- (when (eq last-command 'undo)
- (undo-fu--checkpoint-disable)
- (message "Redo 'undo' called, not 'undo-fu-only-undo', checkpoint
disabled!")))
-
- (when undo-fu--respect
- (unless
- ;; Ensure the next steps is a redo action.
- (let ((list (undo-fu--next-step buffer-undo-list)))
- (and list (gethash list undo-equiv-table)))
- (user-error
- "Redo step not found (%s to ignore)"
- (substitute-command-keys "\\[keyboard-quit]"))))
-
- (when undo-fu--checkpoint-is-blocking
- (user-error
- "Redo end-point hit (%s to step over it)"
- (substitute-command-keys "\\[keyboard-quit]")))
-
(when undo-fu--respect
;; Implement "linear" redo.
;; So undo/redo chains before the undo checkpoint never redo an undo
step.
@@ -252,7 +229,16 @@ Optional argument ARG The number of steps to redo."
(steps
(if (numberp arg)
(if (and undo-fu--respect undo-fu--checkpoint)
- (undo-fu--count-redo-available undo-fu--checkpoint arg was-undo)
+ (let ((steps-test (undo-fu--count-redo-available
undo-fu--checkpoint arg was-undo)))
+
+ ;; Ensure the next steps is a redo action.
+ (when (zerop steps-test)
+ (user-error
+ "Redo step not found (%s to ignore)"
+ (substitute-command-keys "\\[keyboard-quit]")))
+
+ steps-test)
+
arg)
1))
(last-command
@@ -279,12 +265,9 @@ Optional argument ARG The number of steps to redo."
(progn
(message "%s" (error-message-string err))
nil)))))
- (when success
- (when undo-fu--respect
- (when (eq (gethash buffer-undo-list undo-equiv-table)
undo-fu--checkpoint)
- (setq undo-fu--checkpoint-is-blocking t))))))
- (setq this-command 'undo-fu-only-redo))
+ (setq this-command 'undo-fu-only-redo)
+ success)))
;;;###autoload
(defun undo-fu-only-undo (&optional arg)
@@ -309,7 +292,7 @@ Optional argument ARG the number of steps to undo."
(setq undo-fu--in-region nil))
(setq undo-fu--respect t)))
- (when (or undo-fu--checkpoint-is-blocking (not was-undo-or-redo))
+ (when (not was-undo-or-redo)
(undo-fu--checkpoint-set))
(when (region-active-p)
@@ -356,10 +339,9 @@ Optional argument ARG the number of steps to undo."
(progn
(message "%s" (error-message-string err))
nil)))))
- (when success
- (when undo-fu--respect
- (setq undo-fu--checkpoint-is-blocking nil)))))
- (setq this-command 'undo-fu-only-undo))
+
+ (setq this-command 'undo-fu-only-undo)
+ success)))
;; Evil Mode (setup if in use)
;;
- [nongnu] elpa/undo-fu f938ee2d94 38/82: Cleanup: pass in 'was-redo' as an argument, (continued)
- [nongnu] elpa/undo-fu f938ee2d94 38/82: Cleanup: pass in 'was-redo' as an argument, ELPA Syncer, 2022/07/07
- [nongnu] elpa/undo-fu 06772aef15 70/82: Use "undo" group, ELPA Syncer, 2022/07/07
- [nongnu] elpa/undo-fu e07fd219a0 74/82: Sync backported functions from Emacs, ELPA Syncer, 2022/07/07
- [nongnu] elpa/undo-fu c92261a3b7 80/82: Cleanup: use with-eval-after-load, ELPA Syncer, 2022/07/07
- [nongnu] elpa/undo-fu 1baca3da6b 03/82: Lookup key for keyboard-quit instead of hard coding in message, ELPA Syncer, 2022/07/07
- [nongnu] elpa/undo-fu cad12914a4 15/82: Add 'undo-fu-allow-undo-in-region' option, ELPA Syncer, 2022/07/07
- [nongnu] elpa/undo-fu a0e111b955 21/82: Add .elisp-autofmt to enable auto-formatting, ELPA Syncer, 2022/07/07
- [nongnu] elpa/undo-fu d561fa8e0c 23/82: Fix #2 Support linear redo, ELPA Syncer, 2022/07/07
- [nongnu] elpa/undo-fu 459c90479d 24/82: Release 0.2, ELPA Syncer, 2022/07/07
- [nongnu] elpa/undo-fu 29a8c3d5a8 32/82: Use more prominent comment sections, ELPA Syncer, 2022/07/07
- [nongnu] elpa/undo-fu d81063c96d 42/82: Cleanup: remove unnecessary checkpoint-is-blocking variable,
ELPA Syncer <=
- [nongnu] elpa/undo-fu 0ce9ac3614 53/82: Cleanup: use updated auto-formatting results, ELPA Syncer, 2022/07/07
- [nongnu] elpa/undo-fu 20c9d6170a 77/82: Cleanup: simplify checks for clearing the checkpoint, ELPA Syncer, 2022/07/07