all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Miguel Ángel Arruga Vivas" <rosen644835@gmail.com>
To: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH v2] .dir-locals.el: Automatically set the GEISER-GUILE-LOAD-PATH variable.
Date: Mon, 26 Oct 2020 12:38:14 +0100	[thread overview]
Message-ID: <877drdp68p.fsf@gmail.com> (raw)
In-Reply-To: <20201026055316.25592-1-maxim.cournoyer@gmail.com> (Maxim Cournoyer's message of "Mon, 26 Oct 2020 01:53:16 -0400")

[-- Attachment #1: Type: text/plain, Size: 3249 bytes --]

Hello, Maxim!

Thanks for your effort in this, some comments with the quotes for
context.

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:
>> 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. :-)
>
> That's a good suggestion!  I toyed with it and it's a bit tricky but I
> think the v2 patch I'll send as a follow-up does the trick.  My concern
> was also supporting when a user has previously set
> geiser-guile-load-path in their .emacs init file, e.g.:
>
> (setq geiser-guile-load-path (list (expand-file-name "~/src/guix")
>                                    (expand-file-name "~/src/shepherd")))
>
> That would mean their entries don't get cleaned up (it seems this
> doesn't matter in my latest tests with the v2 patch though!).

That cleanup seems to me responsibility of that .emacs maintainer
instead of something to take into account in .dir-locals. ;-)

>> (eval . (setq guix-directory
>>           (locate-dominating-file default-directory ".dir-locals.el")))
>> (eval . (when (boundp 'geiser-guile-load-path)
>
> This check makes it so that if geiser-guile-load-path is not already
> defined, nothing happens.  It is likely that this is the case, as when
> relying on just Geiser's autoloads, it is not loaded.  The user would
> have to either set explicitly before hand or call (require
> 'geiser-guile), which we can't rely on.  But we can drop this check.

You're right, as you can only bind the keys and enable it when used, not
at file load as I do, great catch. :-)

> One thing that worried me was the %load-compiled-path not appearing in
> the order defined from guile-geiser-load-path, but in my latest tests as
> mentioned above it didn't matter.

With the right directories (meaning no-conflicts between modules) it
shouldn't matter, but it's weird.  Looking into geiser-guile.el the load
path is provided to guile through -L parameters in
geiser-guile--parameters, and the extra path for Geiser code is added
with geiser-guile--set-geiser-load-path (that's why it is not added to
%load-compiled-path)...  I'd have to check Guile to be sure why are the
differences, but they seem harmless.

> +               (unless (fboundp 'geiser-guile-load-path)
> +                 (defvar geiser-guile-load-path '()))

This checks the function definition, not the variable, as Emacs Lisp has
two separate namespaces.

> I ended up using `cl-pushnew' here instead of push, as otherwise
> repeated entries were accumulated.

I wanted to avoid exactly that check, as the variable should end up with
duplicated entries only when you call it twice from the same buffer, how
could that happen?

> +               (make-local-variable 'geiser-guile-load-path)
> +               (cl-pushnew root-dir* geiser-guile-load-path
> +                           :test #'string-equal)))))

If there is some way this may happen, then this call is OK, but I'd try
to stay with a cheaper push unless it's really needed, as O(1) < O(n),
for almost every n. :-)

Again, thank you very much for taking care of this, as it would make
life easier for everybody of us who uses Geiser.

Happy hacking!
Miguel

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 658 bytes --]

  parent reply	other threads:[~2020-10-26 11:38 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-25 18:08 [PATCH] Automatically set `geiser-guile-load-path' from .dir-locals Maxim Cournoyer
2020-10-25 18:13 ` Pierre Neidhardt
2020-10-25 18:42 ` [PATCH] .dir-locals.el: Automatically set the GEISER-GUILE-LOAD-PATH variable Maxim Cournoyer
2020-10-25 18:52   ` Pierre Neidhardt
2020-10-25 21:37     ` Maxim Cournoyer
2020-10-25 21:01   ` Miguel Ángel Arruga Vivas
2020-10-26  5:47     ` Maxim Cournoyer
2020-10-26  5:53     ` [PATCH v2] " Maxim Cournoyer
2020-10-26  7:56       ` Pierre Neidhardt
2020-10-26 11:38       ` Miguel Ángel Arruga Vivas [this message]
2020-10-27 16:53         ` Maxim Cournoyer
2020-10-27 18:58           ` Miguel Ángel Arruga Vivas
2020-10-27 17:44         ` [PATCH v3] " Maxim Cournoyer
2020-10-31  4:19           ` Maxim Cournoyer
2020-11-01  1:02             ` Miguel Ángel Arruga Vivas
2020-10-26 13:43 ` [PATCH] Automatically set `geiser-guile-load-path' from .dir-locals zimoun
2020-10-26 15:03   ` Pierre Neidhardt
2020-11-05  2:20 ` Christopher Lemmer Webber
2020-11-05  4:00   ` Christopher Lemmer Webber
2020-11-05  9:25     ` Miguel Ángel Arruga Vivas
2020-11-05 17:26       ` Christopher Lemmer Webber
2020-11-14 19:57       ` Christopher Lemmer Webber
2020-11-16  4:18         ` Maxim Cournoyer
2020-11-16 14:54           ` Miguel Ángel Arruga Vivas
2020-11-16 17:41             ` Christopher Lemmer Webber
2020-11-16 18:07               ` Christopher Lemmer Webber
2020-11-16 20:57                 ` Miguel Ángel Arruga Vivas
2020-11-16 23:09                   ` Christopher Lemmer Webber
2020-11-17 15:36                   ` Maxim Cournoyer
2020-11-18 10:12                     ` Miguel Ángel Arruga Vivas
2020-11-05 14:21   ` Maxim Cournoyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877drdp68p.fsf@gmail.com \
    --to=rosen644835@gmail.com \
    --cc=guix-devel@gnu.org \
    --cc=maxim.cournoyer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.