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

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

Re: ‘(vterm local)’ is a malformed function


From: Yuri Khan
Subject: Re: ‘(vterm local)’ is a malformed function
Date: Thu, 3 Aug 2023 23:45:09 +0700

On Thu, 3 Aug 2023 at 22:22, hw <hw@adminart.net> wrote:

> (defun my-connections (fqdns)
>   "Set up a bunch of vterms, some with ssh connections."
>   (if (not (get-buffer "local")) ((vterm "local")
                                    ^
You forgot a ‘progn’ here. In Lisp, you can’t just put a bunch of
forms in parentheses and expect them all to execute sequentially like
they do in C. The first expression in parentheses is expected to be a
function, and the rest will be passed as its arguments.

>                                   (vterm-send-string "cd")
>                                   (vterm-send-return))
>     (message "local terminal seems already open"))

Alternatively, since you have just one form in the ELSE branch, you
could invert the test:

    (if (get-buffer "local")
        (message "local terminal seems already open")
      (vterm "local")
      (vterm-send-string "cd")
      (vterm-send-return))

The THEN branch allows a single form (which could be a ‘(progn …)’ if
you need many); the ELSE branch allows multiple forms.

> It works fine, though I'm getting a warning:
>
>
> ⛔ Warning (comp): connections.el:13:36: Warning: ‘(vterm local)’ is a 
> malformed function
>
>
> What's malformed about it?  It doesn't consider (vterm pretty-name) as
> malformed ... "local" somehow gets unstringyfied?

(vterm pretty-name) is within a function body, which allows multiple forms.



reply via email to

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