bug#81629: 32.0.50; completion-pcm-leading-wildcard t

Sean Whitton <[email protected]>
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
Spencer Baugh [20/Aug  3:28pm -04] wrote:
> Sean Whitton <[email protected]> writes:
>> lucas jimenez [15/Aug 12:04pm GMT] wrote:
>>> Hi, all.
>>>
>>> Setting completion-pcm-leading-wildcard to `t` messes completion
>>>
>>> emacs -Q --eval "(setq completion-pcm-leading-wildcard t)"
>>>
>>> I have a directory ~/Documents/Tests/Notes/ with files inside.
>>>
>>> When doing `C-x C-f ~/do/te/no` (Notice I didn't ended with a slash)
>>>
>>> it completes to ~/Documents/Tests/no when the directory 'Notes' was the
>>> only available candidate.
>>>
>>> And when doing `C-x C-f ~/do/t/no` it expands it to `~/Dos/t/no` When I
>>> don't even have a directory starting with ~/Dos.
>>
>> Thanks.  Spencer, would you be able to say whether there a bug here, or
>> maybe this how it's expected to work?
>
> Yes, this is how it's expected to work.
>
> In case 1 you probably have another directory with "no" as a substring,
> so we can't expand any more than that with
> completion-pcm-leading-wildcard=t.
>
> For this reason what you probably want is something more like:
>
> (setopt completion-styles
>         '(basic
>           partial-completion
>           (partial-completion ((completion-pcm-leading-wildcard t)))
>           emacs22))
>
> So non-leading-wildcard completion is tried first.  That may behave more
> intuitively.
>
> In case 2, point is between "Do" and "s", right?  In partial-completion
> (and Emacs completion in general) you're intended to then type
> additional characters to help narrow it down.  You presumably have
> multiple directories matching "Do*s*", and point is placed at the first
> * to make it possible for you to select which one you want, by typing
> additional characters.
>
> That being said, if point *isn't* between "Do" and "s", that might be
> fixed by the attached patch.  Which I've been running with for about 10
> months, and which I forgot to push... ccing Stefan if he wants to
> comment on this patch.

Thanks for the commentary and the patch, I've installed it.

I edited the commit message down because we prefer not to have extensive
commentary in commit messages.

Lucas, if this addresses your original issue, we can close the bug.

-- 
Sean Whitton
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.