[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/jinx 9ffd681d66: Use jinx--table-with-metadata
From: |
ELPA Syncer |
Subject: |
[elpa] externals/jinx 9ffd681d66: Use jinx--table-with-metadata |
Date: |
Tue, 17 Dec 2024 15:58:48 -0500 (EST) |
branch: externals/jinx
commit 9ffd681d66e2ee7720c62da1165341124c087a17
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Use jinx--table-with-metadata
---
jinx.el | 35 +++++++++++++++++------------------
1 file changed, 17 insertions(+), 18 deletions(-)
diff --git a/jinx.el b/jinx.el
index cdbe821df1..96ab2b1d9c 100644
--- a/jinx.el
+++ b/jinx.el
@@ -768,17 +768,13 @@ The word will be associated with GROUP and get a prefix
key."
word
(get-text-property 0 'jinx--group word)))
-(defun jinx--correct-table (suggestions)
- "Completion table for SUGGESTIONS."
- (let ((md `(metadata (category . jinx)
- (display-sort-function . ,#'identity)
- (cycle-sort-function . ,#'identity)
- (group-function . ,#'jinx--group)
- (affixation-function . ,#'jinx--correct-affixation)
- (annotation-function . ,#'jinx--correct-annotation))))
- (lambda (str pred action)
- (if (eq action 'metadata) md
- (complete-with-action action suggestions str pred)))))
+;; TODO: Use `completion-table-with-metadata'
+(defun jinx--table-with-metadata (table metadata)
+ "Return new completion TABLE with METADATA."
+ (lambda (string pred action)
+ (if (eq action 'metadata)
+ `(metadata . ,metadata)
+ (complete-with-action action table string pred))))
(cl-defun jinx--correct-overlay (overlay &key info initial)
"Correct word at OVERLAY.
@@ -795,8 +791,14 @@ Optionally show prompt INFO and insert INITIAL input."
#'jinx--correct-setup
(or (completing-read
(format "Correct ā%sā%s: " word (or info ""))
- (jinx--correct-table
- (jinx--correct-suggestions word))
+ (jinx--table-with-metadata
+ (jinx--correct-suggestions word)
+ `((category . jinx)
+ (display-sort-function . ,#'identity)
+ (cycle-sort-function . ,#'identity)
+ (group-function . ,#'jinx--group)
+ (affixation-function . ,#'jinx--correct-affixation)
+ (annotation-function . ,#'jinx--correct-annotation)))
nil nil initial t word)
word)))))
(len (length choice)))
@@ -877,15 +879,12 @@ Optionally show prompt INFO and insert INITIAL input."
(jinx--load-module)
(let ((langs (delete-dups
(cl-loop for (l . p) in (jinx--mod-langs) collect
- (propertize l 'jinx--group (format "Provider %s"
p)))))
- (md `(metadata (group-function . ,#'jinx--group))))
+ (propertize l 'jinx--group (format "Provider %s"
p))))))
(string-join
(or (completing-read-multiple
(format "Change languages (%s): "
(string-join (split-string jinx-languages) ", "))
- (lambda (str pred action)
- (if (eq action 'metadata) md
- (complete-with-action action langs str pred)))
+ (jinx--table-with-metadata langs `((group-function .
,#'jinx--group)))
nil t)
(user-error "No languages selected"))
" ")))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/jinx 9ffd681d66: Use jinx--table-with-metadata,
ELPA Syncer <=