[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/jinx 70da6b7844 1/4: New function jinx--session-suggest
From: |
ELPA Syncer |
Subject: |
[elpa] externals/jinx 70da6b7844 1/4: New function jinx--session-suggestions |
Date: |
Wed, 13 Dec 2023 15:58:00 -0500 (EST) |
branch: externals/jinx
commit 70da6b7844626f3997a0652d759cd4b502b43590
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
New function jinx--session-suggestions
---
jinx.el | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/jinx.el b/jinx.el
index 3699320cff..b1cb92e4b0 100644
--- a/jinx.el
+++ b/jinx.el
@@ -679,8 +679,16 @@ The word will be associated with GROUP and get a prefix
key."
(puthash word t ht))
list)
+(defun jinx--session-suggestions (word)
+ "Retrieve suggestions for WORD from session."
+ (sort (cl-loop for w in jinx--session-words
+ for d = (string-distance word w)
+ if (<= d jinx-suggestion-distance)
+ collect (cons d w))
+ #'car-less-than-car))
+
(defun jinx--correct-suggestions (word)
- "Retrieve suggestions for WORD."
+ "Retrieve suggestions for WORD from all dictionaries."
(let ((ht (make-hash-table :test #'equal))
(list nil))
(dolist (dict jinx--dicts)
@@ -689,11 +697,7 @@ The word will be associated with GROUP and get a prefix
key."
(car desc) (cdr desc))))
(dolist (w (jinx--mod-suggest dict word))
(setq list (jinx--add-suggestion list ht w group)))))
- (dolist (w (sort (cl-loop for w in jinx--session-words
- for d = (string-distance word w)
- if (<= d jinx-suggestion-distance)
- collect (cons d w))
- #'car-less-than-car))
+ (dolist (w (jinx--session-suggestions word))
(setq list (jinx--add-suggestion list ht (cdr w) "Suggestions from
session")))
(nconc (nreverse list)
(cl-loop for (key . fun) in jinx--save-keys nconc