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#54459: 29.0.50; Simplify connection-local variables (feature request) Date: Sun, 20 Mar 2022 19:17:18 +0100 Message-ID: <877d8ocwup.fsf@gmx.de> References: <87bky2zjzz.fsf.ref@aol.com> <87bky2zjzz.fsf@aol.com> <87fsncdgw3.fsf@gmx.de> <20220320120955.54fc67ohdot35aln@Ergus> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8394"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 54459@debbugs.gnu.org To: Ergus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Mar 20 19:18:11 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 1nW083-00021i-26 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 20 Mar 2022 19:18:11 +0100 Original-Received: from localhost ([::1]:39848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nW081-00013s-Jo for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 20 Mar 2022 14:18:09 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:43798) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nW07v-00013X-16 for bug-gnu-emacs@gnu.org; Sun, 20 Mar 2022 14:18:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41230) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nW07u-0008Ob-Mp for bug-gnu-emacs@gnu.org; Sun, 20 Mar 2022 14:18:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nW07u-00012o-En for bug-gnu-emacs@gnu.org; Sun, 20 Mar 2022 14:18:02 -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, 20 Mar 2022 18:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54459 X-GNU-PR-Package: emacs X-Debbugs-Original-Cc: 54459@debbugs.gnu.org, "Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors" Original-Received: via spool by submit@debbugs.gnu.org id=B.16478002533979 (code B ref -1); Sun, 20 Mar 2022 18:18:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 20 Mar 2022 18:17:33 +0000 Original-Received: from localhost ([127.0.0.1]:35127 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nW07Q-000126-Q3 for submit@debbugs.gnu.org; Sun, 20 Mar 2022 14:17:33 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:45502) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nW07Q-000120-3s for submit@debbugs.gnu.org; Sun, 20 Mar 2022 14:17:32 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:43732) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nW07P-00010M-VY for bug-gnu-emacs@gnu.org; Sun, 20 Mar 2022 14:17:31 -0400 Original-Received: from mout.gmx.net ([212.227.17.22]:45681) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nW07N-0008LU-Tx for bug-gnu-emacs@gnu.org; Sun, 20 Mar 2022 14:17:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1647800240; bh=cXRL0z8r1GHnS199EKYxGLSD5h/PaLrwtlj/STZdHYc=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=lALNDUgRXhSqBvERfddkV443tDpBWq7LMItDAknXrvWhIbimTp/MuIzI4cmxyPxol UkvbDBVHzMqHAliw5BDOqs8TcrUfTvvM0jPpiKPJeJWIMRybfCj/+87GoXKOXJ5+Ed gNeqx0whBK7mqOKKpyVWmUuU415/RXXuIriNObDI= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from gandalf.gmx.de ([213.220.159.32]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M6Daq-1nToFs0iUa-006bio; Sun, 20 Mar 2022 19:17:20 +0100 In-Reply-To: <20220320120955.54fc67ohdot35aln@Ergus> (Ergus's message of "Sun, 20 Mar 2022 13:09:55 +0100") X-Provags-ID: V03:K1:h8NUEYKPflvOMuG07rVVoURVNJA6VZdG9xDa9P+pstK0X1gIv6G Mv9XzL53n4sEQZ1PYugReCcQhpNazdQXzUWPJdDgkLCptzHa1HHgy3TTeEFZTIdsMsUdRCg cEbr2GLzhGZ0FAp1zAPc7YupF4G79org0ayl6tMGyfcbWgdjPNA1Vss50ObMtblsq7xNt3O B51ZOFshHzrCY/bh60Q1Q== X-UI-Out-Filterresults: notjunk:1;V03:K0:+ph4rpKfRvM=:ieJeJzfHiz9+g5myisHLxw QJ+nPo0ujhOBSYZlUQZ3Bwo8/CXlCtyvwvBgcRTEukjAe8FSndmRkPOdZBzlAB2d27Fe+UT4c YwZP80jPeFoyXVFlaThTvrbCJgdvKQXG5eNVxNSxBemMAC6Ie7Hp9xqWlIl/Mhq43sJmgXtTt rjVM5CsjrlSpTRGALoWQaH3sd3zeONPecNAVt9jW5E1+Mscz6r1ZsxPYBdXobeLgcsel0hrC2 FqmSnwMzg0C7dy2u/z7y7VpXohTMW0wti4jRCloIcHAUGx42DnKj09rBtorWAEbLtRtdkvGQH 7/0nYDIIbGeK/r5G184FyBVBDbtsFPma5IZHPeUzkvj6fmOmxhACXBxRD1xd7udp0vr11Ml2g nO6ISPvblUNk5xYPJfPa/eacraCW+1aD0byaTpNkOiK40XAo0mqbZbwXPS62UDSYtPLTVFT19 +Q0KcSg4RxM2xxJkyTDU+5NIq/bShIEWu6NcJUjbs/V0AHgV5bMjPaFN3qSzuOJO9tv9f4OTn 8XjFHowLsGRmavCpsgEvN01qv8a6ZsaCrpwDOrZd1QZD7FRumlWGiUkWryJmV1QdAKQ0XOdq6 TGePwpnXqVXHHT3TN/1nq7JeBAF4YedyZ3Kpo0t8qVVE7kaKouACE53kisPzpa53qWyLCu+7R nTdY4bGEs4XyKE2jrdtQntI6EpIkfzZgG4700zxB00kBQB4CG/hqqxFRdwXRKsjLy+drjzQbE Je52fX5s3TuMuf/m7EJvIIjtMqRnuruM+IkLEKVHHy2M0wtALiSl3kHeNPRrkpJNOokqhxgJ Received-SPF: pass client-ip=212.227.17.22; envelope-from=michael.albinus@gmx.de; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:228633 Archived-At: Ergus writes: Hi, > Suppose: > > C-x C-f /ssh:myhost:file1 > C-x C-f /ssh:myhost:file2 > (executable-find mycommand 1) > And here we set the connection local variable... > > When we go to file1 if does not know about the variable in spite of it > is in the same host. I recommend to move the code setting connection-local variables in a funcion called by a hook, which is applied when visiting files in your use case. >>--8<---------------cut here---------------start------------->8--- >>(connection-local-set-profile-variables >> 'profile >> (append >> (connection-local-get-profile-variables 'profile) >> my-variables-list)) >>--8<---------------cut here---------------end--------------->8--- >> > Could you consider to add a snippet in the documentation explaining > this? Please? Done in the Elisp manual, pushed to master as commit aec44a5be3. >>That's hard to do. A user could change the remote PATH while the result >>of executable-find is cached. Furthermore, Tramp appends the local part >> of the remote default-directory to the directory search list. > > SO this means that the executable in default-directory are also > considered? Like on Windows? I was not aware of that... Well, this is rather an implementation detail, not documented. And I'm not sure it is the best decision, we just needed a last element in exec-path which is comparable to the last element in the local case of exec-path. >>You could write your own function, using Tramp's cache mechanism, but at >>your own risk. Something like (untested) >> >>--8<---------------cut here---------------start------------->8--- >>(defun my-executable-find (command &optional remote) >> (if (and remote (file-remote-p default-directory)) >> (with-tramp-connection-property >> (tramp-get-process (tramp-dissect-file-name default-directory)) >> (concat "executable-find-" command) >> (executable-find command remote)) >> (executable-find command remote))) >>--8<---------------cut here---------------end--------------->8--- >> > I was thinking in something like: > > (executable-find command &optional remote cache) but basically the same idea. This cannot be generalized, the code uses Tramp specific functions. A remote file name does not always mean invoking Tramp ... > Thanks, > Ergus Best regards, Michael.