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

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

RE: limit input allowed by read-from-minibuffer?


From: Drew Adams
Subject: RE: limit input allowed by read-from-minibuffer?
Date: Fri, 24 Feb 2006 14:28:17 -0800

    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 via email to

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