From: Juri Linkov <juri@linkov.net>
To: Clemens <clemera@posteo.net>
Cc: 45234@debbugs.gnu.org
Subject: bug#45234: Annotation function vs. Affixation function
Date: Tue, 15 Dec 2020 22:19:11 +0200 [thread overview]
Message-ID: <87h7om3lls.fsf@mail.linkov.net> (raw)
In-Reply-To: <a1347dab-c123-b3a3-99e4-43b5c8a24abe@posteo.net> (Clemens's message of "Tue, 15 Dec 2020 13:35:23 +0100")
[-- Attachment #1: Type: text/plain, Size: 380 bytes --]
> The doc says it receives a list of completions so I think currently you
> would have to look at the code to figure that out. Maybe we could avoid
> that complication? Currently it seems every affixation would need to check
> if it got a list of strings or a list of items as returned by a possibly
> defined annotation function.
I agree. So this could be changed like this:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: affixation-function-over-annotation-function.patch --]
[-- Type: text/x-diff, Size: 2245 bytes --]
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 456193d52e..404b1236b1 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -123,7 +123,8 @@ completion-metadata
- `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 precedence 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 @@ completion-extra-properties
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 precedence 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 @@ minibuffer-completion-help
(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
next prev parent reply other threads:[~2020-12-15 20:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-14 11:07 bug#45234: Annotation function vs. Affixation function clemera
2020-12-14 11:53 ` Clemens
2020-12-14 19:31 ` Juri Linkov
2020-12-15 12:35 ` Clemens
2020-12-15 20:19 ` Juri Linkov [this message]
2020-12-15 21:06 ` Clemens
2020-12-16 21:20 ` Juri Linkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h7om3lls.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=45234@debbugs.gnu.org \
--cc=clemera@posteo.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.