From: Drew Adams <drew.adams@oracle.com>
To: Thorsten Jolitz <tjolitz@gmail.com>, help-gnu-emacs@gnu.org
Subject: RE: How to write (interactive) with user-selection from predefined enumeration? (was Re: (interactive "rP") valid?)
Date: Tue, 28 May 2013 10:27:44 -0700 (PDT) [thread overview]
Message-ID: <061d4281-1056-4df6-993d-9c4a845bbe50@default> (raw)
In-Reply-To: <87fvx7cayr.fsf_-_@gmail.com>
> OK, I did read the 'interactive' section of the manual again, but I did
> not find the answer to this question (although it is most likely there,
> somehere):
Hm. "Most likely there somewhere". Does that mean that you did not spend
time looking for it or you did spend time and couldn't find it?
If the latter, use `M-x report-emacs-bug', to let Emacs Dev know what's
missing - say just how you looked and what you think would have made your
search easier. Emacs Dev is usually open to improvement suggestions, such
as adding index entries or clarifying the text.
If the former, I have only a little sympathy. Sure, it might seem easier
to write a question here (and again, there is nothing wrong with that).
But learning to take advantage of the Emacs doc and help system
(`C-h f interactive') yourself is a win for everyone, especially you.
> How to write an interactive function and let the user choose from a list
> (an enumeration) of possible solutions as input (like: Item1 | Item2 |
> Item3)?
Wrt the original question, (elisp) `Using Interactive' (the first target reached
from `i interactive') gives two examples using \n, and it says:
"It may be a string; its contents are a sequence of elements separated
by newlines, one for each argument(1)."
And that node cross-references node `Interactive Codes', which explains more.
As to your new question, what is each ItemN? Just any old name, or the name
of a particular kind of Emacs object?
Node `Interactive Codes' explains about code chars that allow for completion
(of choices). It says that you get this for choosing the name of a function,
buffer, command, directory, file, user option, or coding system.
Beyond that, node `Using Interactive' explains that the `interactive' spec can
be a Lisp sexp that returns a list of args to be passed to the command. You
really cannot get more general than that: you can do pretty much anything here.
`Using Interactive' explains how to code such a list. As one example, you can
use `completing-read' to read a user choice among any kind of completion
candidates (not just names of functions, buffers, commands, directories, files,
options, and coding systems).
What more do you need? The manual is your friend.
next prev parent reply other threads:[~2013-05-28 17:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-28 11:15 (interactive "rP") valid? Thorsten Jolitz
2013-05-28 11:38 ` Andreas Röhler
2013-05-28 11:42 ` Thorsten Jolitz
2013-05-28 13:20 ` Drew Adams
2013-05-28 14:36 ` Thorsten Jolitz
2013-05-28 15:13 ` Drew Adams
2013-05-28 16:42 ` How to write (interactive) with user-selection from predefined enumeration? (was Re: (interactive "rP") valid?) Thorsten Jolitz
2013-05-28 17:27 ` Drew Adams [this message]
2013-05-28 18:46 ` Thorsten Jolitz
[not found] ` <mailman.511.1369747231.22516.help-gnu-emacs@gnu.org>
2013-05-28 15:35 ` (interactive "rP") valid? Joost Kremers
[not found] ` <mailman.521.1369756484.22516.help-gnu-emacs@gnu.org>
2013-05-30 10:34 ` Joost Kremers
[not found] ` <<slrnkq9jm0.2vb.joostkremers@j.kremers4.news.arnhem.chello.nl>
2013-05-28 15:54 ` Drew Adams
[not found] <<87mwrfe4oy.fsf@gmail.com>
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=061d4281-1056-4df6-993d-9c4a845bbe50@default \
--to=drew.adams@oracle.com \
--cc=help-gnu-emacs@gnu.org \
--cc=tjolitz@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).