unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: drain <aeuster@gmail.com>, Help-gnu-emacs@gnu.org
Subject: RE: completing-read
Date: Wed, 28 May 2014 11:16:17 -0700 (PDT)	[thread overview]
Message-ID: <926e8399-5b2b-4a32-8131-0bcda2776f86@default> (raw)
In-Reply-To: <1401299088212-323117.post@n5.nabble.com>

> I'm curious what the numbers passed to the completing-read function are
> used for. Here is the example I found online:
> 
> (completing-read
>  "Complete a foo: "
>  '(("foobar1" 1) ("barfoo" 2) ("foobaz" 3) ("foobar2" 4))
>  nil t "fo")
> 
> 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.



  reply	other threads:[~2014-05-28 18:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-28 17:44 completing-read drain
2014-05-28 18:16 ` Drew Adams [this message]
2014-05-29  1:54 ` completing-read lee
2014-05-29  2:17   ` completing-read Drew Adams
2014-05-30  5:12     ` completing-read drain

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=926e8399-5b2b-4a32-8131-0bcda2776f86@default \
    --to=drew.adams@oracle.com \
    --cc=Help-gnu-emacs@gnu.org \
    --cc=aeuster@gmail.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).