[Top][All Lists]

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

Re: Simplification of `affixation-function`

From: Daniel Mendler
Subject: Re: Simplification of `affixation-function`
Date: Tue, 27 Apr 2021 19:39:34 +0200

On 4/27/21 6:48 PM, Juri Linkov wrote:
>> You can also note that the third (suffix) element is always an empty string
>> in both of these use cases. So affixation-function was really added to be
>> able to add a prefix.
> 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.
> Then the caller e.g. help--symbol-completion-table could define whether
> to append "u", "a" and "c" in parens by using on a candidate something like
> (format "%s (%s)" cand (cond ((fboundp (intern cand)) "f")) ...),
> or prepend a dimmed letter as a prefix, or to use an icon.
> 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`.

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 -
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.

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.


reply via email to

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