help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Placement of list within an interactive clause


From: Philip Kaludercic
Subject: Re: Placement of list within an interactive clause
Date: Thu, 14 Jul 2022 20:15:13 +0000

carlmarcos--- via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:

> Jul 14, 2022, 18:34 by help-gnu-emacs@gnu.org:
>
>>> Does it make difference where the list statement is placed?
>>>
>>
>> Write the code the way you find most convenient.
>> The syntax is:
>>
>>  (defun FOO (...)
>>  (interactive EXP)
>>  ...)
>>
>> where EXP is *any* code whose evaluation returns a list of values.
>>
>> In that case an interactive call to FOO will behave like (apply #'FOO EXP)
>>
>>  Stefan
>>
>
> When using ` (interactive (list (if condition (body))))', would the
> commands in the body of the if statement form part of the list? Does
> the same apply if using ` (let ' instead of ` (if ', where the body be
> part of the list entries?

The interactive expression evaluates to a list that is applied to the
function.  So when you see

--8<---------------cut here---------------start------------->8---
(defun foo (...)
  (interactive (list arg1 arg2 ... argn))
  ...)
--8<---------------cut here---------------end--------------->8---

you can think imagine that an interactive call does

--8<---------------cut here---------------start------------->8---
(apply #'foo (list arg1 arg2 ... argn))
--8<---------------cut here---------------end--------------->8---



reply via email to

[Prev in Thread] Current Thread [Next in Thread]