bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#68214: Completion sorting customization by category


From: Daniel Mendler
Subject: bug#68214: Completion sorting customization by category
Date: Sat, 06 Jan 2024 18:59:44 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Juri Linkov <juri@linkov.net> writes:

>> If we are going with a solution which supports customizing arbitrary
>> metadata based on category, we could also adjust
>> `completion-metadata-get' and avoid the introduction of a separate
>> function `completion-metadata-override-get'. This will result in a
>> smaller and simpler code change overall.
>>
>> (defun completion-metadata-get (metadata prop)
>>   "Get PROP from completion METADATA.
>> If the metadata specifies a completion category, the variables
>> `completion-category-overrides' and
>> `completion-category-defaults' take precedence."
>>   (if-let (((not (eq prop 'category)))
>>            (cat (alist-get 'category metadata))
>>            (over (completion--category-override cat prop)))
>>       (cdr over)
>>     (alist-get prop metadata)))
>
> This is what I already considered but hesitated to make this change
> since it modifies the default behavior.  OTOH, probably there is
> no possible harm from this change.  So I'll give this a try.

Thanks. Seems better to take that route, instead of changing all
`completion-metadata-get' calls to `completion-metadata-override-get'
and leaving `completion-metadata-get' mostly unused. As long as we don't
modify `completion-category-defaults' or `completion-category-overrides'
there won't be a change in behavior.





reply via email to

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