GNU bug report logs - #44698
27.1; dir-locals.el stay on file-local-variables-alist when using vc-mode

Previous Next

Package: emacs;

Reported by: Miguel Ángel Arruga Vivas <rosen644835 <at> gmail.com>

Date: Mon, 16 Nov 2020 20:31:02 UTC

Severity: normal

Found in version 27.1

Done: Sean Whitton <spwhitton <at> spwhitton.name>

Bug is archived. No further changes may be made.

Full log


Message #31 received at 44698 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Sean Whitton <spwhitton <at> spwhitton.name>, emacs-devel <at> gnu.org
Cc: Christopher Lemmer Webber <cwebber <at> dustycloud.org>,
 Miguel Ángel Arruga Vivas <rosen644835 <at> gmail.com>,
 44698 <at> debbugs.gnu.org
Subject: Re: bug#44698: 27.1; dir-locals.el stay on file-local-variables-alist
 when using vc-mode
Date: Sat, 8 Mar 2025 08:07:57 +0000
Sean Whitton <spwhitton <at> spwhitton.name> writes:

> Hello,
>
> On Mon 16 Nov 2020 at 09:30pm +01, Miguel Ángel Arruga Vivas wrote:
>
>> While using vc-mode, the dir-locals.el variables under 'nil' mode are
>> accumulated on file-local-variables-alist and they still apply after
>> exiting the scope of the file.  The attached script can be used to
>> reproduce it (Emacs 27.1, on GNU Guix
>> f6e031ab36fd99ad3536caabfdaefcc2b5f606a1).
>>
>> It generates a temporary folder with two example git repositories, an
>> offending dir-locals.el[1], launches an emacs with -Q and the shows
>> the steps to follow:
>>
>> 1. Open p1/file and accept the .dir-locals.el variables.
>> 2. Call vc-print-log
>> 3. Check the file-local-variables-alist
>> 4. Open p2/file (this one doesn't have .dir-locals.el).
>> 5. Call vc-print-log again, the message is shown again.
>
> The problem here is that file-local-variables-alist is marked
> permanent-local, and vc-log-internal-common re-uses the *vc-change-log*
> buffer, so the variable sticks around.  Clearly that is wrong.
>
> What's the idiomatic thing to do in this sort of situation?
>
> Should vc-log-internal-common kill the buffer and re-create it?
>
> That's the change I'll make if no-one has a better idea.

I think you can use `kill-all-local-variables` for this:

    (kill-all-local-variables 'kill-permanent)




This bug report was last modified 133 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.