[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/hl-block-mode e7b5b014c9 10/64: Fix: localize hook & timer
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/hl-block-mode e7b5b014c9 10/64: Fix: localize hook & timer running when it shouldn't |
Date: |
Thu, 7 Jul 2022 12:00:01 -0400 (EDT) |
branch: elpa/hl-block-mode
commit e7b5b014c9d18cf87930d58dce2836b03de64b49
Author: Campbell Barton <ideasman42@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>
Fix: localize hook & timer running when it shouldn't
---
hl-block-mode.el | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/hl-block-mode.el b/hl-block-mode.el
index 685d833ff4..83a9eade1c 100644
--- a/hl-block-mode.el
+++ b/hl-block-mode.el
@@ -124,6 +124,11 @@ Inverse of `color-values'."
(setq end-prev end)))
(cdr block-list))))))
+(defun hl-block--overlay-refresh-from-timer ()
+ "Ensure this mode has not been disabled
+(from switching buffers for eg) before highlighting."
+ (when hl-block-mode (hl-block--overlay-refresh)))
+
;; Timer
(defvar hl-block--delay-timer nil)
@@ -133,22 +138,23 @@ Inverse of `color-values'."
(cancel-timer hl-block--delay-timer))
(setq hl-block--delay-timer
(run-with-idle-timer hl-block-delay t
- 'hl-block--overlay-refresh)))
+ 'hl-block--overlay-refresh-from-timer)))
(defun hl-block-mode-enable ()
"Turn on 'hl-block-mode' for the current buffer."
- (add-hook 'post-command-hook 'hl-block--overlay-delay))
+ (add-hook 'post-command-hook #'hl-block--overlay-delay nil t))
(defun hl-block-mode-disable ()
"Turn off 'hl-block-mode' for the current buffer."
(hl-block--overlay-clear)
(when (timerp hl-block--delay-timer)
(cancel-timer hl-block--delay-timer))
- (remove-hook 'post-command-hook 'hl-block--overlay-delay))
+ (remove-hook 'post-command-hook #'hl-block--overlay-delay t))
;;;###autoload
(define-minor-mode hl-block-mode
"Highlight block under the cursor."
+ :global nil
:lighter ""
(cond (hl-block-mode
(jit-lock-unregister 'hl-block-mode-enable)
- [nongnu] elpa/hl-block-mode 72840769e9 37/64: Cleanup: remove use of 'post-command-hook', (continued)
- [nongnu] elpa/hl-block-mode 72840769e9 37/64: Cleanup: remove use of 'post-command-hook', ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode 4a73d23ae2 43/64: Cleanup: over wide doc-string, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode bd54144b34 49/64: Cleanup: re-organize sections, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode 333490cf2d 45/64: Add hl-block-multi-line option, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode 3c49f80ada 50/64: Cleanup: replace 'if' with 'cond', ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode f2ec1f167a 46/64: Correct type of hl-block-color-tint, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode 2fb1cc165b 57/64: Simplify local bracket variable use, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode 7e0452c768 64/64: Change URL to codeberg, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode a1c03970a0 59/64: Remove unnecessary requirement `seq`, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode d7e274c3f1 04/64: Update readme.rst, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode e7b5b014c9 10/64: Fix: localize hook & timer running when it shouldn't,
ELPA Syncer <=
- [nongnu] elpa/hl-block-mode 28c9950a90 25/64: Fix for emacs 27, change in line highlighting, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode c6341f404e 44/64: Cleanup: store range data in cons cells instead of lists, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode e7ab79e713 36/64: Cleanup: add code-sections, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode 7e0c6954f9 52/64: readme: document draw styles, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode d080364c64 58/64: Use a string for hl-block-bracket characters, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode 3dd29cfbf2 63/64: Cleanup: use brief SPDX license, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode 933cee11e3 02/64: Add readme, ELPA Syncer, 2022/07/07