* Using conditional in interactive
@ 2024-09-12 21:36 Heime
2024-09-15 19:30 ` Michael Heerdegen
0 siblings, 1 reply; 5+ messages in thread
From: Heime @ 2024-09-12 21:36 UTC (permalink / raw)
To: Heime via Users list for the GNU Emacs text editor
Why does interactive not support using
"s ━ Search Text: \n\
n ━ Number of Context Lines: \n\
s ━ Buffer Name: "
in the following
(interactive
(cond
((eq (nth 0 xiakos-context) 'list)
(list
(read-string " Search Text: ")
(read-number " Number of Context Lines: ")
(read-string " Buffer Name: ")))
(t
"s Search Text: \n\
n Number of Context Lines: \n\
s Buffer Name: ") ))
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Using conditional in interactive
2024-09-12 21:36 Using conditional in interactive Heime
@ 2024-09-15 19:30 ` Michael Heerdegen
2024-09-15 20:50 ` Heime
0 siblings, 1 reply; 5+ messages in thread
From: Michael Heerdegen @ 2024-09-15 19:30 UTC (permalink / raw)
To: Heime; +Cc: Heime via Users list for the GNU Emacs text editor
Heime <heimeborgia@protonmail.com> writes:
> (interactive
>
> (cond
> ((eq (nth 0 xiakos-context) 'list)
>
> (list
> (read-string " Search Text: ")
> (read-number " Number of Context Lines: ")
> (read-string " Buffer Name: ")))
>
> (t
> "s Search Text: \n\
> n Number of Context Lines: \n\
> s Buffer Name: ") ))
I already mentioned why you don't want something like this: in
(interactive EXPR)
the return value of the EXPR is used as argument list, not as an
interactive spec. The EXPR already _is_ the interactive spec.
So to say, you are mixing two unrelated things here.
Michael.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Using conditional in interactive
2024-09-15 19:30 ` Michael Heerdegen
@ 2024-09-15 20:50 ` Heime
2024-09-15 22:22 ` Heime
0 siblings, 1 reply; 5+ messages in thread
From: Heime @ 2024-09-15 20:50 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: Heime via Users list for the GNU Emacs text editor
On Monday, September 16th, 2024 at 7:30 AM, Michael Heerdegen <michael_heerdegen@web.de> wrote:
> Heime heimeborgia@protonmail.com writes:
>
> > (interactive
> >
> > (cond
> > ((eq (nth 0 xiakos-context) 'list)
> >
> > (list
> > (read-string " Search Text: ")
> > (read-number " Number of Context Lines: ")
> > (read-string " Buffer Name: ")))
> >
> > (t
> > "s Search Text: \n\
> > n Number of Context Lines: \n\
> > s Buffer Name: ") ))
>
>
> I already mentioned why you don't want something like this: in
>
> (interactive EXPR)
>
> the return value of the EXPR is used as argument list, not as an
> interactive spec. The EXPR already is the interactive spec.
I am not following your argumunt. Would cond not pass the string and
interactive sees it ? If the first condition is satisfied, the interactive
part work correctly, even though there is a cond expression. Yet, the cond
with a string outputs interprets things completely differently.
> So to say, you are mixing two unrelated things here. - Michael.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Using conditional in interactive
2024-09-15 20:50 ` Heime
@ 2024-09-15 22:22 ` Heime
2024-09-16 5:23 ` Yuri Khan
0 siblings, 1 reply; 5+ messages in thread
From: Heime @ 2024-09-15 22:22 UTC (permalink / raw)
To: Heime; +Cc: Michael Heerdegen,
Heime via Users list for the GNU Emacs text editor
On Monday, September 16th, 2024 at 8:50 AM, Heime <heimeborgia@protonmail.com> wrote:
> On Monday, September 16th, 2024 at 7:30 AM, Michael Heerdegen michael_heerdegen@web.de wrote:
>
> > Heime heimeborgia@protonmail.com writes:
> >
> > > (interactive
> > >
> > > (cond
> > > ((eq (nth 0 xiakos-context) 'list)
> > >
> > > (list
> > > (read-string " Search Text: ")
> > > (read-number " Number of Context Lines: ")
> > > (read-string " Buffer Name: ")))
> > >
> > > (t
> > > "s Search Text: \n\
> > > n Number of Context Lines: \n\
> > > s Buffer Name: ") ))
> >
> > I already mentioned why you don't want something like this: in
> >
> > (interactive EXPR)
> >
> > the return value of the EXPR is used as argument list, not as an
> > interactive spec. The EXPR already is the interactive spec.
>
>
> I am not following your argumunt. Would cond not pass the string and
> interactive sees it ? If the first condition is satisfied, the interactive
> part work correctly, even though there is a cond expression. Yet, the cond
> with a string outputs interprets things completely differently.
>
> > So to say, you are mixing two unrelated things here. - Michael.
From you have described it, the cond should occur before the interactive
clause, ending up with two interactive clause. The one executed would
depend on which condition succeeds.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Using conditional in interactive
2024-09-15 22:22 ` Heime
@ 2024-09-16 5:23 ` Yuri Khan
0 siblings, 0 replies; 5+ messages in thread
From: Yuri Khan @ 2024-09-16 5:23 UTC (permalink / raw)
To: Heime; +Cc: Michael Heerdegen,
Heime via Users list for the GNU Emacs text editor
On Mon, 16 Sept 2024 at 05:23, Heime <heimeborgia@protonmail.com> wrote:
> From you have described it, the cond should occur before the interactive
> clause, ending up with two interactive clause. The one executed would
> depend on which condition succeeds.
An (interactive) clause is not executed. It is metadata which is
consulted before the function starts. You cannot apply normal
executable form reasoning to it.
From the point of view of the interactive call mechanism, there are
three possibilities:
* There is no interactive clause, in which case the function is not
callable interactively
* The first argument of the interactive clause is a string literal, in
which case it is interpreted according to the string interactive spec
rules.
* The first argument is not a string, in which case it is evaluated
and the result passed to the command.
A (cond) form is not a string.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-09-16 5:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-12 21:36 Using conditional in interactive Heime
2024-09-15 19:30 ` Michael Heerdegen
2024-09-15 20:50 ` Heime
2024-09-15 22:22 ` Heime
2024-09-16 5:23 ` Yuri Khan
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).