This is a collection of Yasnippets for Common Lisp. It includes snippets for top-level forms and (as a bonus) headers for popular free-software licenses: GNU GPL and MIT License.
To use these snippets you need to install the Yasnippet package. Once you have Yasnippet installed, place contents of this repository on your load path, so Emacs can see it and add the following to your configuration file:
(require 'common-lisp-snippets)
It's now available via MELPA: M-x package-install RET common-lisp-snippets RET—and you are done!
To insert a snippet, type its name and press ↹ Tab or C-i, for example:
defsystem
⇒
(asdf:defsystem :system-name
:version "0.1.0"
:description "description"
:author "user-full-name <user-mail-address>"
:serial t
:license "GNU GPL, version 3"
:components ((:file "file.lisp"))
:depends-on (#:alexandria))
…you can move through the fields pressing ↹ Tab and edit or
delete them. Some fields, like :author
try to guess their values.
As a special bonus, there are snippets to insert headers of files that
contain information about the software license (gnugpl
and mitlic
), they
are smart too.
There are some stylistic conventions:
-
Name files without extensions.
-
Start every file with this preamble:
# -*- mode: snippet -*- # contributor: your name # name: readable name of the snippet # key: what user needs to enter # --
The first line is needed to activate mode for snippet editing in Emacs, Yasnippet ships with it.
-
Make sure your files don't have an empty line at the end. This is important, because it will be inserted when your snippet is expanded.
snippet-mode
takes care of this, settingrequire-final-newline
tonil
, just make sure you haven't put it there manually.
Copyright © 2015–2017 Mark Karpov
Distributed under GNU GPL, version 3.