help-guix
[Top][All Lists]
Advanced

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

Re: Guix and Emacs Integration for Polyglot Development


From: Alex Kost
Subject: Re: Guix and Emacs Integration for Polyglot Development
Date: Sat, 15 Sep 2018 00:34:21 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Jan Nieuwenhuizen (2018-09-13 22:45 +0200) wrote:

> (defun guix-switch-profile (&optional profile)
>   "Switch Emacs' environment to PROFILE.  PROFILE can be a named
> profile (like ~/.guix-profile, ~/.config/guix/work) or an
> environment (like: echo $GUIX_ENVIRONMENT)."
>
>   (interactive "fprofile: ")
>   (lexical-let* ((guix-program
>                   `(begin
>                     (use-modules (ice-9 match)
>                                  (guix profiles)
>                                  (guix search-paths))
>                     (let ((specs (profile-search-paths ,(expand-file-name 
> profile))))
>                       (map
>                        (match-lambda ((spec . dir)
>                                       (list 
> (search-path-specification-variable spec)
>                                             (or 
> (search-path-specification-separator spec) "")
>                                             dir)))
>                        specs))))
>                  (guix-output (guix-eval (format "%S" guix-program)))
>                  (profile-sexp (car (read-from-string (car guix-output)))))
>     (mapcar*
>      (lambda (variable separator path)
>        (lexical-let ((value (cond ((string-empty-p separator) path)
>                                   ((getenv variable) (concat path separator 
> (getenv variable)))
>                                   (t path))))
>          (setenv variable value)))
>      (mapcar #'car profile-sexp)
>      (mapcar #'cadr profile-sexp)
>      (mapcar #'caddr profile-sexp))))

Thank you!  I'm going to apply it.  I have extracted the guile code and
put it to the "scheme side" of Emacs-Guix, also I have rewritten this
command a bit.  The only thing: I don't like the name (neither
"guix-switch-profile" nor "guix-profile-apply").  I think
"guix-set-emacs-environment" suits better, as setting the environment is
exactly what this command does, WDYT?

You may look at my version of your patch (not in "master" yet) here:

  
https://notabug.org/alezost/emacs-guix/commit/a4bd696f0b8c564c1e654c426e9059cac1607996

Let me know, if you think something should be fixed there.

-- 
Alex



reply via email to

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