all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
Subject: RE: limit input allowed by read-from-minibuffer?
Date: Fri, 24 Feb 2006 14:28:17 -0800	[thread overview]
Message-ID: <DNEMKBNJBGPAOPIJOOICCEPODCAA.drew.adams@oracle.com> (raw)
In-Reply-To: <1140730737.029372.218440@z34g2000cwc.googlegroups.com>

    I want to prompt for a value in the minibuffer and only accept the
    input if it matches one of the choices presented in my prompt string.
    How do I do this?

    (defun example()
      (interactive)
      (setq read_method(read-from-minibuffer "Read Method?
    [<,>,>>,+<,+>,+>>] " nil nil nil nil "<")))

You want `completing-read', not `read-from-minibuffer'. That will: 1) let
users complete their input to any of the possible values, and 2) require
that their input be one of those values. Use non-nil for the REQUIRE-MATCH
argument.

  reply	other threads:[~2006-02-24 22:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-23 21:38 limit input allowed by read-from-minibuffer? bturnip
2006-02-24 22:28 ` Drew Adams [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-02-23 21:39 bturnip
2006-02-23 23:30 ` B. T. Raven
2006-02-24 19:45   ` bturnip

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=DNEMKBNJBGPAOPIJOOICCEPODCAA.drew.adams@oracle.com \
    --to=drew.adams@oracle.com \
    /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.