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: Sat, 24 Apr 2021 23:22:25 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

> The `affixation-function`, which can be specified in the completion table
> metadata is allowed to return a list with elements of either two or three
> elements depending on if you want to add only a suffix or both a prefix and
> a suffix.
>
> Would it make sense to use a simpler definition for this function? What is
> the downside of only allowing triples? In case you don't want to use
> a prefix or suffix, specify the empty string.

If the logic of specifying the elements is too confusing,
then such simplification is welcome.

Please note that only the documentation could be changed
to remove mentions of the ability to specify only suffix
for `affixation-function`.  But code will remain unchanged
because internally it depends on the predefined order of elements:
“completion + suffix” or “completion + prefix + suffix”.
There is no backward-compatible way to change this order.

> Or is the idea to make the function extensible over time, such that
> completion UIs should ignore if more than three elements are specified? But
> if that is the case the current definition is problematic. The first
> element is always the candidate, the second element is either suffix or
> prefix and the third element if it exists is the suffix.

More than three elements are already supported since e.g. the
total length is calculated as a sum of lengths of all strings:

  (apply #'+ (mapcar #'string-width str))



reply via email to

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