[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Emacs integration for 'guix shell'
From: |
Olivier Dion |
Subject: |
Re: Emacs integration for 'guix shell' |
Date: |
Mon, 26 Sep 2022 14:30:28 -0400 |
On Mon, 26 Sep 2022, "Thompson, David" <dthompson2@worcester.edu> wrote:
> Hello all,
>
> I recently wrote a little blog post titled "Guix for development" [0]
> and in it I mentioned using a tool called direnv and emacs-direnv as a
> way to integrate 'guix shell' with Emacs. This integration has vastly
> improved my Emacs experience. I can open a shell buffer and the
> environment variables are automatically configured the way I want. I
> can run M-x compile and simply enter 'make' as the command instead of
> 'guix shell -D -f guix.scm -- make'.
>
> It's very cool that it works, and I should have done this years ago,
> but direnv is an unnecessary middleman for me because I don't use it
> for any other purpose. It would be *even cooler* if Emacs could call
> 'guix shell --search-paths' directly, parse the result, and update the
> buffer environment. Furthemore, it could integrate with project.el
> (thus requiring Emacs 28) so that per-project search paths "just
> work." The emacs-guix-shell [1] project attempts to do this.
Interesting I'll have a look at it!
> I'm not an experienced elisp programmer so I'm sure there's stuff to
> fix, and there are no customizable variables yet, but the essentials
> seem to work OK for me. If you'd like to try it out, eval
> guix-shell.el and then M-x guix-shell-global-mode to enable it
> everywhere, or M-x guix-shell-mode to enable it just for the current
> buffer.
I have the following in my .dir-locals.el for my library libpatch. The
idea is the same, but without direnv:
--8<---------------cut here---------------start------------->8---
((nil
. ((eval .
(let ((root (locate-dominating-file
default-directory ".dir-locals.el")))
(when root
(let ((real-root (directory-file-name (expand-file-name root))))
(setq-local geiser-guile-binary (concat real-root "/.geiser-guile"))
(setq-local projectile-project-compilation-cmd
(concat real-root "/.projectile-compile"))
(setq-local projectile-project-test-cmd
(concat real-root "/.projectile-test")))))))))
--8<---------------cut here---------------end--------------->8---
.projectile-compile:
--8<---------------cut here---------------start------------->8---
#!/bin/sh
./dev-env make -j $(nproc)
--8<---------------cut here---------------end--------------->8---
.projectile-test:
--8<---------------cut here---------------start------------->8---
#!/bin/sh
./dev-env make -j $(nproc) check-nocolor
--8<---------------cut here---------------end--------------->8---
.geiser-guile:
--8<---------------cut here---------------start------------->8---
#!/bin/sh
here=$(pwd)
./dev-env guile -L "$here" -x "$here" $@
--8<---------------cut here---------------end--------------->8---
dev-env:
--8<---------------cut here---------------start------------->8---
#!/bin/sh
guix shell \
--pure \
dyninst \
gdb \
git \
guix \
lcov \
guile-quickcheck \
perf \
lttng-ust \
lttng-tools \
--development libpatch \
-- $@
--8<---------------cut here---------------end--------------->8---
Note the latest script where I have development packages for libpatch,
but also other utitilies that are good to have for developer.
Regards,
old
--
Olivier Dion
oldiob.dev
Re: Emacs integration for 'guix shell', pinoaffe, 2022/09/26
Re: Emacs integration for 'guix shell', Efraim Flashner, 2022/09/28