[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 67fb182: Give affixation-function higher priority over annotation
From: |
Juri Linkov |
Subject: |
master 67fb182: Give affixation-function higher priority over annotation-function (bug#45234) |
Date: |
Wed, 16 Dec 2020 16:20:03 -0500 (EST) |
branch: master
commit 67fb182cfa6afeb9e212c89d78caac9bd4a82f3a
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>
Give affixation-function higher priority over annotation-function
(bug#45234)
* doc/lispref/minibuf.texi (Completion Variables)
(Programmed Completion): Describe precedence rules
of affixation-function and annotation-function.
* lisp/minibuffer.el (completion-metadata)
(completion-extra-properties): Describe precedence rules
of affixation-function and annotation-function.
(minibuffer-completion-help): First try to apply
affixation-function, if there is no such function,
try annotation-function.
---
doc/lispref/minibuf.texi | 6 ++++--
lisp/minibuffer.el | 16 ++++++++++------
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index 56bc0b8..48f068e 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -1803,7 +1803,8 @@ The value should be a function to add prefixes and
suffixes to
completions. This function must accept one argument, a list of
completions, and should return such a list of completions where
each element contains a list of three elements: a completion,
-a prefix string, and a suffix string.
+a prefix string, and a suffix string. This function takes priority
+over @code{:annotation-function}.
@item :exit-function
The value should be a function to run after performing completion.
@@ -1911,7 +1912,8 @@ completions. The function should take one argument,
return such a list of @var{completions} where each element contains a list
of three elements: a completion, a prefix which is displayed before
the completion string in the @file{*Completions*} buffer, and
-a suffix displayed after the completion string.
+a suffix displayed after the completion string. This function
+takes priority over @code{annotation-function}.
@item display-sort-function
The value should be a function for sorting completions. The function
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 456193d..7d05f77 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -123,7 +123,8 @@ This metadata is an alist. Currently understood keys are:
- `affixation-function': function to prepend/append a prefix/suffix to
entries. Takes one argument (COMPLETIONS) and should return a list
of completions with a list of three elements: completion, its prefix
- and suffix.
+ and suffix. This function takes priority over `annotation-function'
+ when both are provided, so only this function is used.
- `display-sort-function': function to sort entries in *Completions*.
Takes one argument (COMPLETIONS) and should return a new list
of completions. Can operate destructively.
@@ -1926,6 +1927,8 @@ These include:
completions. The function must accept one argument, a list of
completions, and return a list where each element is a list of
three elements: a completion, a prefix and a suffix.
+ This function takes priority over `:annotation-function'
+ when both are provided, so only this function is used.
`:exit-function': Function to run after completion is performed.
@@ -2056,15 +2059,16 @@ variables.")
(if sort-fun
(funcall sort-fun completions)
(sort completions 'string-lessp))))
- (when ann-fun
+ (cond
+ (aff-fun
+ (setq completions
+ (funcall aff-fun completions)))
+ (ann-fun
(setq completions
(mapcar (lambda (s)
(let ((ann (funcall ann-fun s)))
(if ann (list s ann) s)))
- completions)))
- (when aff-fun
- (setq completions
- (funcall aff-fun completions)))
+ completions))))
(with-current-buffer standard-output
(setq-local completion-base-position
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 67fb182: Give affixation-function higher priority over annotation-function (bug#45234),
Juri Linkov <=