(asdf:load-system "my-project")
in the SLIME REPL causes warnings and/or errors to be printed to the REPL, which is difficult to go through. In this post we explore a solution that does not receive much attention in beginner tutorials.Emacs is a great IDE for Common Lisp development, especially with its SLIME package. The SLIME setup instructions are here.
ASDF is a (the?) build system for Common Lisp.
Assuming everything has been set up (e.g. this) The workflow usually goes like this:
- Launch Emacs.
M-x slime
- In the REPL, type
(asdf:load-system "my-project")
- In the REPL, press ","
- In the Emacs minibuffer, type
restart-inferior-lisp
- In the REPL, type
(asdf:load-system "my-project")
How to get the compilation errors show up nicely in SLIME, just like when using
C-c C-c
and C-c C-k
? The only relevant post I can find seems to be this, which has already been archived.The solution is to use the SLIME contributed module slime-asdf, which wraps the compilation output into the
*slime-compilation*
buffer. The source files are even highlighted with notes.To use the slime-asdf module, modify the setup instructions here from:
;; Set your lisp system and, optionally, some contribs
(setq inferior-lisp-program "/opt/sbcl/bin/sbcl")
(setq slime-contribs '(slime-fancy))
to:
;; Set your lisp system and, optionally, some contribs
(setq inferior-lisp-program "/opt/sbcl/bin/sbcl")
(setq slime-contribs '(slime-fancy slime-asdf))
Now, from the SLIME REPL, pressing "," typing "load-system", and finally "my-project" will trigger the corresponding ASDF operation. Any compilation output will be shown nicely in the
*slime-compilation*
buffer.By default, the buffer does not go to the foreground. I've found that setting
(setf asdf:*compile-file-warnings-behaviour* :error)
has been useful. This variable is explained in the ASDF manual here.
Nice. Many thanks :) these are just-in-time clarifications. Trying to set up my first system here.
ReplyDelete