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

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

Re: Canonical way to add a pre-filter to completing-read


From: Kaushal Modi
Subject: Re: Canonical way to add a pre-filter to completing-read
Date: Thu, 10 May 2018 17:19:52 +0000

Hello,

On Thu, May 10, 2018 at 11:22 AM Stefan Monnier <monnier@iro.umontreal.ca>
wrote:

>
> Could you clarify exactly here:
> - "will show"... when the user does what?
>   Just calling the above `completing-read` won't show any list of
> completions
>

Hmm. I use the ivy package, that provides a vertical list selection
interface even when using completing-read. This is what I meant:
https://i.imgur.com/1Ki7uFX.gifv

In the GIF, I first set the "bc" value to INITIAL-INPUT. In the later part
of the GIF, I set it to DEF, where that "bc" simply gets added to the
available entries (and also of no use to me).

- When I hit ? at the prompt, I indeed get a list of completions, but
>   that list only includes `bcd` because the default completion style
>   does not include `substring`.  So your use/test case is different from
>   the default.
>

Is there a way to make it behave as you see in the first part of that GIF?
i.e. make the "bc" filter the available candidates?

Let's say the user does
>
>     M-: (km-completion "Entry: " '("abc" "bcd" "cde") "bc") RET
>
> and then types `a` (and then hits `?` to see the list of remaining
> completions, or maybe he uses icomplete-mode to always see the list of
> remaining candidates).  What do you want the list of completions to be
> at that point?
>

If I type `a` there, the entry would become "bca", and nothing will match..
but if I do `C-a a`, the entry will be "abc", and will show only that "abc"
element.


> Some things you can do with the standard completion-UI:
> - setup your completion table such that it uses `substring` completion
>   by default.
>

That sounds like that would work.. can you please point to an example?


> - use `completion-table-in-turn` with the first table being a sub-table
>   which only includes the entries that match "bc".
>

I did not understand this suggestion.

-- 

Kaushal Modi


reply via email to

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