From: Michael Albinus <michael.albinus@gmx.de>
To: Ergus <spacibba@aol.com>
Cc: 54459@debbugs.gnu.org
Subject: bug#54459: 29.0.50; Simplify connection-local variables (feature request)
Date: Sun, 20 Mar 2022 19:17:18 +0100 [thread overview]
Message-ID: <877d8ocwup.fsf@gmx.de> (raw)
In-Reply-To: <20220320120955.54fc67ohdot35aln@Ergus> (Ergus's message of "Sun, 20 Mar 2022 13:09:55 +0100")
Ergus <spacibba@aol.com> 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.
next prev parent reply other threads:[~2022-03-20 18:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <87bky2zjzz.fsf.ref@aol.com>
2022-03-19 3:41 ` bug#54459: 29.0.50; Simplify connection-local variables (feature request) Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-03-20 11:04 ` Michael Albinus
2022-03-20 12:09 ` Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-03-20 18:17 ` Michael Albinus [this message]
2022-03-29 8:25 ` Michael Albinus
2022-03-29 12:01 ` Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-03-29 13:11 ` 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=877d8ocwup.fsf@gmx.de \
--to=michael.albinus@gmx.de \
--cc=54459@debbugs.gnu.org \
--cc=spacibba@aol.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).