[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Automatically set `geiser-guile-load-path' from .dir-locals
From: |
Maxim Cournoyer |
Subject: |
Re: [PATCH] Automatically set `geiser-guile-load-path' from .dir-locals |
Date: |
Sun, 15 Nov 2020 23:18:14 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
Hello Christopher,
CC'ing Ludovic since they had that problem as well, so might be
interested in testing your solution.
Christopher Lemmer Webber <cwebber@dustycloud.org> 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.)
>
> 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.
>
> 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) and link to it here!
Be sure to include a very detailed description of how to reproduce; I
for one still am unable to reproduce with the above instructions. I've
tried many ways, using a pure environment, not loading my Emacs init
file, etc. based on what Miguel had written in IRC at the time of the
initial report, but to no avail.
> 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.
> #+BEGIN_SRC diff
> diff --git a/.dir-locals.el b/.dir-locals.el
> index 8e5d3902e3..2aa446a4f6 100644
> --- a/.dir-locals.el
> +++ b/.dir-locals.el
> @@ -17,17 +17,19 @@
> ;; Geiser
> ;; This allows automatically setting the `geiser-guile-load-path'
> ;; variable when using various Guix checkouts (e.g., via git worktrees).
> - (eval . (let* ((root-dir (expand-file-name
> - (locate-dominating-file
> - default-directory ".dir-locals.el")))
> - ;; Workaround for bug https://issues.guix.gnu.org/43818.
> - (root-dir* (directory-file-name root-dir)))
> - (unless (boundp 'geiser-guile-load-path)
> - (defvar geiser-guile-load-path '()))
> - (make-local-variable 'geiser-guile-load-path)
> - (require 'cl-lib)
> - (cl-pushnew root-dir* geiser-guile-load-path
> - :test #'string-equal)))))
> + (eval . (let ((root-dir-unexpanded (locate-dominating-file
> + default-directory
> ".dir-locals.el")))
> + (when root-dir-unexpanded
> + (let* ((root-dir (expand-file-name root-dir-unexpanded))
> + ;; Workaround for bug
> https://issues.guix.gnu.org/43818.
> + (root-dir* (directory-file-name root-dir)))
> +
> + (unless (boundp 'geiser-guile-load-path)
> + (defvar geiser-guile-load-path '()))
> + (make-local-variable 'geiser-guile-load-path)
> + (require 'cl-lib)
> + (cl-pushnew root-dir* geiser-guile-load-path
> + :test #'string-equal)))))))
>
> (c-mode . ((c-file-style . "gnu")))
> (scheme-mode
> #+END_SRC
>
> Btw, I'm not very familiar with dirlocals. I see that setq is used in
> the previous definition. Woudl setq-local be better... or does it do
> that by default?
Good observation. The `guix-directory' is set globally. It could be
neater if we made it also a buffer-local variable like the
`geiser-guile-load-path' below.
Thank you for having persevered in understanding the root cause of the
issue you had, and sharing the details here.
Maxim
- Re: [PATCH] Automatically set `geiser-guile-load-path' from .dir-locals, Christopher Lemmer Webber, 2020/11/04
- Re: [PATCH] Automatically set `geiser-guile-load-path' from .dir-locals, Christopher Lemmer Webber, 2020/11/04
- Re: [PATCH] Automatically set `geiser-guile-load-path' from .dir-locals, Miguel Ángel Arruga Vivas, 2020/11/05
- Re: [PATCH] Automatically set `geiser-guile-load-path' from .dir-locals, Christopher Lemmer Webber, 2020/11/05
- Re: [PATCH] Automatically set `geiser-guile-load-path' from .dir-locals, Christopher Lemmer Webber, 2020/11/14
- Re: [PATCH] Automatically set `geiser-guile-load-path' from .dir-locals,
Maxim Cournoyer <=
- Re: [PATCH] Automatically set `geiser-guile-load-path' from .dir-locals, Miguel Ángel Arruga Vivas, 2020/11/16
- Re: [PATCH] Automatically set `geiser-guile-load-path' from .dir-locals, Christopher Lemmer Webber, 2020/11/16
- Re: [PATCH] Automatically set `geiser-guile-load-path' from .dir-locals, Christopher Lemmer Webber, 2020/11/16
- Re: [PATCH] Automatically set `geiser-guile-load-path' from .dir-locals, Miguel Ángel Arruga Vivas, 2020/11/16
- Re: [PATCH] Automatically set `geiser-guile-load-path' from .dir-locals, Christopher Lemmer Webber, 2020/11/16
- Re: [PATCH] Automatically set `geiser-guile-load-path' from .dir-locals, Maxim Cournoyer, 2020/11/17
- Re: [PATCH] Automatically set `geiser-guile-load-path' from .dir-locals, Miguel Ángel Arruga Vivas, 2020/11/18
Re: [PATCH] Automatically set `geiser-guile-load-path' from .dir-locals, Maxim Cournoyer, 2020/11/05