all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Canonical way to add a pre-filter to completing-read
Date: Thu, 10 May 2018 17:19:52 +0000	[thread overview]
Message-ID: <CAFyQvY3B0xjobM+S53QXUruvhG8EkQOayqdo1yOBGbm=bNvQng@mail.gmail.com> (raw)
In-Reply-To: <jwvy3gree53.fsf-monnier+gmane.emacs.help@gnu.org>

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	other threads:[~2018-05-10 17:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-10 13:09 Canonical way to add a pre-filter to completing-read Kaushal Modi
2018-05-10 14:10 ` Drew Adams
2018-05-10 17:36   ` Kaushal Modi
2018-05-10 15:21 ` Stefan Monnier
2018-05-10 17:19   ` Kaushal Modi [this message]
2018-05-10 22:05     ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFyQvY3B0xjobM+S53QXUruvhG8EkQOayqdo1yOBGbm=bNvQng@mail.gmail.com' \
    --to=kaushal.modi@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.