[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/undo-fu ad8a60f979 28/82: Lazy initialize checkpoint lengt
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/undo-fu ad8a60f979 28/82: Lazy initialize checkpoint length (minor speedup for linear redo) |
Date: |
Thu, 7 Jul 2022 12:04:51 -0400 (EDT) |
branch: elpa/undo-fu
commit ad8a60f9796c180230ff0a7fef17c3811aec18df
Author: Campbell Barton <ideasman42@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>
Lazy initialize checkpoint length (minor speedup for linear redo)
---
undo-fu.el | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/undo-fu.el b/undo-fu.el
index 9f3de862ef..b221bdf2e2 100644
--- a/undo-fu.el
+++ b/undo-fu.el
@@ -57,6 +57,8 @@ causing undo-fu to work with reduced functionality when a
selection exists."
;; First undo step in the chain, don't redo past this.
(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
@@ -74,7 +76,8 @@ causing undo-fu to work with reduced functionality when a
selection exists."
(setq undo-fu--respect nil)
(setq undo-fu--in-region nil)
(setq undo-fu--checkpoint-is-blocking nil)
- (setq undo-fu--checkpoint nil))
+ (setq undo-fu--checkpoint nil)
+ (setq undo-fu--checkpoint-length nil))
(defmacro undo-fu--with-message-suffix (suffix &rest body)
@@ -221,15 +224,16 @@ Optional argument ARG The number of steps to redo."
;; any (unlikely) issues here would error.
(not (null undo-fu--checkpoint)))
+ ;; Lazy initialize checkpoint length, avoids calculating for every
redo.
+ (unless undo-fu--checkpoint-length
+ (setq undo-fu--checkpoint-length (length undo-fu--checkpoint)))
+
;; Skip to the last matching redo step before the checkpoint.
- (let
- (
- (list pending-undo-list)
- (checkpoint-length (length undo-fu--checkpoint)))
+ (let ((list pending-undo-list))
(while
(and
(setq list (gethash list undo-equiv-table))
- (eq (last list checkpoint-length) undo-fu--checkpoint))
+ (eq (last list undo-fu--checkpoint-length) undo-fu--checkpoint))
(setq pending-undo-list list)))))
(let*
@@ -294,7 +298,8 @@ Optional argument ARG the number of steps to undo."
(setq undo-fu--respect t)))
(when (or undo-fu--checkpoint-is-blocking (not was-undo-or-redo))
- (setq undo-fu--checkpoint (cdr buffer-undo-list)))
+ (setq undo-fu--checkpoint (cdr buffer-undo-list))
+ (setq undo-fu--checkpoint-length nil))
(when (region-active-p)
(if undo-fu-allow-undo-in-region
- [nongnu] elpa/undo-fu 25e25ec4df 48/82: Cleanup: typos, (continued)
- [nongnu] elpa/undo-fu 25e25ec4df 48/82: Cleanup: typos, ELPA Syncer, 2022/07/07
- [nongnu] elpa/undo-fu f4db4c9b98 62/82: Update readme, ELPA Syncer, 2022/07/07
- [nongnu] elpa/undo-fu e81c8da441 73/82: Cleanup: use brief SPDX license, ELPA Syncer, 2022/07/07
- [nongnu] elpa/undo-fu d3d50ad00d 67/82: Cleanup: quiet docstring width warning, ELPA Syncer, 2022/07/07
- [nongnu] elpa/undo-fu ab8bc10e42 72/82: Cleanup: minor wording changes, ELPA Syncer, 2022/07/07
- [nongnu] elpa/undo-fu 7430fa58f1 75/82: Fix unconstrained undo when the user has undo-no-redo enabled, ELPA Syncer, 2022/07/07
- [nongnu] elpa/undo-fu 9159f46b70 78/82: Cleanup: prefer `cond` to `if`, ELPA Syncer, 2022/07/07
- [nongnu] elpa/undo-fu 756a4846b3 06/82: Remove redundant error handling case, ELPA Syncer, 2022/07/07
- [nongnu] elpa/undo-fu e49ee5bdc3 10/82: Show unconstrained suffix for unconstrained undo/redo, ELPA Syncer, 2022/07/07
- [nongnu] elpa/undo-fu 9bf729c727 09/82: Support pressing C-g before undo, ELPA Syncer, 2022/07/07
- [nongnu] elpa/undo-fu ad8a60f979 28/82: Lazy initialize checkpoint length (minor speedup for linear redo),
ELPA Syncer <=
- [nongnu] elpa/undo-fu f883424345 36/82: readme: disable undo-tree in the evil-example, ELPA Syncer, 2022/07/07
- [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