Subject: Re: bug#76182: 31.0.50; minibuffer-allow-text-properties not reliable

From: Visuwesh <[email-masked]>
Date: Sat, 01 Mar 2025 20:02:43 +0530

[சனி மார்ச் 01, 2025] Eli Zaretskii wrote:

>> > How could you get text properties from the completion candidate,
>> > when you type text in the minibuffer and don't use completion?
>> 
>> That is essentially the conclusion I came to too.  The best way to
>> "stash metadata" associated with a completion candidate is to use an
>> alist or a hashtable (or an obarray??) I suppose (so you would end doing
>>     (alist-get (completing-read ...) candidates nil nil #'equal)).
>> 
>> If that is indeed the conclusion, then this bug can be closed once the
>> documentation is updated to reflect this limitation.
>
> Closing.

AFAICT, minibuffer-allow-text-properties still doesn't document this
caveat.  imenu-flatten has something:

    Since the values ‘annotation’ and ‘group’ rely on text properties,
    you can use them only by selecting candidates from the completions
    buffer, not by typing in the minibuffer.  This also means that
    if you use ‘minibuffer-next-completion’ (‘M-<down>’) to select
    a completion while point stays in the minibuffer, you need
    to customize ‘minibuffer-completion-auto-choose’ to nil that
    doesn’t insert completion candidates to the minibuffer.
    Also note that for using the value ‘group’ you need to customize
    ‘completions-group’ to the value t, and ‘completions-format’
    to the value ‘vertical’.

but it would be better to document this "gotcha" in
minibuffer-allow-text-properties instead.