[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/corfu 5d59adc 2/2: Use stricter definition of the affix
From: |
Protesilaos Stavrou |
Subject: |
[elpa] externals/corfu 5d59adc 2/2: Use stricter definition of the affixation-function |
Date: |
Tue, 27 Apr 2021 16:54:34 -0400 (EDT) |
branch: externals/corfu
commit 5d59adc09983fd970792c26bc4fc0f67d875c011
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Use stricter definition of the affixation-function
See
https://github.com/emacs-mirror/emacs/commit/d8e037eeaa7eef26349bc0fb3fa00e10a5c4b894
---
corfu.el | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/corfu.el b/corfu.el
index 6ffb628..3149744 100644
--- a/corfu.el
+++ b/corfu.el
@@ -375,7 +375,7 @@ If `line-spacing/=nil' or in text-mode, the background
color is used instead.")
(funcall aff candidates)
(if-let (ann (or (corfu--metadata-get metadata 'annotation-function)
(plist-get corfu--extra-properties :annotation-function)))
- (mapcar (lambda (cand) (list cand (or (funcall ann cand) "")))
candidates)
+ (mapcar (lambda (cand) (list cand "" (or (funcall ann cand) "")))
candidates)
candidates)))
;; XXX Do not use `completion-metadata-get' in order to avoid Marginalia.
@@ -384,17 +384,14 @@ If `line-spacing/=nil' or in text-mode, the background
color is used instead.")
"Return PROP from METADATA."
(cdr (assq prop metadata)))
-(defun corfu--format-candidate (ann-cand)
- "Format annotated ANN-CAND string."
- (let* ((prefix "") (suffix "")
- (cand (pcase ann-cand
- (`(,c ,s) (setq suffix s) c)
- (`(,c ,p ,s) (setq prefix p suffix s) c)
- (c c))))
- (concat prefix cand
- (if (text-property-not-all 0 (length suffix) 'face nil suffix)
- suffix
- (propertize suffix 'face 'completions-annotations)))))
+(defun corfu--format-candidate (cand)
+ "Format annotated CAND string."
+ (if (consp cand)
+ (concat (cadr cand) (car cand)
+ (if (text-property-not-all 0 (length (caddr cand)) 'face nil
(caddr cand))
+ (caddr cand)
+ (propertize (caddr cand) 'face 'completions-annotations)))
+ cand))
(defun corfu--show-candidates (beg end str metadata)
"Update display given BEG, END, STR and METADATA."