all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>, help-gnu-emacs@gnu.org
Subject: RE: `completing-read` without RET
Date: Fri, 11 Mar 2016 08:08:08 -0800 (PST)	[thread overview]
Message-ID: <46dc9263-f168-4f2e-b052-120e1184fcba@default> (raw)
In-Reply-To: <jwvk2l9f893.fsf-monnier+gmane.emacs.help@gnu.org>

> >> Is there a function with the same behaviour of `completing-read`, except
> >> that it doesn't need RET when only one completion exists?
> 
> > Of course, it's called `completing-read'.
> > You just have to configure its TAB key accordingly.
> > I.e. rebind TAB in minibuffer-local-completion-map from
> > `minibuffer-complete' to a new command which does what you want.
> 
> Oh, actually, I think I misunderstood your question and there's an even
> closer answer: just provide a neither-nil neither-t value for the
> `require-match' argument or `completing-read'.

No, I don't think so.

 (completing-read "Choose: " '("a") nil 'foobar)

Choose:
Nothing happens.

Choose: TAB
Choose: a
Nothing happens.

Choose: a
Nothing happens.

Choose: a TAB
Nothing happens.

---

FWIW, If you use Icicles, if you set option
`icicle-top-level-when-sole-completion-flag' to non-nil then
completion (e.g. TAB) chooses the only match for your input.

In the examples above where TAB is used, the result is the
same as hitting RET: the sole match (in this case also the
sole candidate) is chosen.

But beware that you might not always want this behavior
(which is why it is not the default behavior).  If you
accidentally type the wrong thing then you don't get a
chance to change your mind.  (Of course, that's what you've
said you are after: quicker choosing.)



  reply	other threads:[~2016-03-11 16:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-11 11:36 `completing-read` without RET egarrulo
2016-03-11 13:22 ` Stefan Monnier
2016-03-11 13:36   ` Stefan Monnier
2016-03-11 16:08     ` Drew Adams [this message]
2016-03-11 16:50       ` Stefan Monnier
2016-03-11 17:07         ` Drew Adams
2016-03-11 22:45           ` Stefan Monnier
2016-03-11 23:49             ` Drew Adams
     [not found]             ` <mailman.7363.1457740186.843.help-gnu-emacs@gnu.org>
2016-03-12 12:01               ` egarrulo
2016-04-11  9:01 ` Oleh Krehel

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=46dc9263-f168-4f2e-b052-120e1184fcba@default \
    --to=drew.adams@oracle.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.