[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/jinx 86e5b734a1 1/2: Simplify rescheduling
From: |
ELPA Syncer |
Subject: |
[elpa] externals/jinx 86e5b734a1 1/2: Simplify rescheduling |
Date: |
Sat, 30 Dec 2023 06:57:58 -0500 (EST) |
branch: externals/jinx
commit 86e5b734a1cc7549cd28436e2ed8153d417394c1
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Simplify rescheduling
---
jinx.el | 21 +++++++--------------
1 file changed, 7 insertions(+), 14 deletions(-)
diff --git a/jinx.el b/jinx.el
index 7e70ef32a4..06a1050077 100644
--- a/jinx.el
+++ b/jinx.el
@@ -258,9 +258,9 @@ checking."
;;;; Internal variables
-(defvar jinx--reschedule-hooks
+(defvar jinx--schedule-hooks
'(window-state-change-hook window-scroll-functions post-command-hook)
- "Hooks which reschedule the spell checking timer, see `jinx--reschedule'.")
+ "Hooks which reschedule the spell checking timer, see `jinx--schedule'.")
(defvar jinx--predicates
(list #'jinx--face-ignored-p
@@ -547,14 +547,7 @@ If CHECK is non-nil, always check first."
(with-current-buffer buffer
(jinx--check-pending (window-start win) (window-end win)))))))
-(defun jinx--reschedule (&rest _)
- "Restart the global idle timer."
- (when (timer--function jinx--timer)
- (cancel-timer jinx--timer)
- (timer-set-function jinx--timer nil))
- (jinx--schedule))
-
-(defun jinx--schedule ()
+(defun jinx--schedule (&rest _)
"Start the global idle timer."
(when (and (not (timer--function jinx--timer))
(not completion-in-region-mode) ;; Corfu completion
@@ -1037,16 +1030,16 @@ This command dispatches to the following commands:
(seq-some #'derived-mode-p jinx-camel-modes))
jinx--session-words (split-string jinx-local-words))
(jinx--load-dicts)
- (dolist (hook jinx--reschedule-hooks)
- (add-hook hook #'jinx--reschedule nil t))
+ (dolist (hook jinx--schedule-hooks)
+ (add-hook hook #'jinx--schedule nil t))
(jit-lock-register #'jinx--mark-pending))
(t
(mapc #'kill-local-variable '(jinx--exclude-regexp jinx--include-faces
jinx--exclude-faces jinx--camel
jinx--dicts jinx--syntax-table
jinx--session-words))
- (dolist (hook jinx--reschedule-hooks)
- (remove-hook hook #'jinx--reschedule t))
+ (dolist (hook jinx--schedule-hooks)
+ (remove-hook hook #'jinx--schedule t))
(jit-lock-unregister #'jinx--mark-pending)
(jinx--cleanup))))