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

From: Michael Albinus <[email-masked]>
Date: Fri, 18 Mar 2022 08:23:00 +0100

David Landell <[email-masked]> writes:

> Thanks Michael for the answer,

Hi David,

> This solves my small demo test case but unfortunately it doesn't solve
> the main use case I slightly described. In the latter case something
> else is calling hack-connection-local-variables-apply outside of the
> resetting macro. I think it's possibly from tramp since there is a
> process running in the buffer on the remote host.

Yes, Tramp does this in its connection buffers.

> If I understand the criteria matching correctly, it matches only the
> fields available so if I use only the :host key, an unrelated criteria
> will match as long as it is using the same :host key, right?

Yes.

> 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.

> Anyway, this is possible to work around now that I think I understand
> it.
>
> /David

Best regards, Michael.