* cl-defun not (really) working with `interactive'?
@ 2014-08-02 10:07 Thorsten Jolitz
2014-08-03 18:13 ` Michael Heerdegen
0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Jolitz @ 2014-08-02 10:07 UTC (permalink / raw)
To: help-gnu-emacs
Hi List,
function `foo1' works as expected:
#+begin_src emacs-lisp
(defun foo1 (arg1 arg2)
(interactive
(list (ido-completing-read "ARG1: " '("A" "B" "C"))
(ido-completing-read "ARG2: " '("1" "2" "3"))))
(message "ARGS: %s%s" arg1 arg2))
#+end_src
#+results:
: foo1
#+begin_src emacs-lisp
(call-interactively 'foo1)
#+end_src
#+results:
: ARGS: B2
while function `foo2' seems to work
#+begin_src emacs-lisp
(defun* foo2 (&key arg1 arg2 &allow-other-keys)
(interactive
(list (ido-completing-read "ARG1: " '("A" "B" "C"))
(ido-completing-read "ARG2: " '("1" "2" "3"))))
(message "ARGS: %s%s" arg1 arg2))
#+end_src
#+results:
: foo2
#+begin_src emacs-lisp
(call-interactively 'foo2)
#+end_src
#+results:
: ARGS: nilnil
but does not set the argument variables. Bug or known limitation?
--
cheers,
Thorsten
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: cl-defun not (really) working with `interactive'?
2014-08-02 10:07 cl-defun not (really) working with `interactive'? Thorsten Jolitz
@ 2014-08-03 18:13 ` Michael Heerdegen
0 siblings, 0 replies; 2+ messages in thread
From: Michael Heerdegen @ 2014-08-03 18:13 UTC (permalink / raw)
To: help-gnu-emacs
Thorsten Jolitz <tjolitz@gmail.com> writes:
> #+begin_src emacs-lisp
> (defun* foo2 (&key arg1 arg2 &allow-other-keys)
> (interactive
> (list (ido-completing-read "ARG1: " '("A" "B" "C"))
> (ido-completing-read "ARG2: " '("1" "2" "3"))))
> (message "ARGS: %s%s" arg1 arg2))
> #+end_src
>
> #+results:
> : foo2
>
> #+begin_src emacs-lisp
> (call-interactively 'foo2)
> #+end_src
>
> #+results:
> : ARGS: nilnil
>
> but does not set the argument variables. Bug or known limitation?
Neither nor, I think. Also
(foo2 "A" 2)
(non-interactively) prints
"ARGS: nilnil"
Obviously, you must explicitly specify the keys to bind key arguments in
cl'ish defuns:
(foo2 :arg1 "A" :arg2 2)
I think arguments you want to bind with `interactive' must be "standard"
arguments.
Regards,
Michael.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-08-03 18:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-02 10:07 cl-defun not (really) working with `interactive'? Thorsten Jolitz
2014-08-03 18:13 ` Michael Heerdegen
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).