unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Brian Cully <bjc@spork.org>
Cc: "Brian Cully via Emacs development discussions."
	<emacs-devel@gnu.org>,
	Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
Subject: Re: eglot and tramp
Date: Fri, 18 Nov 2022 16:51:43 +0100	[thread overview]
Message-ID: <87sfigw99s.fsf@gmx.de> (raw)
In-Reply-To: <875yfeyizi.fsf@gmx.de> (Michael Albinus's message of "Wed, 16 Nov 2022 17:14:25 +0100")

[-- Attachment #1: Type: text/plain, Size: 2285 bytes --]

Michael Albinus <michael.albinus@gmx.de> writes:

Hi Brian,

>>> Great! Since you are a regular eglot+Tramp user, could I ask you for a
>>> test?
>>>
>>> I assume you are using Tramp with ssh or scp. If you also don't use a
>>> password (for example via public key authentication), please try the
>>> following setting:
>>>
>>> --8<---------------cut here---------------start------------->8---
>>> (add-to-list 'tramp-connection-properties
>>>              (list (regexp-quote "/ssh:user@host:")
>>>                    "direct-async-process" t))
>>> --8<---------------cut here---------------end--------------->8---
>>>
>>> "/ssh:user@host:" must be adapted of course, and you must set this prior
>>> opening a connection to this remote path. This should give you better
>>> performance when starting the language server.
>>
>> I use eglot+Tramp with various containers (nspawn, docker, podman),
>> which don't support the ‘tramp-direct-async’ flag, so I'm not sure how
>> helpful this testing would be.
>
> Good point. I haven't checked docker, podman and friends yet whether
> they do suuport direct async processes. Short check: they don't yet. I
> will work on adding this feature in Tramp.
>
>> If it's safe enough, I'd be happy to flag support for direct-async in
>> the methods and do the above test.
>
> I'll come back to you when Tramp is prepared.

I gave it a shot. Appended is a patch, which improves
tramp-handle-make-process in tramp.el. The method specifications in
tramp-container.el are extended by the line

--8<---------------cut here---------------start------------->8---
		(tramp-direct-async (,tramp-default-remote-shell "-c"))
--8<---------------cut here---------------end--------------->8---

Locally, I have tested it with the methods "docker" and "kubernetes", it
seems to work. I couldn't test with "podman", because I haven't such a
system just now.

For "nspawn" I cannot say anything, I don't use it. Perhaps it is
sufficient to add a similar line in its tramp-methods specification,
don't know. You as author might know it better. And if it works
sufficiently, we might also think about integrating it into
tramp-container.el. But this would be another story.

>> -bjc

Best regards, Michael.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 2232 bytes --]

diff --git a/lisp/tramp-container.el b/lisp/tramp-container.el
index 0879d6f1..7b942532 100644
--- a/lisp/tramp-container.el
+++ b/lisp/tramp-container.el
@@ -163,6 +163,7 @@ see its function help for a description of the format."
                                    ("-u" "%u")
                                    ("%h")
 			           ("%l")))
+		(tramp-direct-async (,tramp-default-remote-shell "-c"))
                 (tramp-remote-shell ,tramp-default-remote-shell)
                 (tramp-remote-shell-login ("-l"))
                 (tramp-remote-shell-args ("-i" "-c"))))
@@ -174,6 +175,7 @@ see its function help for a description of the format."
                                    ("-u" "%u")
                                    ("%h")
 			           ("%l")))
+		(tramp-direct-async (,tramp-default-remote-shell "-c"))
                 (tramp-remote-shell ,tramp-default-remote-shell)
                 (tramp-remote-shell-login ("-l"))
                 (tramp-remote-shell-args ("-i" "-c"))))
@@ -186,6 +188,7 @@ see its function help for a description of the format."
                                    ("--")
 			           ("%l")))
 		(tramp-config-check tramp-kubernetes--current-context-data)
+		(tramp-direct-async (,tramp-default-remote-shell "-c"))
                 (tramp-remote-shell ,tramp-default-remote-shell)
                 (tramp-remote-shell-login ("-l"))
                 (tramp-remote-shell-args ("-i" "-c"))))
diff --git a/lisp/tramp.el b/lisp/tramp.el
index f20a1fc3..003912f8 100644
--- a/lisp/tramp.el
+++ b/lisp/tramp.el
@@ -4836,7 +4836,14 @@ substitution.  SPEC-LIST is a list of char/value pairs used for
 	       (command
 	        (append
 		 `("cd" ,(tramp-shell-quote-argument localname) "&&" "(" "env")
-		 env `(,command ")"))))
+		 env `(,command ")")))
+		;; Add remote shell if needed.
+	       (command
+		(if (consp (tramp-get-method-parameter v 'tramp-direct-async))
+		    (append
+		     (tramp-get-method-parameter v 'tramp-direct-async)
+ 		     `(,(mapconcat #'identity command " ")))
+		  command)))

 	  ;; Check for `tramp-sh-file-name-handler', because something
 	  ;; is different between tramp-sh.el, and tramp-adb.el or

  reply	other threads:[~2022-11-18 15:51 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-14  8:20 eglot and tramp Pedro Andres Aranda Gutierrez
2022-11-15  1:18 ` Brian Cully via Emacs development discussions.
2022-11-15 15:33   ` Michael Albinus
2022-11-15 17:45     ` Brian Cully via Emacs development discussions.
2022-11-15 19:46       ` Michael Albinus
2022-11-16 12:29         ` Brian Cully via Emacs development discussions.
2022-11-16 16:14           ` Michael Albinus
2022-11-18 15:51             ` Michael Albinus [this message]
2022-11-19 16:24               ` Brian Cully via Emacs development discussions.
2022-11-20 13:50                 ` Michael Albinus
2022-11-21 11:51                   ` Brian Cully via Emacs development discussions.
2022-11-21 12:11                     ` Michael Albinus
     [not found] <87y2oocltq.fsf@gmail.com>
     [not found] ` <87pn9v19e8.fsf@gmx.de>
2020-06-19 13:23   ` Eglot and Tramp João Távora
2020-06-19 13:44     ` Michael Albinus
2020-06-19 14:09       ` João Távora
2020-06-19 14:43         ` Michael Albinus
2020-06-19 14:45           ` João Távora
2020-06-19 14:54             ` Michael Albinus
2020-06-19 16:18               ` João Távora
2020-06-19 16:28                 ` Michael Albinus
2020-06-19 16:30                   ` João Távora
2020-06-19 16:32                     ` João Távora
2020-06-19 16:39                       ` Michael Albinus
2020-06-19 16:45                         ` João Távora
2020-06-19 17:30                           ` Michael Albinus
2020-06-19 17:36                             ` João Távora
2020-06-19 17:47                               ` Dmitry Gutov
2020-06-19 18:01                                 ` Michael Albinus

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87sfigw99s.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=bjc@spork.org \
    --cc=emacs-devel@gnu.org \
    --cc=paaguti@gmail.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).