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

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

Re: Choosing invokation of list in an interactive clause


From: Yuri Khan
Subject: Re: Choosing invokation of list in an interactive clause
Date: Thu, 4 Apr 2024 22:27:11 +0700

On Thu, 4 Apr 2024 at 21:20, Heime <heimeborgia@protonmail.com> wrote:

>   (interactive
>     (let ( (csel '("Symbol" "Command"))
>            (cseq '("intsl " "iintsl" "iiintsl" "ointsl")) )
>       (list
>         (completing-read "Grapheme: " cseq nil t nil)
>         (completing-read "Selector: " csel nil t nil) )))

This calls ‘completing-read’ twice and wraps the results in a list of
two values.

> Alternative
>
>   (interactive
>     (list
>       (let ( (csel '("Symbol" "Command"))
>              (cseq '("intsl " "iintsl" "iiintsl" "ointsl")) )
>
>         (completing-read "Grapheme: " cseq nil t nil)
>         (completing-read "Selector: " csel nil t nil) )))

This calls ‘completing-read’ twice, discards the first result and
yields the second one as the ‘let’ result. This one gets wrapped in a
list.

If you wanted an equivalent form where ‘let’ were inside ‘list’, it
would look like this:

    (interactive
      (list
        (let ((cseq '("intsl " "iintsl" "iiintsl" "ointsl")))
          (completing-read "Grapheme: " cseq nil t nil))
        (let ((csel '("Symbol" "Command")))
          (completing-read "Selector: " csel nil t nil))))

However, your two bindings, ‘csel’ and ‘cseq’, are only used once
each, never reused, never modified, nor do they have useful
documenting names. You aren’t really gaining anything from them. Could
just inline them and sidestep the whole question.

    (interactive
      (list
        (completing-read "Grapheme: " '("intsl " "iintsl" "iiintsl" "ointsl")
                         nil t nil)
        (completing-read "Selector: " '("Symbol" "Command") nil t nil)))



reply via email to

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