[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/indent-bars cf411a485c 181/431: Use timer to rate-limit
From: |
ELPA Syncer |
Subject: |
[elpa] externals/indent-bars cf411a485c 181/431: Use timer to rate-limit current depth highlight |
Date: |
Mon, 16 Sep 2024 12:59:26 -0400 (EDT) |
branch: externals/indent-bars
commit cf411a485c1c91a64dd12c058418ed37450fd72f
Author: JD Smith <93749+jdtsmith@users.noreply.github.com>
Commit: JD Smith <93749+jdtsmith@users.noreply.github.com>
Use timer to rate-limit current depth highlight
---
indent-bars.el | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/indent-bars.el b/indent-bars.el
index 33b4897549..9ab3a87b58 100644
--- a/indent-bars.el
+++ b/indent-bars.el
@@ -1014,7 +1014,6 @@ ROT are as in `indent-bars--stipple', and have similar
default values."
(setq indent-bars--current-depth-stipple
(indent-bars--stipple w h rot width pad pattern zigzag))))))
-(defvar-local indent-bars--highlight-last-time (current-time))
(defvar-local indent-bars--highlight-timer nil)
(defun indent-bars--update-current-depth-highlight (depth)
"Update highlight for the current DEPTH.
@@ -1035,15 +1034,23 @@ DEPTH should be greater than zero."
`(:stipple ,indent-bars--current-depth-stipple))))))))
(defun indent-bars--highlight-current-depth ()
- "Refresh current indentation depth highlight."
- (when (or (zerop indent-bars-depth-update-delay)
- (> (float-time (time-since indent-bars--highlight-last-time))
- indent-bars-depth-update-delay))
- (setq indent-bars--highlight-last-time (current-time))
- (let* ((depth (indent-bars--current-indentation-depth 'on-bar)))
- (when (and depth (not (= depth indent-bars--current-depth)) (> depth 0))
- (setq indent-bars--current-depth depth)
- (indent-bars--update-current-depth-highlight depth)))))
+ "Refresh current indentation depth highlight.
+Rate limit set by `indent-bars-depth-update-delay'."
+ (let* ((depth (indent-bars--current-indentation-depth 'on-bar)))
+ (when (and depth (not (= depth indent-bars--current-depth)) (> depth 0))
+ (setq indent-bars--current-depth depth)
+ (if (zerop indent-bars-depth-update-delay)
+ (indent-bars--update-current-depth-highlight depth)
+ (if-let ((tmr indent-bars--highlight-timer))
+ (progn
+ (timer-set-function
+ tmr #'indent-bars--update-current-depth-highlight (list depth))
+ (timer-set-time
+ tmr (time-add (current-time) indent-bars-depth-update-delay))
+ (unless (memq tmr timer-list) (timer-activate tmr)))
+ (setq indent-bars--highlight-timer
+ (run-at-time indent-bars-depth-update-delay nil
+ #'indent-bars--update-current-depth-highlight
(list depth))))))))
;;;; Text scaling and window hooks
(defvar-local indent-bars--remap-stipple nil)
- [elpa] externals/indent-bars b4594e0946 355/431: Correct local stipple update on text-scale, (continued)
- [elpa] externals/indent-bars b4594e0946 355/431: Correct local stipple update on text-scale, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 6f8b8ec6d3 399/431: Tweak commentary, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars ea0cd3de21 390/431: indent-bars-ts: use the new jit/font-lock approach for scope bars, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 756cfb0f55 403/431: Handle c-ts-mode's offset variable, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars d4c5d33ebf 408/431: ts: additional with-silent-modifications to ensure buffer unchanged, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 2afaaa2398 421/431: Update README.md, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars a86f8eca12 410/431: be more defensive with face-foreground/background, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 6efd53115d 419/431: Update README.md, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars a31c2f446a 396/431: indent-bars-ts: rename to finalize-jit-lock, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 0456549b9a 427/431: Add sh-mode, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars cf411a485c 181/431: Use timer to rate-limit current depth highlight,
ELPA Syncer <=
- [elpa] externals/indent-bars 8f9a4d7cc9 146/431: Minore README.md, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 2cc2f00e8c 172/431: README: mention --with-cairo, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 4dd4e0e8d7 171/431: Bump version, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 56c4e96637 200/431: Check unfontify-region function before setting region-function, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 13a8d8d370 194/431: indent-bars: reorganize, style struct and alternate styling, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 269774df6d 201/431: Correct bar depth calculation corner case, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 209817a622 414/431: make teardown-functions buffer-local, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars b63c46e6a2 413/431: Make update-depth-function and ppss buffer-local, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 8e9d028811 398/431: Make default bars less obtrusive, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 5ca30b97a7 422/431: Update README.md, ELPA Syncer, 2024/09/16