all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kenny Ballou <kballou@devnulllabs.io>
To: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Cc: help-guix@gnu.org
Subject: Re: Guix and Emacs Integration for Polyglot Development
Date: Mon, 10 Sep 2018 09:25:24 -0600	[thread overview]
Message-ID: <87pnxle5nf.fsf@devnulllabs.io> (raw)
In-Reply-To: <874lfabt1c.fsf@gmail.com>


On 2018-08-31 12:49 GMT, Maxim Cournoyer wrote:
> Hello!
>
> I'm reposting Janneke's recent answer here so that it can have all its
> context and participants.
>
> Jan Nieuwenhuizen <janneke@gnu.org> writes:
>
>> Hi!
>>
>> Just subscribed to help-guix because of a request on IRC, so hoping that
>> OP is subscribed here, or someone can notify them.
>>
>> I have an ugly hack to switch emacs to a profile or environment.  It
>> parses the <profile>/etc/profile script...using MANIFEST or
>> `--search-paths' would be much nicer...
>>
>> Anyway, I'm using some named profiles, eg
>>
>>     ~/.config/guix/mes
>>
>> and when starting work on mes i do
>>
>>     M-x guix-switch-profile RET ~/.config/guix/mes RET
>>
>> similar for other projects I work on.
>>
>> A real solution would be nice...
>>
>> HTH, janneke
>>
>> --8<---------------cut here---------------start------------->8---
>>
>> (defun guix-switch-profile (&optional profile)
>>   "reset Emacs' environment by snarfing PROFILE/etc/profile"
>>
>>   (defun matches-in-string (regexp string)
>>     "return a list of matches of REGEXP in STRING."
>>     (let ((matches))
>>       (save-match-data
>>         (string-match "^" "")
>>         (while (string-match regexp string (match-end 0))
>>           (push (or (match-string 1 string) (match-string 0 string)) matches)))
>>       matches))
>>
>>   (interactive "fprofile: ")
>>   (let* ((output (shell-command-to-string (concat "GUIX_PROFILE= /bin/sh -x " profile "/etc/profile")))
>>          (exports (matches-in-string "^[+] export \\(.*\\)" output)))
>>     (mapcar (lambda (line) (apply #'setenv (split-string line "="))) exports )))
>> --8<---------------cut here---------------end--------------->8---
>
> Thank you, Janneke!
>
> An alternative if you'd like to also define some variables (say,
> PYTHONPATH to add a couple of sources libraries while working on a
> Python project) would be to use `direnv'[0] and `emacs-direnv'.
>
> Christopher Baines detailed the solution in this thread:
> https://lists.gnu.org/archive/html/guix-devel/2017-05/msg00475.html.
>
> I hope this helps!
>
> Maxim


Thank you for posting this, I still haven't had a chance to play around
with this yet, but I think this is the kind of solution that is exactly
what I'm looking for.  However, Named profiles was sorta where I was
leaning.

I may not use the `emacs-direnv` part.  But I if I understand correctly,
switching profiles will change the `${HOME}/.guix-profile` symlink, I
can just statically add the current profile to any path variables and go
from there(?).

Again, thank you and apologies for the necrobump because of late
replies...

-Kenny

  reply	other threads:[~2018-09-10 15:33 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-27 18:53 Guix and Emacs Integration for Polyglot Development Kenny Ballou
2018-08-02  8:08 ` Chris Marusich
2018-08-05 19:16   ` Kenny Ballou
2018-08-20 12:32     ` Maxim Cournoyer
2018-08-24 21:55       ` Ludovic Courtès
2018-08-25 19:47         ` Alex Kost
2018-08-25 21:59           ` Ludovic Courtès
2018-08-31 12:49       ` Maxim Cournoyer
2018-09-10 15:25         ` Kenny Ballou [this message]
2018-09-11  1:10 ` George Clemmer
  -- strict thread matches above, loose matches on Subject: below --
2018-08-29 18:41 Jan Nieuwenhuizen
2018-09-01 14:41 ` Ludovic Courtès
2018-09-01 15:11   ` Jan Nieuwenhuizen
2018-09-01 17:25     ` Ludovic Courtès
2018-09-13 20:45       ` Jan Nieuwenhuizen
2018-09-14  9:56         ` Ludovic Courtès
2018-09-14 11:53           ` Jan Nieuwenhuizen
2018-09-14 21:34         ` Alex Kost
2018-09-15  5:21           ` Jan Nieuwenhuizen
2018-09-15 19:40             ` Alex Kost
2018-10-26  4:59           ` George Clemmer
2018-10-26 17:04             ` Alex Kost
2018-10-26 18:01               ` George Clemmer
2018-10-26 20:56                 ` George Clemmer
2018-10-27 14:42                   ` Alex Kost
2018-10-27 19:32                     ` George Clemmer
2018-10-28 14:39                       ` Alex Kost
2018-10-28 21:19                         ` George Clemmer
2018-10-29 16:37                           ` Alex Kost
2018-10-26  1:22         ` 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=87pnxle5nf.fsf@devnulllabs.io \
    --to=kballou@devnulllabs.io \
    --cc=help-guix@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.