Skip to content

Instantly share code, notes, and snippets.

@juan-reynoso
Last active November 29, 2022 00:09
Show Gist options
  • Save juan-reynoso/31008f67ce33500af20cb19a4f2b7bbb to your computer and use it in GitHub Desktop.
Save juan-reynoso/31008f67ce33500af20cb19a4f2b7bbb to your computer and use it in GitHub Desktop.

How to install and configure your IDE for Common Lisp

SBCL

SBCL is a high performance Common Lisp compiler.

http://www.sbcl.org/

SBCL installation as super user (root)

You need to run the commands as super user (root)

Download

wget http://prdownloads.sourceforge.net/sbcl/sbcl-2.2.11-x86-64-linux-binary.tar.bz2

Unpack the tarball

bzip2 -cd sbcl-2.2.11-x86-64-linux-binary.tar.bz2 | tar xvf -

Change directory

cd sbcl-2.2.11-x86-64-linux

Run install script

./install.sh  OR  sh install.sh 

Running SBCL

Into your teminal type sbcl

sbcl

You will see

This is SBCL 2.2.11, 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.
*

note: * is the Lisp REPL prompt.

Quicklisp

Quicklisp is a library manager for Common Lisp. It works with your existing Common Lisp implementation to download, install, and load any of over 1,500 libraries with a few simple commands.

https://www.quicklisp.org/beta/

Quicklisp installation

You need to run the commands as your, not as root

Download

wget https://beta.quicklisp.org/quicklisp.lisp

or

curl -O https://beta.quicklisp.org/quicklisp.lisp

Installation

sbcl --load quicklisp.lisp

To continue with the installation, evaluate:

(quicklisp-quickstart:install)

few seconds later you will see

==== quicklisp installed ====

To load a system, use: (ql:quickload "system-name")

To find systems, use: (ql:system-apropos "term")

To load Quicklisp every time you start Lisp, use: (ql:add-to-init-file)

For more information, see http://www.quicklisp.org/beta/

Test quicklisp:

(ql:system-apropos "postmodern")

Slime installation

SLIME is a Emacs mode for Common Lisp development. Inspired by existing systems such Emacs Lisp and ILISP, we are working to create an environment for hacking Common Lisp in.

https://common-lisp.net/project/slime/

Into Lisp REPL * prompt evalute:

(ql:quickload "quicklisp-slime-helper")

After few seconds you will see

slime-helper.el installed in "/home/you-user/quicklisp/slime-helper.el"

To use, add this to your ~/.emacs:

  (load (expand-file-name "~/quicklisp/slime-helper.el"))
  ;; Replace "sbcl" with the path to your implementation
  (setq inferior-lisp-program "sbcl")

("quicklisp-slime-helper")

Install emacs, emacs-goodies-el and paredit-el into Debian:

aptitude install emacs emacs-goodies-el paredit-el

Now all together. SBCL, Quicklisp, SLIME, Emacs for your IDE

Open emacs. Press C-x C-f (C is control). Write ~/.emacs and press enter. Edit .emacs and add:

(setq inferior-lisp-program "sbcl")
;;Load Quicklisp slime-helper
(load (expand-file-name "~/quicklisp/slime-helper.el"))

;;For slime auto-start 
(setq slime-use-autodoc-mode nil)
(slime-setup '(slime-fancy slime-tramp slime-asdf slime-indentation))
(slime)

;;Paredit
(autoload 'enable-paredit-mode "paredit" "Turn on pseudo-structural editing of Lisp code." t)
(add-hook 'emacs-lisp-mode-hook       #'enable-paredit-mode)
(add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode)
(add-hook 'ielm-mode-hook             #'enable-paredit-mode)
(add-hook 'lisp-mode-hook             #'enable-paredit-mode)
(add-hook 'lisp-interaction-mode-hook #'enable-paredit-mode)
(add-hook 'scheme-mode-hook           #'enable-paredit-mode)
(add-hook 'slime-repl-mode-hook (lambda () (paredit-mode +1)))
(show-paren-mode 1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment