emacs-devel
[Top][All Lists]
Advanced

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

Re: project--completing-read-strict breaks ada-mode project completion t


From: Stephen Leake
Subject: Re: project--completing-read-strict breaks ada-mode project completion table
Date: Fri, 15 Feb 2019 15:38:17 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (windows-nt)

Stephen Leake <address@hidden> writes:

> Stephen Leake <address@hidden> writes:
>
>> Stephen Leake <address@hidden> writes:
>>
>>> Stefan Monnier <address@hidden> writes:
>>>
>>>>
>>>> As you mention in uniquify-files.el:
>>>>
>>>>     (defun completion-get-data-string (user-string table pred)
>>>>     [...]
>>>>              ;;  FIXME: This is ultimately called from
>>>>              ;;  `completion-try-completion' or 
>>>> `completion-all-completions';
>>>>              ;;  there is only one style currently being used. Need to 
>>>> pass that
>>>>              ;;  style from there to here.
>>>>
>>>> it only makes sense to call the conversion function corresponding to the
>>>> style that was used to generate that string.
>>>>
>>>> [ Also while a specific call to minibuffer-complete (or
>>>>   minibuffer-completion-help, or minibuffer-force-complete, ...) only
>>>>   uses a single style, a given completing-read session can currently use
>>>>   several completion styles.    ]
>>>>
>>>> So I think we should fix this FIXME before we can move this code to
>>>> minibuffer.el.  Maybe we can save the completion style that returned
>>>> that string in a text-property, or even directly store the conversion
>>>> function in there (so we don't need to extend completion-style-alist).
>>>
>>> ... completion-get-data-string is called after
>>> completing-read-default, via uniq-file-completing-read-default-advice.
>>> At that point, user-string was computed by the last style tried (ie
>>> uniq-file-all-completions, which could set a text property), but I'm not
>>> sure if it's copied (losing the text properties) in the middle
>>> somewhere. I'll try it.
>>
>> This is now implemented, in ELPA.
>
> Except it also needs:
>
> (setq minibuffer-allow-text-properties t)

That's not enough. Despite that setting, when there is a single
completion, minibuffer-force-complete calls completion--replace, which
explicitly deletes all text properties from the minibuffer text. Then
minibuffer-force-complete returns that text.

In addition, minibuffer-force-complete unconditionally uses
buffer-substring-no-properties to return the text.

So that setting lies, and using text properties to pass the style to
completion-get-data-string is not reliable.

--
-- Stephe



reply via email to

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