Common Lisp IDE

Good day, dear reader!
Before each newcomer to the Common Lisp programming language world
, the problem arises of choosing a development environment — the Integrated Development Environment (hereinafter, IDE ).
There are many IDEs for Common Lisp . We list some of the most common of them:
- LispWorks IDE (commercial, crossplatform)
- Allegro Common Lisp (commercial, crossplatform)
- LispIDE (open source, Windows 2K / XP / Vista / 7)
- Lispbox (open source, crossplatform)
- Emacs + Slime (open source, crossplatform)
For connoisseurs
Connoisseurs may object to the last two items on the list.
After all, it would seem that Lispbox = Emacs + Slime ?!
But, if you look closely at the Lispbox website, then, under the links for downloading the package, you will see:
After all, it would seem that 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 describe in detail how to install and configure a cross-platform development environment for Common Lisp , how to download and install additional libraries using quicklisp , the Common Lisp package manager . There will be many useful links to resources and materials on the language.
It's about the GNU Emacs & Slime bunch .
If you are interested in Common Lisp , you need a cross-platform , powerful , interactive Common Lisp IDE with
Choosing a Common Lisp Implementation
Common Lisp is an ANSI standardized programming language that does not have a single canonical implementation.
Here is a list of the main implementations:
- Allegro Common Lisp
- Austin Kyoto Common Lisp
- CLISP
- CMU Common Lisp
- Coral common lisp
- Corman common lisp
- Embeddable Common Lisp
- GNU Common Lisp
- Kyoto Common Lisp
- Macintosh Common Lisp
- Clozure common lisp
- Steel Bank Common Lisp (SBCL)
We need a cross-platform, free, dynamically developing implementation of Common Lisp . 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 into the C: \ emacs \ directory
- Download the SBCL distribution and install in the directory C: \ sbcl \
- We go into the directory with GNU Emacs ( C: \ emacs \ bin \ ), find addpm.exe and run it
(add the Emacs launcher icon to the Start menu ) - Editing environment variables:
- We create an environment variable with the name HOME (if you haven’t done it yet ...) and the value
C: \ Users \% username% \ , where% username% is the name of your account - We create an environment variable with the name PATH (if you haven’t done this yet ...) and the value C: \ emacs \ bin \
- We create an environment variable with the name HOME (if you haven’t done it yet ...) and the value
- Create an empty file called .emacs in C: \ Users \% username% \
- Create an empty directory C: \ Users \% username% \. Quicklisp \
- 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 directory ~ / .quicklisp /
- 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
Configure Emacs
It's time to set up Emacs for professional work with Common Lisp projects.
Warning
All further work on setting up the system will take place in GNU Emacs .
Everything below applies to both MS Windows and GNU / Linux .
Imacs basic knowledge of editing in Emacs .
Everything below applies to both MS Windows and GNU / Linux .
Imacs basic knowledge of editing in Emacs .
Open the .emacs file for editing . Go!
- Define the implementation of Common Lisp :
(require 'cl) (setq-default inferior-lisp-program "sbcl") - Set up the Emacs package manager:
;; Package manager: ;; Initialise package and add Melpa repository (require 'package) (add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t) (package-initialize) (defvar required-packages '(slime smartparens auto-complete)) (defun packages-installed-p () (loop for package in required-packages unless (package-installed-p package) do (return nil) finally (return t))) (unless (packages-installed-p) (package-refresh-contents) (dolist (package required-packages) (unless (package-installed-p package) (package-install package))))
Now, when you start Emacs again, the automatic download and installation of packages will begin: - We configure 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)) - Configure the indentation 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 in the
C: \ Users \% username% \. Emacs.d \ directory for MS Windows and in the ~ / .emacs.d / directory on GNU / Linux .
Warning
The .emacs configuration file we just wrote is cross-platform!
When porting from Linux to Windows and vice versa, nothing needs to be changed!
The main thing is to place .emacs in the correct directory ( creating a
HOME environment variable for MS Windows is a must! ).
When porting from Linux to Windows and vice versa, nothing needs to be changed!
The main thing is to place .emacs in the correct directory ( creating a
HOME environment variable for MS Windows is a must! ).
It's too early to celebrate, you still need to configure quicklisp , the Common Lisp package manager .
Install and configure quicklisp
Quicklisp is a Common Lisp language pack manager .
- In running Emacs, run the command Mx slime (Alt-x slime) ; Common Lisp
Development Environment Launches - Slime - Run:
;; Подгрузим менеджер пакетов (load "~/.quicklisp/quicklisp.lisp") ;; Автоматический скачается и установится менеджер пакетов quicklisp ;; со всеми зависимостями (quicklisp-quickstart:install :path "~/.quicklisp/") ;; Создаст .sbclrc файл в домашней директории ;; и, при каждом запуске среды Slime/SBCL, будет подгружать ;; скаченные и установленные Вами пакеты и библиотеки (ql:add-to-init-file)
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 the database:
(ql:quickload :cl-dbi) - Web server:
(ql:quickload :hunchentoot) - ...
- Paste your favorite extension % username%
- updating installed libraries and quicklisp itself :
(ql:update-all-dists) (ql:update-client)
For Common Lisp , a large number of high-quality libraries have been written for all occasions.
With quicklisp, they are easy to install and start using.
Actually, you now have everything you need to plunge headlong into the world of Common Lisp !
Congratulations!
useful links
- The main language site
- The Common Lisp Wiki is a great site.
Description of all known and useful libraries and development environments. In short - Wiki - Russian-speaking community
- Great Common Lisp Tutorial (Translation) - Practical Common Lisp
- My .emacs
- A series of video tutorials "Tutorial on writing a Raytracer in Common Lisp" on creating Raytracer on Common Lisp
- New, beautiful site for Common Lisp