From: jdx2172 <dj9027@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: a function more than interactive..
Date: Tue, 11 May 2010 08:57:59 -0700 (PDT) [thread overview]
Message-ID: <e3be1699-e7e6-456e-b26d-c55c5b257cff@e2g2000yqn.googlegroups.com> (raw)
In-Reply-To: lztyqejwer.fsf@informatimago.com
On May 11, 11:22 am, p...@informatimago.com (Pascal J. Bourguignon)
wrote:
> jdx2172 <dj9...@gmail.com> writes:
> > [Dont know what to call this functionality in emacs.. hence the
> > subject "more than interactive..."]
>
> > How do I write a function that when executed prompts the user to enter
> > a value at a prompt, asks another value and so on.. until all the
> > arguments are provided returns a result.
>
> As mentionned by Alan, interactive does it:
>
> (defun my-interactive-command (str num sym buf fil exp)
> (interactive "sGime a string:
> nGime a number:
> SGime a symbol:
> bGime a buffer:
> fGime a file:
> xGime an expression: ")
> (message "Got %S" (list str num sym buf fil exp)))
>
> But perhaps you really want command that is even more interactive than
> that? Then you can use read-from-minibuffer:
>
> (defun my-more-than-interactive-command ()
> (interactive)
> (message "Got %S" (list (read-from-minibuffer "Gime a string: ")
> (parse-number (read-from-minibuffer "Gime a number: "))
> (read-from-string (read-from-minibuffer "Gime a symbol: "))
> ; ...
> )))
>
> But read-from-minibuffer is harder to use than interactive, you will
> have to validate and convert the data yourself. On the other hand, it
> allow you to get user interaction in the middle of your command.
>
> --
> __Pascal Bourguignon__http://www.informatimago.com
Thank you so much.
Very good explanations.
next prev parent reply other threads:[~2010-05-11 15:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-11 13:11 a function more than interactive jdx2172
2010-05-11 13:46 ` Alan Mackenzie
[not found] ` <lztyqejwer.fsf@informatimago.com>
2010-05-11 15:57 ` jdx2172 [this message]
2010-05-11 22:57 ` Tim X
2010-05-12 21:45 ` jdx2172
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e3be1699-e7e6-456e-b26d-c55c5b257cff@e2g2000yqn.googlegroups.com \
--to=dj9027@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.