From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tyler Smith Newsgroups: gmane.emacs.help Subject: Re: elisp - only accepting input of known values Date: Wed, 01 Dec 2010 10:41:06 -0500 Message-ID: <874oax33hp.fsf@guruji.demimonde> References: <87oc95lnch.fsf@member.fsf.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1291218153 15808 80.91.229.12 (1 Dec 2010 15:42:33 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 1 Dec 2010 15:42:33 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Dec 01 16:42:29 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PNop9-0002Oz-EY for geh-help-gnu-emacs@m.gmane.org; Wed, 01 Dec 2010 16:42:29 +0100 Original-Received: from localhost ([127.0.0.1]:59672 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PNop8-0002ur-NM for geh-help-gnu-emacs@m.gmane.org; Wed, 01 Dec 2010 10:42:26 -0500 Original-Received: from [140.186.70.92] (port=50177 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PNoo9-0002t1-GL for help-gnu-emacs@gnu.org; Wed, 01 Dec 2010 10:41:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PNoo8-00023Y-IF for help-gnu-emacs@gnu.org; Wed, 01 Dec 2010 10:41:25 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:54803) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PNoo8-00023R-8F for help-gnu-emacs@gnu.org; Wed, 01 Dec 2010 10:41:24 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PNoo7-0001ln-Gk for help-gnu-emacs@gnu.org; Wed, 01 Dec 2010 16:41:23 +0100 Original-Received: from 157.89.133.51 ([157.89.133.51]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 01 Dec 2010 16:41:23 +0100 Original-Received: from tyler.smith by 157.89.133.51 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 01 Dec 2010 16:41:23 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 33 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 157.89.133.51 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:axs+blqU+B13Te8FLVcGD5OQf1w= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:75463 Archived-At: Gary 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