[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/jit-spell 20445a2597 7/7: Use Flyspell's ignore predica
From: |
ELPA Syncer |
Subject: |
[elpa] externals/jit-spell 20445a2597 7/7: Use Flyspell's ignore predicate when available |
Date: |
Mon, 6 Mar 2023 15:58:28 -0500 (EST) |
branch: externals/jit-spell
commit 20445a2597da8b26e6dc952b2eae8a55ff077858
Author: Augusto Stoffel <arstoffel@gmail.com>
Commit: Augusto Stoffel <arstoffel@gmail.com>
Use Flyspell's ignore predicate when available
---
jit-spell.el | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/jit-spell.el b/jit-spell.el
index 0a1d9249ac..ab7a6d99c0 100644
--- a/jit-spell.el
+++ b/jit-spell.el
@@ -95,10 +95,11 @@ to false positives when it is used as a quotation mark."
(defvar jit-spell-delayed-commands nil)
(make-obsolete-variable 'jit-spell-delayed-commands "Not necessary anymore"
"0.2")
-(defvar jit-spell-ignored-p #'jit-spell--default-ignored-p
+(defvar jit-spell--ignored-p #'jit-spell--default-ignored-p
"Predicate satisfied by words to ignore.
It should be a function taking two arguments, the start and end
positions of the word.")
+(make-obsolete-variable 'jit-spell-ignored-p 'jit-spell--ignored-p "0.2")
(defvar jit-spell--filter-region #'jit-spell--filter-region
"Function to extract regions of interest from the buffer.
@@ -171,7 +172,7 @@ character offset from START, and a list of corrections."
(pcase-dolist (`(,word ,offset ,corrections) misspellings)
(let* ((wstart (+ start offset -1))
(wend (+ wstart (length word))))
- (unless (funcall jit-spell-ignored-p wstart wend)
+ (unless (funcall jit-spell--ignored-p wstart wend)
(jit-spell--make-overlay wstart wend corrections)))))))
(defun jit-spell--overlay-at (pos)
@@ -518,8 +519,14 @@ again moves to the next misspelling."
(jit-spell-mode
(cond
((derived-mode-p 'prog-mode)
- (add-function :before-until (local 'jit-spell-ignored-p)
+ (add-function :before-until (local 'jit-spell--ignored-p)
#'jit-spell--prog-ignored-p)))
+ (when-let ((pred (or (bound-and-true-p
flyspell-generic-check-word-predicate)
+ (get major-mode 'flyspell-mode-predicate))))
+ (add-function :after-until (local 'jit-spell--ignored-p)
+ (lambda (_start end) (save-excursion
+ (goto-char end)
+ (not (funcall pred))))))
(when (if (eq 'auto jit-spell-use-apostrophe-hack)
ispell-really-hunspell
jit-spell-use-apostrophe-hack)
@@ -535,7 +542,7 @@ again moves to the next misspelling."
(remove-hook 'ispell-change-dictionary-hook 'jit-spell--unfontify t)
(kill-local-variable 'ispell-buffer-session-localwords)
(kill-local-variable 'jit-spell--filter-region)
- (kill-local-variable 'jit-spell-ignored-p)))
+ (kill-local-variable 'jit-spell--ignored-p)))
(jit-spell--unfontify))
;; Don't litter M-x
- [elpa] externals/jit-spell updated (0411d64169 -> 20445a2597), ELPA Syncer, 2023/03/06
- [elpa] externals/jit-spell 18073945a9 1/7: Remove unnecessary check, ELPA Syncer, 2023/03/06
- [elpa] externals/jit-spell c5957b71ad 2/7: Improve documentation of the process plist entries, ELPA Syncer, 2023/03/06
- [elpa] externals/jit-spell eb3afae398 3/7: Add jit-spell--filter-region variable and function, ELPA Syncer, 2023/03/06
- [elpa] externals/jit-spell adf6817819 4/7: Add option to work around Hunspell's apostrophe issue, ELPA Syncer, 2023/03/06
- [elpa] externals/jit-spell cbf249dc7c 5/7: Rename jit-spell--accept-word, remove interactive form, ELPA Syncer, 2023/03/06
- [elpa] externals/jit-spell a65bc6b3d9 6/7: Retire jit-spell-delayed-commands and the pre-command hook, ELPA Syncer, 2023/03/06
- [elpa] externals/jit-spell 20445a2597 7/7: Use Flyspell's ignore predicate when available,
ELPA Syncer <=