* Should guix-emacs-autoload-packages use GUIX_ENVIRONMENT?
@ 2017-07-23 1:39 Kyle Meyer
2017-07-23 21:12 ` Alex Kost
0 siblings, 1 reply; 11+ messages in thread
From: Kyle Meyer @ 2017-07-23 1:39 UTC (permalink / raw)
To: guix-devel
Hello,
I noticed that Emacs packages from the user's profile leak into guix
environment calls.
For example, when I run
$ guix environment --pure --ad-hoc emacs -- emacs -q
load-path contains the Emacs packages from my main profile.
I expected it to use GUIX_ENVIRONMENT instead (something like the patch
below, I think).
Does guix-emacs-autoload-packages ignore GUIX_ENVIRONMENT by design? I
suppose one downside of honoring GUIX_ENVIRONMENT is that, if the --pure
flag isn't passed and the package arguments aren't Emacs-related, a user
may be surprised that their Emacs packages are no longer available in
newly created Emacs instances.
Thanks.
-- >8 --
diff --git a/gnu/packages/aux-files/emacs/guix-emacs.el b/gnu/packages/aux-files/emacs/guix-emacs.el
index 2bbd639ff..2d0d50e11 100644
--- a/gnu/packages/aux-files/emacs/guix-emacs.el
+++ b/gnu/packages/aux-files/emacs/guix-emacs.el
@@ -87,9 +87,11 @@ (defun guix-emacs-autoload-packages (&rest profiles)
(interactive (list (if (fboundp 'guix-read-package-profile)
(funcall 'guix-read-package-profile)
guix-user-profile)))
- (let ((profiles (or profiles
- (list "/run/current-system/profile"
- guix-user-profile))))
+ (let* ((env (getenv "GUIX_ENVIRONMENT"))
+ (profiles (or profiles
+ (and env (list env))
+ (list "/run/current-system/profile"
+ guix-user-profile))))
(dolist (profile profiles)
(let ((dirs (guix-emacs-directories profile)))
(when dirs
--
2.13.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: Should guix-emacs-autoload-packages use GUIX_ENVIRONMENT?
2017-07-23 1:39 Should guix-emacs-autoload-packages use GUIX_ENVIRONMENT? Kyle Meyer
@ 2017-07-23 21:12 ` Alex Kost
2017-07-23 22:29 ` Kyle Meyer
0 siblings, 1 reply; 11+ messages in thread
From: Alex Kost @ 2017-07-23 21:12 UTC (permalink / raw)
To: Kyle Meyer; +Cc: guix-devel
Kyle Meyer (2017-07-22 21:39 -0400) wrote:
> Hello,
>
> I noticed that Emacs packages from the user's profile leak into guix
> environment calls.
As for me, this is a natural behaviour. If you want to be safe from any
external packages, site settings, etc., run "emacs -Q".
> For example, when I run
>
> $ guix environment --pure --ad-hoc emacs -- emacs -q
>
> load-path contains the Emacs packages from my main profile.
Right, but "-q" is not enough here. If you don't want these packages to
be autoloaded, you need to run emacs with "-Q" or "--no-site-file".
> I expected it to use GUIX_ENVIRONMENT instead (something like the patch
> below, I think).
I wouldn't expect "instead", I would expect "along with".
> Does guix-emacs-autoload-packages ignore GUIX_ENVIRONMENT by design?
No, I think it's just that no one thought about this possibility before (I
mean a possibility to use emacs packages from "guix environment").
> I suppose one downside of honoring GUIX_ENVIRONMENT is that, if the --pure
> flag isn't passed and the package arguments aren't Emacs-related, a user
> may be surprised that their Emacs packages are no longer available in
> newly created Emacs instances.
I'm not sure. I think if you run "emacs -q", you really want "emacs -Q".
Otherwise, if you start emacs normally, you probably don't want to ignore
emacs packages from your guix profile.
However, I agree that GUIX_ENVIRONMENT should be honored, but as I wrote
*not instead* but *along with* the default profiles. So if you start
emacs like this:
guix environment --ad-hoc emacs emacs-wget -- emacs
it should contain emacs-wget in its load-path. WDYT?
--
Alex
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Should guix-emacs-autoload-packages use GUIX_ENVIRONMENT?
2017-07-23 21:12 ` Alex Kost
@ 2017-07-23 22:29 ` Kyle Meyer
2017-07-24 21:19 ` Alex Kost
0 siblings, 1 reply; 11+ messages in thread
From: Kyle Meyer @ 2017-07-23 22:29 UTC (permalink / raw)
To: Alex Kost; +Cc: guix-devel
Alex Kost <alezost@gmail.com> writes:
> Kyle Meyer (2017-07-22 21:39 -0400) wrote:
>
>> I noticed that Emacs packages from the user's profile leak into guix
>> environment calls.
>
> As for me, this is a natural behaviour. If you want to be safe from any
> external packages, site settings, etc., run "emacs -Q".
I want "-q" rather than "-Q" because I want the Emacs instance to
autoload the Emacs packages that I've given as arguments to "guix
environment".
> I'm not sure. I think if you run "emacs -q", you really want "emacs -Q".
> Otherwise, if you start emacs normally, you probably don't want to ignore
> emacs packages from your guix profile.
Maybe I'm underestimating all the ways people use "guix environment".
When I use it, I'm interested in getting an isolated environment,
usually for testing, and in this case I don't want the Emacs packages
from my profile.
But sure, I can use "emacs -Q" and then evaluate something similar to
what Guix puts in site-start.el, modifying it to only look at
GUIX_ENVIRONMENT.
> However, I agree that GUIX_ENVIRONMENT should be honored, but as I wrote
> *not instead* but *along with* the default profiles. So if you start
> emacs like this:
>
> guix environment --ad-hoc emacs emacs-wget -- emacs
>
> it should contain emacs-wget in its load-path. WDYT?
I certainly agree with that load-path should include emacs-wget. I'm
just not sure I agree with the "along with".
Anyway, as I said above, it's easy enough to get the behavior I want
with "emacs -Q" and a custom guix-emacs-autoload-packages call.
Thanks for your thoughts.
--
Kyle
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Should guix-emacs-autoload-packages use GUIX_ENVIRONMENT?
2017-07-23 22:29 ` Kyle Meyer
@ 2017-07-24 21:19 ` Alex Kost
2017-07-24 22:25 ` Kyle Meyer
0 siblings, 1 reply; 11+ messages in thread
From: Alex Kost @ 2017-07-24 21:19 UTC (permalink / raw)
To: Kyle Meyer; +Cc: guix-devel
Kyle Meyer (2017-07-23 18:29 -0400) wrote:
> Alex Kost <alezost@gmail.com> writes:
>
>> Kyle Meyer (2017-07-22 21:39 -0400) wrote:
>>
>>> I noticed that Emacs packages from the user's profile leak into guix
>>> environment calls.
>>
>> As for me, this is a natural behaviour. If you want to be safe from any
>> external packages, site settings, etc., run "emacs -Q".
>
> I want "-q" rather than "-Q" because I want the Emacs instance to
> autoload the Emacs packages that I've given as arguments to "guix
> environment".
Oh, right, now I see why "-Q" is not what you want.
>> I'm not sure. I think if you run "emacs -q", you really want "emacs -Q".
>> Otherwise, if you start emacs normally, you probably don't want to ignore
>> emacs packages from your guix profile.
>
> Maybe I'm underestimating all the ways people use "guix environment".
> When I use it, I'm interested in getting an isolated environment,
> usually for testing, and in this case I don't want the Emacs packages
> from my profile.
OK, now I understand your point and I don't object against your patch.
OTOH I'm pretty sure there are people who will be surprised that when
emacs is started under "guix environment", it ignores packages from the
"~/guix-profile".
>> However, I agree that GUIX_ENVIRONMENT should be honored, but as I wrote
>> *not instead* but *along with* the default profiles. So if you start
>> emacs like this:
>>
>> guix environment --ad-hoc emacs emacs-wget -- emacs
>>
>> it should contain emacs-wget in its load-path. WDYT?
>
> I certainly agree with that load-path should include emacs-wget. I'm
> just not sure I agree with the "along with".
Now I'm also not sure if "along with" or "instead" is better. I don't
have a preference, so I agree with any choice :-)
--
Alex
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Should guix-emacs-autoload-packages use GUIX_ENVIRONMENT?
2017-07-24 21:19 ` Alex Kost
@ 2017-07-24 22:25 ` Kyle Meyer
2017-07-25 21:33 ` Marius Bakke
2017-07-26 20:06 ` Alex Kost
0 siblings, 2 replies; 11+ messages in thread
From: Kyle Meyer @ 2017-07-24 22:25 UTC (permalink / raw)
To: Alex Kost; +Cc: guix-devel
Alex Kost <alezost@gmail.com> writes:
[...]
>> Maybe I'm underestimating all the ways people use "guix environment".
>> When I use it, I'm interested in getting an isolated environment,
>> usually for testing, and in this case I don't want the Emacs packages
>> from my profile.
>
> OK, now I understand your point and I don't object against your patch.
> OTOH I'm pretty sure there are people who will be surprised that when
> emacs is started under "guix environment", it ignores packages from the
> "~/guix-profile".
OK, given that many (all other? :]) users would expect a different
behavior ...
>>> However, I agree that GUIX_ENVIRONMENT should be honored, but as I wrote
>>> *not instead* but *along with* the default profiles. So if you start
>>> emacs like this:
>>>
>>> guix environment --ad-hoc emacs emacs-wget -- emacs
>>>
>>> it should contain emacs-wget in its load-path. WDYT?
>>
>> I certainly agree with that load-path should include emacs-wget. I'm
>> just not sure I agree with the "along with".
>
> Now I'm also not sure if "along with" or "instead" is better. I don't
> have a preference, so I agree with any choice :-)
... I'd say "along with" is better.
As I said in my previous post, it's quite easy for me to get the
behavior I want, so I'd prefer to go with your gut feeling about the
expected behavior.
--
Kyle
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Should guix-emacs-autoload-packages use GUIX_ENVIRONMENT?
2017-07-24 22:25 ` Kyle Meyer
@ 2017-07-25 21:33 ` Marius Bakke
2017-07-26 1:40 ` Kyle Meyer
2017-07-26 20:06 ` Alex Kost
1 sibling, 1 reply; 11+ messages in thread
From: Marius Bakke @ 2017-07-25 21:33 UTC (permalink / raw)
To: Kyle Meyer, Alex Kost; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 854 bytes --]
Kyle Meyer <kyle@kyleam.com> writes:
> Alex Kost <alezost@gmail.com> writes:
>
> [...]
>
>>> Maybe I'm underestimating all the ways people use "guix environment".
>>> When I use it, I'm interested in getting an isolated environment,
>>> usually for testing, and in this case I don't want the Emacs packages
>>> from my profile.
>>
>> OK, now I understand your point and I don't object against your patch.
>> OTOH I'm pretty sure there are people who will be surprised that when
>> emacs is started under "guix environment", it ignores packages from the
>> "~/guix-profile".
>
> OK, given that many (all other? :]) users would expect a different
> behavior ...
Wait, isn't this what --pure is for? I haven't followed the discussion,
but I would expect `guix environment` to *add* to my current profile,
and use '--pure' if I want a "clean" environment.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Should guix-emacs-autoload-packages use GUIX_ENVIRONMENT?
2017-07-25 21:33 ` Marius Bakke
@ 2017-07-26 1:40 ` Kyle Meyer
2017-07-26 20:02 ` Alex Kost
0 siblings, 1 reply; 11+ messages in thread
From: Kyle Meyer @ 2017-07-26 1:40 UTC (permalink / raw)
To: Marius Bakke, Alex Kost; +Cc: guix-devel
Marius Bakke <mbakke@fastmail.com> writes:
> Wait, isn't this what --pure is for? I haven't followed the
> discussion, but I would expect `guix environment` to *add* to my
> current profile, and use '--pure' if I want a "clean" environment.
I think the behavior here is unspecified because --pure is about
unsetting shell variables while this is about how the load-path and
autoloads are set up within an environment's Emacs instance.
Conceptually, though, I agree that a --pure flag would match
guix-emacs-autoload-packages considering only the environment's Emacs
packages, whereas no --pure flag would match adding the environment's to
the current profile's.
But in the discussion so far, I've been assuming that currently there's
not a direct way for guix-emacs-autoload-packages to detect if --pure
was given. If that's not true, I'd be happy with the behavior you
propose.
--
Kyle
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Should guix-emacs-autoload-packages use GUIX_ENVIRONMENT?
2017-07-26 1:40 ` Kyle Meyer
@ 2017-07-26 20:02 ` Alex Kost
2017-07-27 11:38 ` Ricardo Wurmus
0 siblings, 1 reply; 11+ messages in thread
From: Alex Kost @ 2017-07-26 20:02 UTC (permalink / raw)
To: Kyle Meyer; +Cc: guix-devel
Kyle Meyer (2017-07-25 21:40 -0400) wrote:
> Marius Bakke <mbakke@fastmail.com> writes:
>
>> Wait, isn't this what --pure is for? I haven't followed the
>> discussion, but I would expect `guix environment` to *add* to my
>> current profile, and use '--pure' if I want a "clean" environment.
>
> I think the behavior here is unspecified because --pure is about
> unsetting shell variables while this is about how the load-path and
> autoloads are set up within an environment's Emacs instance.
> Conceptually, though, I agree that a --pure flag would match
> guix-emacs-autoload-packages considering only the environment's Emacs
> packages, whereas no --pure flag would match adding the environment's to
> the current profile's.
>
> But in the discussion so far, I've been assuming that currently there's
> not a direct way for guix-emacs-autoload-packages to detect if --pure
> was given. If that's not true, I'd be happy with the behavior you
> propose.
I also don't see how you can detect from Emacs if it is running from
guix environment with --pure or without.
--
Alex
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Should guix-emacs-autoload-packages use GUIX_ENVIRONMENT?
2017-07-24 22:25 ` Kyle Meyer
2017-07-25 21:33 ` Marius Bakke
@ 2017-07-26 20:06 ` Alex Kost
2017-07-27 5:04 ` Kyle Meyer
1 sibling, 1 reply; 11+ messages in thread
From: Alex Kost @ 2017-07-26 20:06 UTC (permalink / raw)
To: Kyle Meyer; +Cc: guix-devel
Kyle Meyer (2017-07-24 18:25 -0400) wrote:
> Alex Kost <alezost@gmail.com> writes:
>
> [...]
>
>>>> However, I agree that GUIX_ENVIRONMENT should be honored, but as I wrote
>>>> *not instead* but *along with* the default profiles. So if you start
>>>> emacs like this:
>>>>
>>>> guix environment --ad-hoc emacs emacs-wget -- emacs
>>>>
>>>> it should contain emacs-wget in its load-path. WDYT?
>>>
>>> I certainly agree with that load-path should include emacs-wget. I'm
>>> just not sure I agree with the "along with".
>>
>> Now I'm also not sure if "along with" or "instead" is better. I don't
>> have a preference, so I agree with any choice :-)
>
> ... I'd say "along with" is better.
>
> As I said in my previous post, it's quite easy for me to get the
> behavior I want, so I'd prefer to go with your gut feeling about the
> expected behavior.
OK, so if the others agree with "along with" policy, would you like to
update your patch for it?
--
Alex
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Should guix-emacs-autoload-packages use GUIX_ENVIRONMENT?
2017-07-26 20:06 ` Alex Kost
@ 2017-07-27 5:04 ` Kyle Meyer
0 siblings, 0 replies; 11+ messages in thread
From: Kyle Meyer @ 2017-07-27 5:04 UTC (permalink / raw)
To: Alex Kost; +Cc: guix-devel
Alex Kost <alezost@gmail.com> writes:
> OK, so if the others agree with "along with" policy, would you like to
> update your patch for it?
Sure, sent to guix-patches (#27845).
--
Kyle
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Should guix-emacs-autoload-packages use GUIX_ENVIRONMENT?
2017-07-26 20:02 ` Alex Kost
@ 2017-07-27 11:38 ` Ricardo Wurmus
0 siblings, 0 replies; 11+ messages in thread
From: Ricardo Wurmus @ 2017-07-27 11:38 UTC (permalink / raw)
To: Alex Kost; +Cc: guix-devel
Alex Kost <alezost@gmail.com> writes:
> Kyle Meyer (2017-07-25 21:40 -0400) wrote:
>
>> Marius Bakke <mbakke@fastmail.com> writes:
>>
>>> Wait, isn't this what --pure is for? I haven't followed the
>>> discussion, but I would expect `guix environment` to *add* to my
>>> current profile, and use '--pure' if I want a "clean" environment.
>>
>> I think the behavior here is unspecified because --pure is about
>> unsetting shell variables while this is about how the load-path and
>> autoloads are set up within an environment's Emacs instance.
>> Conceptually, though, I agree that a --pure flag would match
>> guix-emacs-autoload-packages considering only the environment's Emacs
>> packages, whereas no --pure flag would match adding the environment's to
>> the current profile's.
>>
>> But in the discussion so far, I've been assuming that currently there's
>> not a direct way for guix-emacs-autoload-packages to detect if --pure
>> was given. If that's not true, I'd be happy with the behavior you
>> propose.
>
> I also don't see how you can detect from Emacs if it is running from
> guix environment with --pure or without.
I don’t think you can, but we could pollute the environment some more by
setting a variable that indicates that this is a pure environment…?
--
Ricardo
GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC
https://elephly.net
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2017-07-27 11:38 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-23 1:39 Should guix-emacs-autoload-packages use GUIX_ENVIRONMENT? Kyle Meyer
2017-07-23 21:12 ` Alex Kost
2017-07-23 22:29 ` Kyle Meyer
2017-07-24 21:19 ` Alex Kost
2017-07-24 22:25 ` Kyle Meyer
2017-07-25 21:33 ` Marius Bakke
2017-07-26 1:40 ` Kyle Meyer
2017-07-26 20:02 ` Alex Kost
2017-07-27 11:38 ` Ricardo Wurmus
2017-07-26 20:06 ` Alex Kost
2017-07-27 5:04 ` Kyle Meyer
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.