[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/indent-bars d7c1bd96e4 287/431: use idle-timer for high
From: |
ELPA Syncer |
Subject: |
[elpa] externals/indent-bars d7c1bd96e4 287/431: use idle-timer for highlighted bar update too |
Date: |
Mon, 16 Sep 2024 12:59:39 -0400 (EDT) |
branch: externals/indent-bars
commit d7c1bd96e4f9c3d46367fc39ddb0805157d09d20
Author: JD Smith <93749+jdtsmith@users.noreply.github.com>
Commit: JD Smith <93749+jdtsmith@users.noreply.github.com>
use idle-timer for highlighted bar update too
Formerly used a complicated timer-reschedule, kind of our own strange
idle-timer. Now this matched TS scope update timer (which is done a
bit more slowly).
---
indent-bars.el | 30 +++++++++++++-----------------
1 file changed, 13 insertions(+), 17 deletions(-)
diff --git a/indent-bars.el b/indent-bars.el
index 0056b5e133..fecb6685d0 100644
--- a/indent-bars.el
+++ b/indent-bars.el
@@ -69,6 +69,8 @@
(require 'cus-edit)
(require 'compat)
+;;;; Variables
+(defvar indent-bars-mode)
;;;; Customization
(defgroup indent-bars nil
"Highlight indentation bars."
@@ -1151,11 +1153,13 @@ ROT are as in `indent-bars--stipple', and have similar
default values."
(rot (or rot (indent-bars--stipple-rot nil w))))
(indent-bars--stipple w h rot style width pad pattern zigzag)))))
+(defvar-local indent-bars--highlight-timer nil)
(defun indent-bars--update-current-depth-highlight (depth)
"Update highlight for the current DEPTH.
Works by remapping the appropriate indent-bars[-tag]-N face for
all styles in the `indent-bars--styles' list. DEPTH should be
greater than zero."
+ (setq indent-bars--highlight-timer nil)
(dolist (s indent-bars--styles)
(let* ((face (indent-bars--face s depth))
(hl-col (and (ibs/current-depth-palette s)
@@ -1170,27 +1174,20 @@ greater than zero."
,@(when hl-bg `(:background ,hl-bg)))
(ibs/current-stipple-face s)))))))
-(defvar-local indent-bars--highlight-timer nil)
(defun indent-bars--highlight-current-depth (&optional force)
"Refresh current indentation depth highlight.
Rate limit set by `indent-bars-depth-update-delay'. If FORCE is
non-nil, update depth even if it has not changed."
- (let* ((depth (indent-bars--current-indentation-depth
- indent-bars-highlight-selection-method)))
- (when (and depth (or force (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)))
+ (unless (or indent-bars--highlight-timer (not indent-bars-mode))
+ (let* ((depth (indent-bars--current-indentation-depth
+ indent-bars-highlight-selection-method)))
+ (when (and depth (or force (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)
(setq indent-bars--highlight-timer
- (run-with-timer
+ (run-with-idle-timer
indent-bars-depth-update-delay nil
#'indent-bars--update-current-depth-highlight depth)))))))
@@ -1595,7 +1592,6 @@ Adapted from `highlight-indentation-mode'."
(remove-hook 'after-make-frame-functions #'indent-bars-setup-and-remove
t)
(indent-bars-setup))))
-(defvar indent-bars-mode)
;;;###autoload
(define-minor-mode indent-bars-mode
"Indicate indentation with configurable bars."
- [elpa] externals/indent-bars 7d63303e27 275/431: current-indentation-depth: no takes no POS arg, use s-e, (continued)
- [elpa] externals/indent-bars 7d63303e27 275/431: current-indentation-depth: no takes no POS arg, use s-e, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 00ee9d62fe 250/431: Do not apply face-remap given new final face argument, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 7d415237d8 258/431: Use style correctly when setting main stipple face, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars aacb0a574b 279/431: docstring: treesit-wrap, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars c6f08762b2 273/431: Use min-lines 3 for TS scope, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars d06e6e10da 268/431: Overhaul scope structure and logic, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars bfcc3fac50 271/431: assign update-depth-function in :success clause, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars d883507335 270/431: docs: improve update-scope1 docstring, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 10ce56b4e0 255/431: Improve stipple docstring and comment, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars d7b56cf13f 284/431: Tweak PPSS logic, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars d7c1bd96e4 287/431: use idle-timer for highlighted bar update too,
ELPA Syncer <=
- [elpa] externals/indent-bars e3ebe0d389 289/431: Remove window-state-change-functions hook on teardown, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars e12b91fe3f 295/431: doc: custom tweak, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 8855d462da 297/431: Add unspecified choice to simple custom vars too, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars dd4f7bd3ee 296/431: update-scope: consider no node or scope match as full-file, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 93a268799d 307/431: Update README.md, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars a78445ef7d 299/431: update copyrights, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars d962712541 302/431: Update-name and relocate delay vars, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars def1e3e395 303/431: README: document v0.5 release, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 6a68c5e7ff 301/431: Bump version, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars c4d05c62c0 306/431: Update README.md, ELPA Syncer, 2024/09/16