Give the defsystem a different package than the app.
Be careful not to pass an explicit debug nil, it prevents debugging.
Fix indentation.
An opinionated template for kickstarting new Common Lisp projects with quickproject.
When starting most any programming project, many things are needed:
(Perhaps dubiously, I lean on the transitive dependency on alexandria and only load serapeum and a local-nickname for its bundle package.)
Once these basic ingredients are provided we need ways to use them such as:
.build.yml
make test
mgl-pax
and make docs
src/docs.lisp
and run make docs
to sample the output# make docs
mgl-pax
and make site
make app
Finally there are some things that are very specific to my taste:
JOURNAL.org
and TODO.org
files 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 ~/.sbclrc
)
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. But please, hack the template up all you like.
(defun new-project (name &key
(srht-user "kingcons")
(projects-dir "projects")
(author "Brit Butler")
(license "MIT")
(include-copyright nil)
(depends-on '(:serapeum
:iterate
: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"
Afterwards, you can simply dive into your project and start hacking while using make as you please. Note that there are Makefile targets for:
app
- to compile a binary in the projects bin folderdocs
- to generate a README from the docs file using MGL-PAXrepl
- to spawn a repl you can slime-connect tosite
- to generate the documentation as a webpage, handy with Sourcehut pages and .build.ymltest
- to invoke the test suiteFinally, the Makefile defaults to SBCL but also works with Clozure and should be easy to extend. To use it with an alternate lisp, simply pass the command for your lisp to make:
make test LISP=ccl