An opinionated template for kickstarting new Common Lisp projects with quickproject.
When starting most any programming project, many things are needed:
Once these basic ingredients are provided we need ways to use them such as:
make docsto sample the output
# make docs
Finally there are some things that are very specific to my taste:
TODO.orgfiles for this purpose
Perhaps at some point I will write more on why I have converged on this set of preferences.
I would also like to add a
deploy command for pushing the site to pages.sr.ht but
haven't yet gotten around to it.
Clone this repo to your local machine and add the helper script to your path:
git clone https://git.sr.ht/~kingcons/lisp-template ~/.lisp-template echo '\n# lisp-template helper' >> ~/.zshrc # (or ~/.bashrc as appropriate) echo 'export PATH="$HOME/.lisp-template/bin:$PATH"' >> ~/.zshrc
Then define a
new-project function in your lisp init-file (such as
to leverage the template. Make sure to modify the default values to your liking! :)
NOTE: We rely on
mgl-pax for generating the README and
try for tests.
If you want to change those things, you will need to dive deeper into modifying the template.
(defun new-project (name &key (srht-user "kingcons") (projects-dir "projects") (author "Brit Butler") (license "MIT") (include-copyright nil) (depends-on '(:alexandria :serapeum :iterate :trivial-package-local-nicknames :mgl-pax :swank)) (template-directory "~/.lisp-template/template/")) (unless (find-package :quickproject) (ql:quickload :quickproject)) ; Quickproject transitively loads cl-fad (let* ((builder (find-symbol "MAKE-PROJECT" "QUICKPROJECT")) (dir-ify (find-symbol "PATHNAME-AS-DIRECTORY" "CL-FAD")) (ql-path (merge-pathnames name (first ql:*local-project-directories*))) (pathname (funcall (find-symbol "MERGE-PATHNAMES-AS-DIRECTORY" "CL-FAD") (user-homedir-pathname) (funcall dir-ify projects-dir) (funcall dir-ify name)))) (push (lambda () (list :srht-user srht-user)) (symbol-value (find-symbol "*TEMPLATE-PARAMETER-FUNCTIONS*" :quickproject))) (funcall builder pathname :author author :license license :include-copyright include-copyright :depends-on depends-on :template-directory template-directory)) (uiop:run-program (list "ln" "-sf" (namestring pathname) (namestring ql-path))))
Either call from the REPL or use the command line helper if the default args are sufficient. (Currently the CLI script doesn't support specifying alternative options.)
Note that the
COPYING file in the template is an MIT license so change its contents if needed.
lisp-project my-project cd ~/projects/my-project git init sh bin/install-hooks git add . git commit -m "Initial commit"