
Good day, dear reader!
Before every newbie in the world of
Common Lisp programming
languagethere is a problem of choosing the development environment -
Integrated Development Environment (hereinafter,
IDE ).
There is a large number of
IDE for
Common Lisp . Here are some of the most common ones:
For connoisseursConnoisseurs may object to the last two items on the list.
After all, it would seem
Lispbox = Emacs + Slime ?!But, if you look closely at the Lispbox website, then, under the links for downloading the package, you will see:
Last updated: February 6, 2011.
In this article I will explain in detail how to install and configure
Common Lisp cross-platform development environment, how to download and install additional libraries using
quicklisp , the package manager for
Common Lisp . There will be many useful links to resources and materials on the language.
It's about a bunch of
GNU Emacs & Slime.If you are interested in
Common Lisp , you need a
cross-platform ,
powerful ,
interactive Common Lisp IDE with
blackjack and ladies debugger and disassembler
(all of a sudden!) , Then please…
')
Choice of implementation of Common Lisp
Common Lisp is an
ANSI standardized programming language that does not have a single canonical implementation.
I will give a list of the main implementations:
We need a cross-platform, free, avtivno developing
Common Lisp implementation . I chose
SBCL .
So, let's begin!!!
Preparatory work
MS Windows
- Create a directory for GNU Emacs at: C: \ emacs \
- Create a directory for SBCL at: C: \ sbcl \
- Download the latest version of GNU Emacs and unpack it in the directory C: \ emacs \
- Download the SBCL distribution and install it in the C: \ sbcl \ directory
- Go to the directory with GNU Emacs ( C: \ emacs \ bin \ ), find addpm.exe and run it
(will add an Emacs launch icon to the Start menu ) - Editing environment variables:
- Create an environment variable called HOME (if you haven’t already done so ...) and the value
C: \ Users \% username% \ , where% username% is the name of your account - Create an environment variable called PATH (if you haven’t already done so ...) and the value C: \ emacs \ bin \
- Create an empty file called .emacs in C: \ Users \% username% \
- Create an empty C: \ Users \% username% \. Quicklisp \ directory
- Download the quicklisp.lisp file and place it in the C: \ Users \% username% \. Quicklisp \ directory
GNU / Linux (deb-based distributives)
- Install GNU Emacs :
sudo apt-get -y install emacs24 sudo apt-get -y install org-mode sudo apt-get -y install emacs24-el sudo apt-get -y install emacs-goodies-el
- Install SBCL :
sudo apt-get -y install sbcl sudo apt-get -y install sbcl-doc sudo apt-get -y install sbcl-source
- Create an empty file called .emacs in the home directory ~ /
- Create an empty ~ / .quicklisp / directory
- Download the quicklisp.lisp file and place it in the ~ / .quicklisp / directory
sudo apt-get -y install curl curl -o $HOME/.quicklisp/quicklisp.lisp https://beta.quicklisp.org/quicklisp.lisp
Emacs setup
It's time to set up
Emacs for professional work with
Common Lisp projects.
A warningAll further configuration work will take place in GNU Emacs .
Everything below applies to both MS Windows and GNU / Linux .
Means mastering the basics of editing in Emacs .
Open for editing the
.emacs file. Go!
- Define a Common Lisp implementation :
(require 'cl) (setq-default inferior-lisp-program "sbcl")
- Set up the Emacs batch manager:
Now, when you start Emacs again, the packages will automatically download and install:
- Set up our packages:
(when (packages-installed-p) (require 'smartparens-config) (smartparens-global-mode) (require 'auto-complete-config) (ac-config-default) (global-auto-complete-mode t) (setq-default ac-auto-start t) (setq-default ac-auto-show-menu t) (defvar *sources* (list 'lisp-mode 'ac-source-semantic 'ac-source-functions 'ac-source-variables 'ac-source-dictionary 'ac-source-words-in-all-buffer 'ac-source-files-in-current-dir)) (let (source) (dolist (source *sources*) (add-to-list 'ac-sources source))) (add-to-list 'ac-modes 'lisp-mode) (require 'slime) (require 'slime-autoloads) (slime-setup '(slime-asdf slime-fancy slime-indentation)) (setq-default slime-net-coding-system 'utf-8-unix))
- Adjust the indents of the Lisp code:
(setq-default lisp-body-indent 2) (setq-default lisp-indent-function 'common-lisp-indent-function)
Save the
.emacs file and restart
Emacs .
Emacs will download and install
Slime ,
Smartparens and
Auto Complete automatically to the directory
C: \ Users \% username% \. Emacs.d \ for
MS Windows and to the
~ / .emacs.d / directory on
GNU / Linux .
A warningWritten by us, just now, the .emacs configuration file is cross-platform!
When transferring from Linux to Windows and vice versa, nothing needs to be changed!
The main thing is to place .emacs in the desired directory ( creating an environment variable
HOME for MS Windows is a must! ).
Celebrating early, you need to set up
quicklisp , the package manager for
Common Lisp .
Install and configure quicklisp
Quicklisp is a batch manager for the
Common Lisp language .
- In running Emacs, execute the command Mx slime (Alt-x slime) ;
will start the development environment Common Lisp - Slime
- Perform:
For example, install a couple of libraries for
Common Lisp using
quicklisp :
- CEPL is a lispy and REPL friendly library for working with OpenGL:
(ql:quickload :swank) (ql:quickload :sdl2) (ql:quickload :cepl.sdl2)
- work with DB:
(ql:quickload :cl-dbi)
- Web server:
(ql:quickload :hunchentoot)
- ...
- Insert favorite extension % username%
- update installed libraries and quicklisp itself:
(ql:update-all-dists) (ql:update-client)
For
Common Lisp , a
large number of quality libraries have been written for all occasions.
With
quicklisp, they are easy to install and use.
Actually, you now have everything you need to plunge into the world of
Common Lisp !
Congratulations!
useful links