From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.devel Subject: Re: eglot and tramp Date: Fri, 18 Nov 2022 16:51:43 +0100 Message-ID: <87sfigw99s.fsf@gmx.de> References: <878rkddngy.fsf@ditto.jhoto.spork.org> <875yfgkza3.fsf@gmx.de> <875yfgdscr.fsf@ditto.jhoto.spork.org> <87v8ng6lxe.fsf@gmx.de> <8735ajdqw3.fsf@ditto.jhoto.spork.org> <875yfeyizi.fsf@gmx.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40092"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: "Brian Cully via Emacs development discussions." , Pedro Andres Aranda Gutierrez To: Brian Cully Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Nov 18 16:52:31 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ow3fK-000AHk-PD for ged-emacs-devel@m.gmane-mx.org; Fri, 18 Nov 2022 16:52:30 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ow3el-0001nV-UE; Fri, 18 Nov 2022 10:51:55 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ow3ej-0001my-Dh for emacs-devel@gnu.org; Fri, 18 Nov 2022 10:51:54 -0500 Original-Received: from mout.gmx.net ([212.227.15.19]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ow3eh-0002Tp-7o for emacs-devel@gnu.org; Fri, 18 Nov 2022 10:51:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1668786704; bh=k+cglCinmEOQDyIVwiZcjQJTwjxH4NkR91ZsQtLO5OY=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date; b=I6TK5HXJGxw/ixuliFPXGH8PB+Kl20xBb9n68JRMjvpT1H9aM+HA8EXa959/ZjRI5 /3a4cj+EhVCFs65EVIPbYN4eWD1V3siUsb09wguJZ1P9bhJhfharEqew92ZbQPwKzs WTKgpOzHtyoIlE4cwwnNoSFTciyEV6mm0m+cQT+hfm8/zhOzozNwX5DYSHojxKmYAI dPqKCIxY5n9jMyOS3Jvwp2IWGOB/2EeMAAcQlpgcZDKU6k0IZfr8C+hLgbbKgOY9OJ 9QBueeLMjFFMT0SF3w4XHCHSX4cGhi+o21AHV5JFS3GCcbLYaWFFlCqYN8J7Xd8WDB ItoAKbuLMOmMA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from gandalf.gmx.de ([185.89.39.6]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MpUUw-1pIzwi2rCG-00pvBA; Fri, 18 Nov 2022 16:51:44 +0100 In-Reply-To: <875yfeyizi.fsf@gmx.de> (Michael Albinus's message of "Wed, 16 Nov 2022 17:14:25 +0100") X-Provags-ID: V03:K1:ETi3OhWfh4ZnYZuOFwlNOwqsr0uqwFF1BVP+hZvog7EpZI6AbNW xEno/5efO0TQNEDQdKVPuuVu55zXW5Iv0YZze4WIGOcFvWygTsjBaMWwdVkPafl2sA+QZQD GnT0ykHCYd434WwagQxGMUIhnIK4Zrv9Kg2/78Z02KSyelpHQjKLuv18BpCR0xTO9aVeUok QGXBdvfYCO1EV/aWBA4Fw== UI-OutboundReport: notjunk:1;M01:P0:vlpoPcc7OYw=;X7BaUrSKzVBKEgALTumJrrznza7 sr8Y0a0cvoAL06LV5q1EpcXQz9U/vtWHMKlegZ30cHuL7vlMeUSWLv4lUioFUxzUJtCdKQrf+ 3ECE+Bj5+QtDe8mpBYq+g140rz5TFXmRsb9xW3kKy/xsabK7fvCOcx8KhkYSo5MbGZ6Zbd1al yKKQ/qOp1n6lfx6zctXC4/g1QdrEqZFgULSnkeWyzWlf+8pAxp1ySmZa8CH2LICG2WIL+qzBX Wlup/Y0x+yZIyUtNU6EH8G/0gzF732i4vUg/aKHxOS/KXFJMo/oBmV2f8zrj2pVbnTyVRRMA6 H0vDjeP1KVt9/27VXp8l+5vutyLvJ43nNlwD3UiNJEhaQiewoXualixUpJJEJMyuGezYGhsbm /Xr9CWzIW6pjQe7XdxGNP0ahPR5jqoTIMQZIZuorbVeuRTrqN/AgqqTNV526ayXhnkDrvKAUJ bhd7Mh6X+6fBEB3ssVZXnqMdVNk3xwsTHi67dhKRwiibfX+EcY3jwYphiHDu5OnAQ76Ysjb16 D6yulrYxRMJHmAkNTDgCAt2COUPdkUp44Dj+/VTYGuryQQMui0bkuxyKFVxSQ8SN9NDAgKNG9 hf6BO9YXA3w8lLDmmjYWnpyMEUhGiUiSnszc7acg+1cyxust/UErE7Ru2lMOeKr/fykD4j7Li m0lB/amsCnnXWMDbYYu68SUTLrgVXNXJ1UBHwrDbUmg2SWZNU2JZkmH04sGBfIg1La+ZBDR8L 3EfvxJQ2n63jPKXstMYcxTEpMQtjqcvEVvml5tsyAimW+UphNoCXvlGCkQHHGwyS+G+tFYB9 Received-SPF: pass client-ip=212.227.15.19; envelope-from=michael.albinus@gmx.de; helo=mout.gmx.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:300114 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Michael Albinus 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 =E2=80=98tramp-direct-async=E2=80=99 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. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment Content-Transfer-Encoding: quoted-printable diff --git a/lisp/tramp-container.el b/lisp/tramp-container.el index 0879d6f1..7b942532 100644 =2D-- 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 =2D-- a/lisp/tramp.el +++ b/lisp/tramp.el @@ -4836,7 +4836,14 @@ substitution. SPEC-LIST is a list of char/value pa= irs 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 --=-=-=--