Skip to content

Commit

Permalink
ivy.el: Support :annotation-function of completion-extra-properties
Browse files Browse the repository at this point in the history
* ivy.el (ivy-completion-in-region): Don't remove text properties.
(ivy--format-minibuffer-line): When :annotation-function is bound, use it.

Fixes #1489
  • Loading branch information
abo-abo committed Jul 27, 2018
1 parent bfa6e58 commit 951560e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ivy.el
Expand Up @@ -2213,7 +2213,9 @@ See `completion-in-region' for further information."
prompt
(replace-regexp-in-string "%" "%%" prompt))
;; remove 'completions-first-difference face
(mapcar #'substring-no-properties comps)
(mapcar
(lambda (s) (remove-text-properties 0 (length s) '(face) s) s)

This comment has been minimized.

Copy link
@basil-conto

basil-conto Jul 27, 2018

Collaborator

Better use remove-list-of-text-properties, as remove-text-properties expects a plist.

comps)
;; predicate was already applied by `completion-all-completions'
:predicate nil
:initial-input initial
Expand Down Expand Up @@ -3400,7 +3402,10 @@ Note: The usual last two arguments are flipped for convenience.")
"mouse-1: %s mouse-3: %s")
ivy-mouse-1-tooltip ivy-mouse-3-tooltip))
str)
str))
(let ((annotation-function (plist-get completion-extra-properties :annotation-function)))
(if annotation-function
(concat str (funcall annotation-function str))
str))))

(ivy-set-display-transformer
'counsel-find-file 'ivy-read-file-transformer)
Expand Down

0 comments on commit 951560e

Please sign in to comment.