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.bugs Subject: bug#57556: 28.1; Eshell not finding executables in PATH when tramp-integration loaded Date: Sun, 02 Oct 2022 10:48:58 +0200 Message-ID: <87wn9iehl1.fsf@gmx.de> References: <87h715j5gy.fsf@gmx.de> <0480c49e-75da-68c4-d255-242ff65323fe@gmail.com> <87czbsjyby.fsf@gmx.de> <877d1vthto.fsf@gmx.de> <871qrrffzj.fsf@gmx.de> <2d1f17a5-554d-1b1f-7bcb-52e3839d9d0c@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40486"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: coltonlewis@google.com, 57556@debbugs.gnu.org To: Jim Porter Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 02 10:50:10 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1oeufp-000AP0-SU for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 02 Oct 2022 10:50:09 +0200 Original-Received: from localhost ([::1]:45996 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oeufo-0002pi-TA for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 02 Oct 2022 04:50:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36960) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oeufi-0002pa-1G for bug-gnu-emacs@gnu.org; Sun, 02 Oct 2022 04:50:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47158) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oeufh-0006ep-P1 for bug-gnu-emacs@gnu.org; Sun, 02 Oct 2022 04:50:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oeufh-0003AN-Kw for bug-gnu-emacs@gnu.org; Sun, 02 Oct 2022 04:50:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 02 Oct 2022 08:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57556 X-GNU-PR-Package: emacs Original-Received: via spool by 57556-submit@debbugs.gnu.org id=B57556.166470054812099 (code B ref 57556); Sun, 02 Oct 2022 08:50:01 +0000 Original-Received: (at 57556) by debbugs.gnu.org; 2 Oct 2022 08:49:08 +0000 Original-Received: from localhost ([127.0.0.1]:46236 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oeueq-000395-87 for submit@debbugs.gnu.org; Sun, 02 Oct 2022 04:49:08 -0400 Original-Received: from mout.gmx.net ([212.227.17.20]:59295) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oeueo-00038V-Ta for 57556@debbugs.gnu.org; Sun, 02 Oct 2022 04:49:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1664700539; bh=dfaW3nM9nXwsLohvNYfFKUYKthzySqXuKH8hqRaQ1Uk=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date; b=JIBmwALOnuW4QJvIpp8GC43wlr45Aqfwpt+ZSIDFGoBeqTPrEMfe42T88fe9Ljqki thBtur/zAaGrkSJnth5ajDScAspbSm+Sa/IffCnrfC+qirGLX6I8pkSPZa7ngCoMuS nNLO3Dnxpn/oHHaHO+J2m2Ypb21T9EKnrWmyPR3o= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from gandalf.gmx.de ([79.140.112.152]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mkpap-1p4fsi1c0V-00mGCe; Sun, 02 Oct 2022 10:48:59 +0200 In-Reply-To: <2d1f17a5-554d-1b1f-7bcb-52e3839d9d0c@gmail.com> (Jim Porter's message of "Sat, 1 Oct 2022 22:34:50 -0700") X-Provags-ID: V03:K1:0Dyi9JO8DxjrHE6mEwp8E5KNPhGENM0+WvNFLSuOeELqko0L0i3 XK/+XQZirw5W7mpZA1/Uvit3HKNY4q8uPIrg31T9pInJUhfyVwYX7tJrs21rFPQH5qcURYB 4w4R7u2+AhHeOVMwsn/aWM4emoVjzbMqgVddOhzfPlYQ+ur569cBcc0VlEP2EwH+WTeZZXt MTE9wR38e+UO+SF7Kme2g== X-UI-Out-Filterresults: notjunk:1;V03:K0:W8UG5pltBnM=:6FrKeHPg1GOwy/PVuTrW2y XYMNNLIqkvxNVArgJoNGE6stEYbJQeMQRX6vBqQ4Rr6h0F6VRN+gce5xS8lDpK2lvDjJL8mgm t4blQ8m4LgvRDMnNOD7CSowjnrnFVpf+aXFxIhI30v86orm7VyEY55kMJOmlkEJ59bodX7Fvt WsjsCnba2WQnsOQLoL376hZt2lx0jEp3sTML3mTnpD7N/snSkSArHdpvrX+rPhGUAdb/3EK4u iuB7hjpEhYrCjedH9MbxqCkpYN7S1UdLstOQVWrFsUjs/I01mb2PBjpRghewbQUWY/CNvwgZL W3uyp50XUPPu2OPnglnBX6/WToN9YBDemq+3RcbtWhrR8ukeuhzjNyGibWoDaz4vL4TfNv/Ll 4TLWSwE/lJcpgP7ErBKnSx175qKNgxWOACreIggFsBkQyhlW6VB3/3vwZ7fzx/+Zg+99qXtFM 4x9jAiuDab5TY0QMYgqLUY/+IMTPjIfs6DohhkXDC83z93iHOdINoSNjDnb5+59BTE3JpB+qf 2TWUGNRt+eRHOcQPsNta0frI533ITJc6gYrFvnk0wS8q0wRrF/9I1mqYHBmrvyYXwoTl3xBPq z2Ch6llI7YjMLsSPvu+nokXxSYgca+k6GjDlfRxjQLvio43K0fBRT1RDstgAgnEFuYxF7nBrt NtvZMcAPqLdxgyOpSrTdNhKjIUxbKYvFWYgA/W1kSFyE8WfDO+Gd3rTQtxHCB2OeI+SDjk2Lf yiDT+ilwLfc5Om3kErw81jevKpuV8vJ9ajcWEq7BqW5qG+8/Zc4suETHWRFl4Pa7Vue9GFlb X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:244188 Archived-At: Jim Porter writes: Hi Jim, > On 10/1/2022 3:02 PM, Jim Porter wrote: >> On 10/1/2022 1:25 PM, Michael Albinus wrote: >>> Again, no possibility to use connection-local variables? You use them >>> already by calling (path-separator) ... >> I'll take a look at doing that. As I understand it, connection-local >> variables are cleared if the associated connection gets cleaned up, >> right? I wonder if that would be the right thing to do. For example, >> if I cd into a remote host in Eshell, then update Eshell's $PATH for >> that host, then clean up the connection, should the $PATH be reset >> to the default for that host? I'm really not sure... > > After a bit of trying, I wasn't able to get this to work. I was doing > something along these lines: > > (defvar-local eshell-path-env-list nil) > > (connection-local-set-profile-variables > 'eshell-connection-local-profile > '((eshell-path-env-list . nil))) > > (connection-local-set-profiles > nil 'eshell-connection-local-profile) > > ;; When getting the $PATH... > (with-connection-local-variables > (or eshell-path-env-list > (setq eshell-path-env-list (butlast (exec-path))))) > > However, the next time I try to get the $PATH in the > 'with-connection-local-variables' block, the value is nil again, so it > gets recomputed. I guess 'setq' inside > 'with-connection-local-variables' doesn't work? Yes. with-connection-local-variables is designed to provide those variables inside the BODY only. And you have used nil as CRITERIA in connection-local-set-profiles, which means you get the same variables for every kind of default-directory, which means you don't use connection-local variables at all :-) What you need is a permanent setting of variables. Something like (connection-local-set-profiles (connection-local-criteria-for-default-directory 'eshell) 'eshell-connection-local-profile) (let ((enable-connection-local-variables t) connection-local-variables-alist) ;; I'm not sure this is needed. (hack-connection-local-variables-apply (connection-local-criteria-for-default-directory 'eshell)) ;; The body. ...) I have used `eshell' as APPLICATION, the default application would be `tramp'. But since you care only your eshell-* variables, you could use an own namespace I believe. Of course, you could also use `tramp' or anything else, it's your decision. > This is also made more complex by the fact that in an Eshell > subcommand, we want to be able to modify the $PATH locally so that > it's reset to the previous value after the subcommand. In this case, you could use the with-connection-local-variables macro indeed. Something like (let ((connection-local-default-application 'eshell)) (with-connection-local-variables ;; Some temprary modifications. ...) > Since there are so many different things that can alter the $PATH > value, making it connection-local seemed to be more complex in my > experiments. The alist implementation is a bit more primitive, but I > found it easier to reason through the logic. That could just be > because I don't quite understand all the details of connection-local > variables though. It is more complex to set it up, indeed. (I wish we would have made it more friendly.) But in the long term, it will be more robust I believe. Best regards, Michael.