emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simplification of `affixation-function`


From: Juri Linkov
Subject: Re: Simplification of `affixation-function`
Date: Tue, 27 Apr 2021 21:11:59 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>> affixation-function was an improvement over annotation-function,
>> but nonetheless it has limitations too.  What would be a better thing is
>> like Daniel proposed a new meta `group-function`, I'd imagine a similar
>> meta `format-function` that could receive a candidate and return
>> a string to insert to the completions buffer.
>
> There has been some confusion regarding this already. Some people (me
> included) had assumed at some point that the affixation function is
> allowed to transform the candidate, since the candidate is part of the
> returned list elements (Now I know that this is not the case, but the
> function should be allowed to add faces). It should be possible to relax
> the affixation function to allow a candidate transformation, then we
> avoid the addition of another format-function function. One may ask -

affixation-function is called immediately after sorting candidates.
format-function could be called immediately before inserting candidates
only when they are displayed.

> why not change the affixation function then such that it only returns a
> single string? We could do that but I think it is valuable to separate
> prefix/candidate/suffix for display in a tablist.

Because completion--insert-strings needs to highlight the untransformed
candidate with mouse-face=highlight.

>> The same `format-function` could be used to remove the group prefix
>> when `group-function` is in use, instead of providing an additional
>> argument `transform` for `group-function`.
>
> The group function candidate transformation is also to be distinguished
> from a potential transformation performed by a
> format/affixation-function, since the group transformation should be
> only applied when grouping is active. It is therefore better to keep the
> transformations separate.

API would be more clear when transformation is separated from grouping.
So if there is no need to transform group candidates, only group-function
is provided.  When group candidates need transformation, then additionally
format/affixation-function can be provided as well.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]