guix-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] .dir-locals.el: Automatically set the GEISER-GUILE-LOAD-PATH


From: Miguel Ángel Arruga Vivas
Subject: Re: [PATCH] .dir-locals.el: Automatically set the GEISER-GUILE-LOAD-PATH variable.
Date: Sun, 25 Oct 2020 22:01:05 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Hi!

I think that geiser should use something (project.el, wink wink) to fill
load-path automatically when that's possible.  Nevertheless, I have some
comments for this.

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:
> +
> +     ;; Emacs-Guix
> +     (eval . (setq guix-directory
> +                   (locate-dominating-file default-directory 
> ".dir-locals.el")))
> +
> +     ;; Geiser
> +     ;; This allows automatically setting the `geiser-guile-load-path'
> +     ;; variable when using various Guix checkouts (e.g., via git worktrees).
> +     ;; The checkout root directory name should be prefixed by "guix" for it
> +     ;; to work correctly.
> +     (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* (if (string-suffix-p "/" root-dir)
> +                                   (substring root-dir 0 -1)
> +                                 root-dir))

This is already implemented by directory-file-name.

> +                    (clean-geiser-guile-load-path
> +                     (seq-remove (lambda (x)
> +                                   (string-match "/guix" x))
> +                                 geiser-guile-load-path)))

This fails if geiser-guile-load-path does not exist (void-variable).
The cleanup removes other guixes, isn't it?  I suggest making the
variable buffer-local and forget about hard-coded names. :-)

> +               (setq geiser-guile-load-path
> +                     (cons root-dir* clean-geiser-guile-load-path))))))

This becomes a push with a local variable.  Like this:
-------------------------------8<-------------------------------------
(eval . (setq guix-directory
          (locate-dominating-file default-directory ".dir-locals.el")))
(eval . (when (boundp 'geiser-guile-load-path)
          (make-local-variable 'geiser-guile-load-path)
          (push (directory-file-name
                  (expand-file-name
                    (locate-dominating-file default-directory
                                            ".dir-locals.el")))
                geiser-guile-load-path))
------------------------------->8-------------------------------------

Happy hacking!
Miguel

Attachment: signature.asc
Description: PGP signature


reply via email to

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