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: Juri Linkov
Subject: bug#68214: Completion sorting customization by category
Date: Sat, 06 Jan 2024 19:33:36 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)

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





reply via email to

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