all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Yuri Khan <yuri.v.khan@gmail.com>
To: hw <hw@adminart.net>
Cc: help-gnu-emacs@gnu.org
Subject: Re: ‘(vterm local)’ is a malformed function
Date: Thu, 3 Aug 2023 23:45:09 +0700	[thread overview]
Message-ID: <CAP_d_8W_LJYVJ-SPxhPMe5NjeoDiHGOiFPAuZJyVcGqX-7754A@mail.gmail.com> (raw)
In-Reply-To: <80031dc033efbe0ac0e8b337f33712d46970d221.camel@adminart.net>

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	other threads:[~2023-08-03 16:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-03 15:22 ‘(vterm local)’ is a malformed function hw
2023-08-03 16:45 ` Yuri Khan [this message]
2023-08-03 19:25   ` hw
2023-08-04  5:26     ` Yuri Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAP_d_8W_LJYVJ-SPxhPMe5NjeoDiHGOiFPAuZJyVcGqX-7754A@mail.gmail.com \
    --to=yuri.v.khan@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=hw@adminart.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.