[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: elisp - only accepting input of known values
From: |
Tyler Smith |
Subject: |
Re: elisp - only accepting input of known values |
Date: |
Wed, 01 Dec 2010 10:41:06 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
Gary <help-gnu-emacs@garydjones.name> writes:
> Tassilo Horn wrote:
>> Gary writes:
>>
>>> Is it somehow possible to accept input from a set of known values (and
>>> only those values), possibly based on regex but I'm not married to
>>> that idea?
>>
>> What exactly do you mean with "input"? Input to what? A function?
>
> User input.
completing-read does this. The info file is here:
(info "(elisp)Minibuffer Completion")
The help reads, in part:
completing-read is a built-in function in `C source code'.
(completing-read PROMPT COLLECTION &optional PREDICATE REQUIRE-MATCH
INITIAL-INPUT HIST DEF INHERIT-INPUT-METHOD)
Read a string in the minibuffer, with completion.
PROMPT is a string to prompt with; normally it ends in a colon and a space.
COLLECTION can be a list of strings, an alist, an obarray or a hash table.
COLLECTION can also be a function to do the completion itself.
PREDICATE limits completion to a subset of COLLECTION.
See `try-completion' and `all-completions' for more details
on completion, COLLECTION, and PREDICATE.
Tyler