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: carlmarcos
Subject: Re: Placement of list within an interactive clause
Date: Sun, 17 Jul 2022 01:01:30 +0200 (CEST)


Jul 14, 2022, 21:12 by monnier@iro.umontreal.ca:

> carlmarcos@tutanota.com [2022-07-14 22:52:43] wrote:
>
>> My question was about how I can determine which parts are used to fill
>> elements to the list.  Whether it is from the body of `if' and `let'
>> clauses.  Perhaps I was not so articulate in the choice of words.
>>
>
> And my answer is that the expression returns a list and the origin of
> each part of the list is determined by the general semantics of Emacs
> Lisp (which is basically the same as that of all other programming
> languages in this respect).
>
>  Stefan
>
I have been reading as instructed.  

In summary. `(let` is a special function form. And a function in lisp returns 
the value of the last expression evaluated as the  return value.

Consequently, the following function will only take the last expression in the 
`let' body (completing-read) to fill an element of a list for setting the 
function argument `type'.

(defun myfun (type)
(interactive
(list
  (let ( (rqmatch t) (initpk "mixed") (dflt "extended")
(cseq '("expression" "mixed")) )
    (message "This is a message")
    (completing-read "Flare_type: " cseq nil rqmatch initpk nil dflt)))))

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)))))






reply via email to

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