From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: completing-read Date: Wed, 28 May 2014 11:16:17 -0700 (PDT) Message-ID: <926e8399-5b2b-4a32-8131-0bcda2776f86@default> References: <1401299088212-323117.post@n5.nabble.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1401301022 22676 80.91.229.3 (28 May 2014 18:17:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 28 May 2014 18:17:02 +0000 (UTC) To: drain , Help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed May 28 20:16:55 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WpiPG-0005BF-AH for geh-help-gnu-emacs@m.gmane.org; Wed, 28 May 2014 20:16:54 +0200 Original-Received: from localhost ([::1]:44185 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WpiPF-0004vt-MO for geh-help-gnu-emacs@m.gmane.org; Wed, 28 May 2014 14:16:53 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57228) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WpiOw-0004uL-2x for Help-gnu-emacs@gnu.org; Wed, 28 May 2014 14:16:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WpiOm-0004x7-Pp for Help-gnu-emacs@gnu.org; Wed, 28 May 2014 14:16:34 -0400 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:48190) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WpiOm-0004wx-KF for Help-gnu-emacs@gnu.org; Wed, 28 May 2014 14:16:24 -0400 Original-Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s4SIGKqd020095 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 28 May 2014 18:16:21 GMT Original-Received: from aserz7021.oracle.com (aserz7021.oracle.com [141.146.126.230]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s4SIGJ0j029830 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 28 May 2014 18:16:20 GMT Original-Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by aserz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s4SIGJIr003458; Wed, 28 May 2014 18:16:19 GMT In-Reply-To: <1401299088212-323117.post@n5.nabble.com> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8 (707110) [OL 12.0.6691.5000 (x86)] X-Source-IP: ucsinet21.oracle.com [156.151.31.93] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 141.146.126.69 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:97915 Archived-At: > I'm curious what the numbers passed to the completing-read function are > used for. Here is the example I found online: >=20 > (completing-read > "Complete a foo: " > '(("foobar1" 1) ("barfoo" 2) ("foobaz" 3) ("foobar2" 4)) > nil t "fo") >=20 > This function appears to work fine without the 1, 2, 3, 4. You would probably need to look at the context of the example you cite, to see why they used an alist or that particular alist. As to whether it is *necessary* to use an alist: no. 1. If by "without the 1,2,3,4" you mean (("foobar1") ("barfoo)...) then yes. That has always worked just as well. 2. If you instead mean ("foobar1" "barfoo"...) then yes, that works just as well also. However, in older versions of Emacs the second arg, if a list, had to be a proper alist. You could not pass just a list of strings. 3. The real point behind having an alist argument is that the arg *can* be an alist. There are lots of ready-to-hand alists in Emacs. You can pass an alist as arg directly, without first mapping over it to get its cars.