[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/jit-spell 03f8050481 1/2: Refinement to Hunspell apostr
From: |
ELPA Syncer |
Subject: |
[elpa] externals/jit-spell 03f8050481 1/2: Refinement to Hunspell apostrophe hack |
Date: |
Wed, 22 Mar 2023 14:58:35 -0400 (EDT) |
branch: externals/jit-spell
commit 03f80504816d9f9a65f5a2ed45ea619f987beb40
Author: Augusto Stoffel <arstoffel@gmail.com>
Commit: Augusto Stoffel <arstoffel@gmail.com>
Refinement to Hunspell apostrophe hack
Now hide the problematic apostrophes entirely from the Hunspell
subprocess.
---
jit-spell.el | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/jit-spell.el b/jit-spell.el
index 799738c53f..a79c7a2594 100644
--- a/jit-spell.el
+++ b/jit-spell.el
@@ -446,18 +446,14 @@ Otherwise, only such regions are kept."
(defun jit-spell--apostrophe-hack (regions)
"Refine REGIONS to work around Hunspell's apostrophe issue."
(mapcan
- (pcase-lambda (`(,i . ,limit)) ;; Refine one region
+ (pcase-lambda (`(,i . ,end)) ;; Refine one region
(let (result)
(goto-char i)
- (while (re-search-forward
- (rx (or (seq (or bol (not alpha)) (group ?') alpha)
- (seq alpha (group ?') (or (not alpha) eol))))
- limit t)
- (backward-char)
- (let ((j (or (match-end 1) (match-beginning 2))))
- (push (cons i j) result)
- (setq i j)))
- (push (cons i limit) result)))
+ (while (re-search-forward (rx (? (group alpha)) (group (+ ?'))) end t)
+ (unless (and (match-beginning 1) (looking-at-p (rx alpha)))
+ (push (cons i (match-beginning 2)) result)
+ (setq i (point))))
+ (push (cons i end) result)))
regions))
(defun jit-spell--check-region (start end)