all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: Canonical way to add a pre-filter to completing-read
Date: Thu, 10 May 2018 11:21:42 -0400	[thread overview]
Message-ID: <jwvy3gree53.fsf-monnier+gmane.emacs.help@gnu.org> (raw)
In-Reply-To: CAFyQvY3gomT-G=oGhYsReZ4O1vdJ09a9OpYYtvyoTsaaSmG0Qw@mail.gmail.com

> (completing-read "Entry: " '("abc" "bcd" "cde") nil :require-match "bc")
> ;INITIAL-INPUT deprecated, but works as I want
>
> Above will show in the completion list with just the filtered items
> matching "bc":
>
>     abc
>     bcd

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
- 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.

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?

Some things you can do with the standard completion-UI:
- setup your completion table such that it uses `substring` completion
  by default.
- use `completion-table-in-turn` with the first table being a sub-table
  which only includes the entries that match "bc".


-- Stefan




  parent reply	other threads:[~2018-05-10 15:21 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 [this message]
2018-05-10 17:19   ` Kaushal Modi
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=jwvy3gree53.fsf-monnier+gmane.emacs.help@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=help-gnu-emacs@gnu.org \
    /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.