From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: Interactive and successive completing-reads?
Date: Thu, 28 Oct 2004 10:46:43 -0600 [thread overview]
Message-ID: <2ucm3nF28vdh3U1@uni-berlin.de> (raw)
In-Reply-To: <l4OdndkbZvWUbB3cRVn-iQ@speakeasy.net>
Hattuari wrote:
> I can use this code to prompt the user for successive inputs:
>
> (defun paste-gl-array(gl-type gl-order gl-vector)
> "Map OpenGL types to corresponding sufixes.(GL\'type\' )"
> (interactive "sType: \nnNumber 1 to 4: \nsVector: ")
> (message " gl-type=%s, gl-order=%d, gl-vector=%s, suffix=%s"
> gl-type gl-order gl-vector
> (assoc gl-type gl-type-alist)))
>
>
> I can uses this to prompt the user for specific strings which I
provide in
> gl-type-alist:
>
> (defvar gl-type nil)
>
> (defun gl-data-read ()
> "Read a GLdata type from the minibuffer: "
> (interactive)
> (setq gl-type (completing-read
> "GL Data Type: "
> gl-type-alist
> nil t "GL"))
> (message "gl-type=%s" gl-type)
> )
>
> I would like to do both of the above in one invocation of an interactive
> command. Can this be done by somehow integrating the two forms above?
> Should I, instead, simply evalueate successive `completing-read'
forms from
> one enclosing form and forget about using the first form above?
It depends. The first form allows the user to enter any string, not
just a key from gl-type-alist. Do you want to preserve that freedom for
the user? If so, you can't combine them.
But the conventional way to write the second function is:
(defun gl-type-message (gl-type)
(interactive (list (completing-read "GL Data Type: " gl-type-alist
nil t "GL")))
(message "gl-type=%s" gl-type))
--
Kevin Rodgers
next prev parent reply other threads:[~2004-10-28 16:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-28 13:13 Interactive and successive completing-reads? Hattuari
2004-10-28 16:46 ` Kevin Rodgers [this message]
2004-10-28 22:36 ` Hattuari
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=2ucm3nF28vdh3U1@uni-berlin.de \
--to=ihs_4664@yahoo.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).