doomemacs/modules/lang/common-lisp/autoload/common-lisp.el
Henrik Lissner 819c20bb69
feat(common-lisp): make quicklisp directory configurable
Previously, `+lisp/find-file-in-quicklisp` used a hard-coded directory
aimed at a nonstandard Quicklisp install location, `~/.quicklisp`. The
default install location is `~/quicklisp`, without the dot. This commit
makes the user's Quicklisp directory configurable through the variable
`+lisp-quicklisp-paths`. `+lisp/find-file-in-quicklisp` has been updated
to respect this variable.

Close: #7830
Co-authored-by: bpseudopod <bpseudopod@users.noreply.github.com>
2024-06-30 15:08:21 -04:00

44 lines
1.6 KiB
EmacsLisp

;;; lang/common-lisp/autoload/common-lisp.el -*- lexical-binding: t; -*-
;; HACK Fix #1772: void-variable sly-contribs errors due to sly packages (like
;; `sly-macrostep') trying to add to `sly-contribs' before it is defined.
;;;###autoload (defvar sly-contribs '(sly-fancy))
;;;###autoload
(defun +lisp/open-repl ()
"Open the Sly REPL."
(interactive)
(require 'sly)
(if (sly-connected-p) (sly-mrepl)
(sly nil nil t)
(cl-labels ((recurse (attempt)
(sleep-for 1)
(cond ((sly-connected-p) (sly-mrepl))
((> attempt 5) (error "Failed to start Slynk process."))
(t (recurse (1+ attempt))))))
(recurse 1))))
;;;###autoload
(defun +lisp/reload-project ()
"Restart the Sly session and reload a chosen system."
(interactive)
(sly-restart-inferior-lisp)
(cl-labels ((recurse (attempt)
(sleep-for 1)
(condition-case nil
(sly-eval "PONG")
(error (if (= 5 attempt)
(error "Failed to reload Lisp project in 5 attempts.")
(recurse (1+ attempt)))))))
(recurse 1)
(sly-asdf-load-system)))
;;;###autoload
(defun +lisp/find-file-in-quicklisp ()
"Find a file belonging to a library downloaded by Quicklisp."
(interactive)
(doom-project-find-file
(or (cl-loop for dir in +lisp-quicklisp-paths
if (file-directory-p dir)
return (expand-file-name "dists/" dir))
(user-error "Couldn't find your Quicklisp directory (customize `+lisp-quicklisp-paths')"))))