From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Giovanni Biscuolo Newsgroups: gmane.comp.gnu.guix.user,gmane.emacs.help Subject: 29.1: tramp: use $SHELL environment variable to start remote shell? Date: Fri, 23 Feb 2024 15:53:10 +0100 Organization: Xelera.eu Message-ID: <87o7c75j1l.fsf@xelera.eu> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5603"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-guix@gnu.org To: help-gnu-emacs@gnu.org Original-X-From: help-guix-bounces+gcggh-help-guix=m.gmane-mx.org@gnu.org Fri Feb 23 16:04:14 2024 Return-path: Envelope-to: gcggh-help-guix@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 1rdX5y-00019M-6t for gcggh-help-guix@m.gmane-mx.org; Fri, 23 Feb 2024 16:04:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdX5F-0007MQ-Qn; Fri, 23 Feb 2024 10:03:29 -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 1rdWvO-0000If-Hv; Fri, 23 Feb 2024 09:53:18 -0500 Original-Received: from ns13.heimat.it ([46.4.214.66]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdWvM-0005dl-Rq; Fri, 23 Feb 2024 09:53:18 -0500 Original-Received: from localhost (ip6-localhost [127.0.0.1]) by ns13.heimat.it (Postfix) with ESMTP id 06DE330081F; Fri, 23 Feb 2024 14:53:13 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at ns13.heimat.it Original-Received: from ns13.heimat.it ([127.0.0.1]) by localhost (ns13.heimat.it [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QN7EPCyISJgn; Fri, 23 Feb 2024 14:53:11 +0000 (UTC) Original-Received: from bourrache.mug.xelera.it (unknown [93.56.171.217]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ns13.heimat.it (Postfix) with ESMTPSA id 4FEA130081A; Fri, 23 Feb 2024 14:53:11 +0000 (UTC) Original-Received: from roquette.mug.biscuolo.net (roquette [10.38.2.14]) by bourrache.mug.xelera.it (Postfix) with SMTP id DF7962ED14FE; Fri, 23 Feb 2024 15:53:10 +0100 (CET) Original-Received: (nullmailer pid 6104 invoked by uid 1000); Fri, 23 Feb 2024 14:53:10 -0000 Received-SPF: pass client-ip=46.4.214.66; envelope-from=g@xelera.eu; helo=ns13.heimat.it X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+gcggh-help-guix=m.gmane-mx.org@gnu.org Original-Sender: help-guix-bounces+gcggh-help-guix=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.comp.gnu.guix.user:17959 gmane.emacs.help:145971 Archived-At: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hello, please is it possible to start a remote shell (and vterm) using the program defined in the $SHELL env variable on the remote host? Alternatively, is there a way to automatically source a remote profile (e.g. .bash_profile) in the remote shell? Short story long (sorry for the long details)... I have this Emacs and TRAMP versions: =2D-8<---------------cut here---------------start------------->8--- (emacs-version) "GNU Emacs 29.1 (build 1, x86_64-unknown-linux-gnu, cairo version 1.16.0)" (tramp-version nil) "2.6.2.0" =2D-8<---------------cut here---------------end--------------->8--- Installed emacs-vterm version: 0.0.2-1.c3a3a23 If I open a remote directory in dired with TRAMP and then connect to a remote host with "M-x shell" or "M-x vterm", the default shell is /bin/sh I can later start my preferred shell with "$SHELL -l" so my shell profile (e.g. .bash_profile) is sourced and all is working as expected [1] I need my remote profile to be loaded because all hosts I manage have Guix [2] installed and all needed environment variables are set by the user profile; here is an example of a "M-x shell" remote connection to a guix host (foreign distro), the same holds for "M-x eshell": =2D-8<---------------cut here---------------start------------->8--- /ssh:local.biscuolo.anemone:/localhome/g/ #$ guix describe guix 3676e31 repository URL: https://git.savannah.gnu.org/git/guix.git commit: 3676e312aaf1ce10ed1d7844e871b54e04624098 /ssh:local.biscuolo.anemone:/localhome/g/ #$ $SHELL -l (anemone)g@anemone:~$ guix describe Generation 9 Apr 21 2021 09:23:33 (current) guix 13c4a37 repository URL: https://git.savannah.gnu.org/git/guix.git branch: master commit: 13c4a377f5a2e1240790679f3d5643385b6d7635 =2D-8<---------------cut here---------------end--------------->8--- (as you can see, without proper environment guix is not able to run as it should) I know that I can customize the remote shell to use by: 1. use "C-u M-x shell" and specify the remote shell to use [3] 2. use connection related information [4] to customize "remote-shell" per-connection (via regexp) but 1. does not vork for vterm and 2. is too complicated for this use case, IMO. Ideally I would like both "M-x shell" and "M-x vterm" to just do "the right thing" and start a remote shell using the remote $SHELL environment variable. Any hint please? Happy hacking, Gio' [1] I mean, is working in the same way I get when connecting with any other terminal emulator [2] some on foreign distro, other on Guix System [3] /bin/bash on foreign distros, /run/current-system/profile/bin/bash on Guix System [4] https://www.gnu.org/software/emacs/manual/html_node/tramp/Predefined-co= nnection-information.html P.S.: yes, still not using eshell as I should! :-( =2D-=20 Giovanni Biscuolo Xelera IT Infrastructures --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJABAEBCgAqFiEERcxjuFJYydVfNLI5030Op87MORIFAmXYsVYMHGdAeGVsZXJh LmV1AAoJENN9DqfOzDkSReYP/iVZSTaBHh+UTIKHJsAzMscZ0dYrOU1FqYWKhBNq Bs+EZGangaLL1OSILnJ+q9+bLeox3NDULpC/Jn60Y+COT9IbKhLiBATiR14FuF/M X6uYbBqkVdM+TAXXlmqLiNL/0Pb8MOOsd4p1I8tKeqYu7kpkT3kBvcI1KKTJc/Ln MiBewdJrHUem8h+hvMk+ENc7eleLVUIWFZLFOU7TMQtCtwuIswWk+M+VYubeLXee NXOZg9pLSQLN8ur6mpr0xpFaS9vcQLS1hv+qmgBJf1sLih1wwHB23o9gVRmK/CrB 1bsWwRwkHpq/satTOvepg/gbnfYu+C5ctok8H//kWx4V5/hBtxOi54+WJJfbRJNt nEimsr3wNRE0eNb4L4H4uD/I5rSje03e4ShKZn7C40VLpfWfeCqxAeyfJziR5Hz+ umkzPDaRdgMkwolmqTIkogLePqLIvChY7191yDgcLQt/rCaRzW5pX0aZbWGoXY8/ bQ8IQSoLL9XW8Bq5dHNYXsVAlLv6osVhGdEmaK7CtQ11KCqBFsQlV/N5dwF+FTzV uvdvHZzPvRxu42jFDmT3XoK10G/pIrcdP/EhgNO0tu8Q+fo7TRikD9pyBgYTidRH rH0iAT61dZBj6Ssim/3knENntswUm255+0Cyx6nmziWW1EIbXjMva5Q6JbnRNBG0 3pZ5 =9gs2 -----END PGP SIGNATURE----- --=-=-=--