From: wenbinye@gmail.com
Subject: Re: `call-interactively' only the first time
Date: 17 Aug 2006 06:35:00 -0700 [thread overview]
Message-ID: <1155821700.844205.150250@74g2000cwt.googlegroups.com> (raw)
In-Reply-To: <1155820770.967587.29970@i42g2000cwa.googlegroups.com>
Maybe I misunderstand you question. You should tell you real problem at
the beginning.
(defun foo (arg1 arg2)
(interactive "nNumber: \nsString: \n")
(message "foo: %S, %S" arg1 arg2)
(setq my-global-arg (list arg1 arg2)))
(defun bar (func)
(let (arg)
(message "first call: ")
(call-interactively func)
(message "call again: ")
(apply func my-global-arg)))
(bar 'foo)
augukarl@yahoo.se wrote:
> wenbinye@gmail.com skrev:
> > You didn't provide the real code,
>
> Of course not. My question is how to write it.
>
> > I assume you may make mistake when use
> > the function in parameter, which is named g in you pseudo code. You
> > should use funcall function.
>
> How can it be a misstake? I haven't written any (real) function-call
> statements.
>
> > Another question is how do you restore the argument when called
> > interactively first time?
>
> Exactly, that's the essence of my question.
Global variable may help.
>
> > (defun foo (arg)
> > (interactive "sGive me a string: ")
> > (message "foo: %S" arg))
> >
> > (defun bar (func)
> > (message "first call: ")
> > (call-interactively func)
> > (message "call again: ")
> > (funcall func "efg"))
> >
> > ;; use like this:
> > (bar 'foo)
>
> This is only a special case. In my pseudo code I put no restrictions on
> the command g (it can take any number of parameters).
>
>
> August
prev parent reply other threads:[~2006-08-17 13:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-15 13:48 `call-interactively' only the first time augukarl
2006-08-16 2:13 ` wenbinye
2006-08-16 9:58 ` augukarl
2006-08-16 15:20 ` wenbinye
2006-08-17 9:05 ` augukarl
2006-08-17 12:02 ` wenbinye
2006-08-17 13:19 ` augukarl
2006-08-17 13:35 ` wenbinye [this message]
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=1155821700.844205.150250@74g2000cwt.googlegroups.com \
--to=wenbinye@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.
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.