Hi Maxim and Christopher, Maxim Cournoyer writes: >[...] > Christopher Lemmer Webber writes: > [...] >> I figured out what was happening! The bug is *technically* in vc-mode. >> However, nontheless it manifested here... >> >> Here's what happened. vc-mode has some various hacks, as you can see >> above with "hack-local-variables-apply"... which traverses the dirlocals >> stuff. (Not sure what the purpose is, didn't look too long.) The file where these functions are located is lisp/files.el, right on the Emacs core. Some modes add hooks there, like flyspell or cc, but not vc, so I don't really think the problem is exclusive from that mode after some debugging. This code ends up in file-local-variables-alist, even though dir-local-variables-alist contains the correct values for some reason I still don't really understand. >> However for whatever reason, vc-mode also seems to be reusing buffers >> such as `*vc-diff*'... and somehow still is left in the directory >> context it *first* was used in. This may be the culprit but I think it isn't the issue, as file-local-variables-alist accumulates every eval marked as nil, not only the first/last one... when it fails, as we've seen. >> Thus if I C-x v = in a guix-oriented buffer first, and then switch to >> another completely different project and do the same, it's loading the >> dirlocals from Guix(...!!!!) >> >> This is clearly a bug in vc-mode, I'll try to report it as such. > Thank you for the investigation. I'd be really happy if you could > report the problem upstream (M-x report-emacs-bug) aznd link to it here! I haven't reported it yet, but as you can see I have a reproducer script attached. I haven't seen anything in vc-code that points in that direction, surely though Emacs people will have a better understanding. Christopher, would you mind to CC me if you open the bug? I can do it too if you tell me to, but I don't want to create a duplicate entry if we do it roughly at the same time. > [..] Miguel had written in IRC at the time of the initial report, but > to no avail. Maxim, could you test the script to check if we can narrow the cases? It shows the README in the emacs it opens, so it should be straight-forward. >> In the meanwhile, I used this hacky "fix". Maybe worth applying for the >> moment... what do you think of it? > > I'd like to have the upstream bug linked in that fix rather than the > Guix one; that way it'll be possible to track upstream resolution and > know when the workaround can be removed. Apart from the tracking reference, I agree that it's worth applying it. And also, thank you both for making easier to work on guix. :-) Happy hacking! Miguel