bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#54405: 27.1; How to reset connection-local variable


From: Michael Albinus
Subject: bug#54405: 27.1; How to reset connection-local variable
Date: Fri, 18 Mar 2022 12:38:05 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Michael Albinus <michael.albinus@gmx.de> writes:

Hi David,

>> So, seems I should use my own :application key but then I can't use
>> the resetting macro since that is not applying locals with a unique 
>> :application
>> key. There is something there with 'tramp' being applied by default that
>> I don't understand though.
>
> `with-connection-local-variables' calls
> `connection-local-criteria-for-default-directory' w/o an APPLICATION
> argument, that's why `tramp' is used by default. Perhaps we shall extend
> `with-connection-local-variables' to accept another :application
> key. But for the time being, you might copy
> `with-connection-local-variables' into your own package under another
> name, and modify it accordingly.

I've pushed a change to the Emacs master git branch, which allows to
change the application in `with-connection-local-variables'. The Elisp
manual has been extended with

--8<---------------cut here---------------start------------->8---
 -- Variable: connection-local-default-application
     The default application, a symbol, to be applied in
     ‘with-connection-local-variables’.  It defaults to ‘tramp’, but in
     case you want to overwrite Tramp’s settings temporarily, you could
     let-bind it like

          (connection-local-set-profile-variables
            'my-remote-perl
            '((perl-command-name . "/usr/local/bin/perl5")
              (perl-command-switch . "-e %s")))

          (connection-local-set-profiles
            '(:application 'my-app :protocol "ssh" :machine "remotehost")
            'my-remote-perl)

          (let ((default-directory "/ssh:remotehost:/working/dir/")
                (connection-local-default-application 'my-app))
            (with-connection-local-variables
              do something useful))

     This variable must not be changed globally.
--8<---------------cut here---------------end--------------->8---

Does this suffice?

>> /David

Best regards, Michael.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]