feat(common-lisp): set custom repl opener
After some experimentation, calling `sly` non-interactively when no Slynk connection involves some strange async affects which displease the REPL-opening code. Instead, we start the Slynk process, wait while it loads, and then finally connect with the usual `sly-mrepl`, whose Elisp would have been loaded by this point.
This commit is contained in:
parent
ef525e6184
commit
8063b02a80
2 changed files with 15 additions and 1 deletions
|
@ -3,3 +3,17 @@
|
|||
;; 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))))
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
(remove-hook 'lisp-mode-hook #'sly-editing-mode))
|
||||
|
||||
(after! lisp-mode
|
||||
(set-repl-handler! 'lisp-mode #'sly-mrepl)
|
||||
(set-repl-handler! 'lisp-mode #'+lisp/open-repl)
|
||||
(set-eval-handler! 'lisp-mode #'sly-eval-region)
|
||||
(set-lookup-handlers! 'lisp-mode
|
||||
:definition #'sly-edit-definition
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue