[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Loading Common Lisp Libraries with GNU/Guix in a REPL
From: |
Edouard Klein |
Subject: |
Re: Loading Common Lisp Libraries with GNU/Guix in a REPL |
Date: |
Fri, 10 Dec 2021 16:03:12 +0100 |
User-agent: |
mu4e 1.6.10; emacs 27.2 |
Hi !
I don't know the "correct" way to do it, but the way I do things is:
Create a manifest.scm or guix.scm file in the directory. Here is an
example manifest.scm file:
#+begin_src scheme
(define-module (osef)
#:use-module (guix packages)
#:use-module (gnu packages)
#:use-module (guix profiles)
#:use-module (gnu packages lisp)
#:use-module (gnu packages lisp-xyz)
#:use-module (gnu packages readline)
)
(packages->manifest
(list sbcl sbcl-numcl rlwrap))
#+end_src
Then I run guix shell, which will automatically load this manifest.scm
file.
Then, same as you, I run rlwrap sbcl.
Finally I invoke the following in sbcl:
#+begin_src lisp
(load "~/.emacs.d/elpa/27.2/develop/slime-20211021.507/swank-loader.lisp")
;; Found using find .emacs.d/ -iname '*swank*'
(swank-loader:init)
(swank:create-server)
#+end_src
This allows my emacs instance, which lives outside the guix shell, to
communicate with the sbcl instance which lives inside. I don't want to
pollute each project with my emacs config, which is done once and for
all for all projects.
To connect: M-x slime-connet, enter, enter.
Then I just (require :numcl) (for example). I did not need to use asdf,
although this may be package-specific. I remember being unable to load a
package once, but I don't rememder which or why (sorry).
So basically, the same as you already do.
If there is a more canonical way, I'd be happy to know :)
Cheers,
Edouard.
jgart <jgart@dismail.de> writes:
> On Fri, 10 Dec 2021 05:44:58 -0500 jgart <jgart@dismail.de> wrote:
>
> Alternatively, I was able to also load code this way also after running
> the following:
>
> ```
> $ guix shell sbcl sbcl-cl-str rlwrap
>
> CL-USER(2):
> jgart@gac ~ [env] λ rlwrap sbcl
> This is SBCL 2.1.9, an implementation of ANSI Common Lisp.
> More information about SBCL is available at <http://www.sbcl.org/>.
>
> SBCL is free software, provided as is, with absolutely no warranty.
> It is mostly in the public domain; some portions are provided under
> BSD-style licenses. See the CREDITS and COPYING files in the
> distribution for more information.
> CL-USER(1): (asdf:make "str")
> WARNING: System definition file
> #P"/gnu/store/aljfy13phr526w0iqmqz0cf2cnxkjxlb-sbcl-cl-ppcre-unicode-2.1.1/share/common-lisp/sbcl/cl-ppcre-unicode/cl-ppcre-unicode.asd"
> contains definition for system "cl-ppcre-unicode-test". Please only
> define "cl-ppcre-unicode" and secondary systems with a name starting with
> "cl-ppcre-unicode/" (e.g. "cl-ppcre-unicode/test") in that file.
>
> ;;; Computing Hangul syllable names
> T
> CL-USER(2): (in-package :str)
>
> #<PACKAGE "STR">
> STR(3): (trim " rst ")
>
> "rst"
> STR(4): (join " " '("foo" "bar" "baz"))
>
> "foo bar baz"
> STR(5): (concat "f" "o" "o")
>
> "foo"
> STR(6): (split "+" "foo++bar")
>
> ("foo" "" "bar")
> ```