[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Placement of list within an interactive clause
From: |
Stefan Monnier |
Subject: |
Re: Placement of list within an interactive clause |
Date: |
Sat, 16 Jul 2022 22:38:18 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
> On the other hand if I want to have multiple function arguments, I should have
>
> (defun myfun (type other-arg)
> (interactive
> (let ( (rqmatch t) (initpk "mixed") (dflt "extended")
> (cseq '("expression" "mixed")) )
> (message "This is a message")
>
> (list
> (completing-read "Flare_type: " cseq nil
> rqmatch initpk nil dflt)
> (completing-read "Other_arg: " cseq nil
> rqmatch initpk nil dflt)))))
For example, yes.
There are many other ways to write such code and the shape if the code
has no importance to `interactive`. All that matters for `interactive`
is the *value* that is returned when the code is done running.
So you can use your above code (re-indented here, and removed the
initial value which is not helpful here (rarely is)):
(defun myfun (type other-arg)
(interactive
(let ((rqmatch t) (dflt "extended") (cseq '("expression" "mixed")))
(message "This is a message")
(list
(completing-read "Flare_type: " cseq nil rqmatch nil nil dflt)
(completing-read "Other_arg: " cseq nil rqmatch nil nil dflt))))
...)
or
(defun myfun (type other-arg)
(interactive
(list
(let ((rqmatch t) (dflt "extended") (cseq '("expression" "mixed")) )
(message "This is a message")
(completing-read "Flare_type: " cseq nil rqmatch nil nil dflt))
(let ((rqmatch t) (dflt "extended") (cseq '("expression" "mixed")) )
(message "This is another message")
(completing-read "Flare_type: " cseq nil rqmatch nil nil dflt))))
...)
or
(defun myfun (type other-arg)
(interactive
(let ((rqmatch t) (dflt "extended") (cseq '("expression" "mixed")))
(message "This is a message")
(let ((x (completing-read "Flare_type: " cseq nil rqmatch nil nil
dflt))
(y (completing-read "Other_arg: " cseq nil rqmatch nil nil
dflt)))
`(,x ,y))))
...)
or
(defun myfun (type other-arg)
(interactive
(let ((rqmatch t) (dflt "extended") (cseq '("expression" "mixed")))
(message "This is a message")
(mapcar (lambda (prompt)
(completing-read prompt cseq nil rqmatch nil nil dflt))
'("Flare_type: " "Other_arg: "))))
...)
or
...
-- Stefan
- Placement of list within an interactive clause, carlmarcos, 2022/07/14
- Re: Placement of list within an interactive clause, Stefan Monnier, 2022/07/14
- Re: Placement of list within an interactive clause, carlmarcos, 2022/07/14
- Re: Placement of list within an interactive clause, Philip Kaludercic, 2022/07/14
- Re: Placement of list within an interactive clause, Stefan Monnier, 2022/07/14
- Re: Placement of list within an interactive clause, carlmarcos, 2022/07/14
- Re: Placement of list within an interactive clause, Stefan Monnier, 2022/07/14
- Re: Placement of list within an interactive clause, carlmarcos, 2022/07/14
- Message not available
- Re: Placement of list within an interactive clause, carlmarcos, 2022/07/16
- Re: Placement of list within an interactive clause,
Stefan Monnier <=
- Message not available
- Re: Placement of list within an interactive clause, carlmarcos, 2022/07/16
- Re: Placement of list within an interactive clause, Stefan Monnier, 2022/07/17
- RE: [External] : Re: Placement of list within an interactive clause, Drew Adams, 2022/07/14
- Re: Placement of list within an interactive clause, carlmarcos, 2022/07/14
- RE: [External] : Re: Placement of list within an interactive clause, Drew Adams, 2022/07/14
- Message not available
- RE: [External] : Re: Placement of list within an interactive clause, carlmarcos, 2022/07/15
Re: Placement of list within an interactive clause, Jean Louis, 2022/07/15