From: Juri Linkov <juri@linkov.net>
To: Clemens <clemera@posteo.net>
Cc: 45780@debbugs.gnu.org
Subject: bug#45780: 28.0.50; [PATCH] Face used for affixation function annotations
Date: Mon, 11 Jan 2021 20:38:55 +0200 [thread overview]
Message-ID: <87ft378gjk.fsf@mail.linkov.net> (raw)
In-Reply-To: <9b1409af-58b9-3a62-4162-343fd25293ca@posteo.net> (Clemens's message of "Mon, 11 Jan 2021 13:38:13 +0100")
[-- Attachment #1: Type: text/plain, Size: 1836 bytes --]
Hi Clemens,
> As per the comment above the affected code, the client can specify the face
> when prefix and suffix are provided. The prefix is already checked earlier
> and what remained was checking the suffix not the prefix.
Shouldn't then this code with font-lock-prepend-text-property
be removed completely? Since both prefix and suffix are non-nil,
this makes code no-op.
> There is another thing I would like to bring up in this context: When the
> annotations returned by annotation/affixation functions already specify
> a face I think it would be nicer if the completion-annotations face
> wouldn't be applied generally. In Selectrum we use something like:
>
> (if (text-property-not-all 0 (length str) 'face nil str)
> str
> (propertize str 'face 'completions-annotations))
So you propose to search for the face text-property in the provided string
to decide whether to add the default face in completion--insert-strings?
> This gives the client full control over the visual appearance if that is
> preferred. Maybe this approach could also make sense to be included in
> Emacs?
Do you see any possible backward-compatibility issues with changing this in
Emacs? For example, when a package like Selectrum puts another face
on the completion string, then it will be displayed instead of the default
completion-annotations face.
> Currently for the annotation function the completions-annotations
> face is always applied and for the affixation function it also still gets
> applied when the affixation function returns a two candidate list (like
> read-extended-command--affixation on current master). The case of also
> allowing a two candidate list to be returned by affixation functions is
> also currently undocumented.
Thanks for noticing the documentation problem. Do you think
this fix is sufficient:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: affix-doc.patch --]
[-- Type: text/x-diff, Size: 1253 bytes --]
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 3eca9d066f..227966020c 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -122,7 +122,8 @@ completion-metadata
returns a string to append to STRING.
- `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
+ of completions with a list of either two elements: completion
+ and suffix, or three elements: completion, its prefix
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*.
@@ -1941,6 +1942,7 @@ completion-extra-properties
`:affixation-function': Function to prepend/append a prefix/suffix to
completions. The function must accept one argument, a list of
completions, and return a list where each element is a list of
+ either two elements: a completion, and a suffix, or
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.
next prev parent reply other threads:[~2021-01-11 18:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-11 12:38 bug#45780: 28.0.50; [PATCH] Face used for affixation function annotations Clemens
2021-01-11 18:38 ` Juri Linkov [this message]
2021-01-11 20:07 ` Clemens
2021-01-12 18:30 ` Juri Linkov
2021-01-13 18:06 ` Clemens
2021-01-14 9:00 ` Juri Linkov
2021-01-14 17:21 ` Clemens
2021-01-14 18:59 ` Juri Linkov
2021-01-14 19:43 ` Clemens
2021-01-25 18:02 ` Juri Linkov
2021-01-30 19:13 ` Juri Linkov
2021-01-31 9:36 ` Clemens
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ft378gjk.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=45780@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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).