Install and configure the Sly Common Lisp IDE

This commit is contained in:
Gerard Vermeulen 2022-01-23 11:56:37 +01:00
parent 5560390519
commit 6c642fa2fc

View File

@ -214,6 +214,7 @@ the ~custom-file~ as [[info:emacs#Saving Customizations][saving customizations (
pyenv-mode ; Python environment selector pyenv-mode ; Python environment selector
quelpa ; install Emacs packages from source quelpa ; install Emacs packages from source
rainbow-mode ; set background color to color string rainbow-mode ; set background color to color string
sly ; Sylvester the Cat's Common Lisp IDE
smartparens ; smart editing of character pairs smartparens ; smart editing of character pairs
toml-mode ; Tom's Obvious Minimal Language mode toml-mode ; Tom's Obvious Minimal Language mode
undo-tree ; more advanced yet simpler undo system undo-tree ; more advanced yet simpler undo system
@ -986,6 +987,11 @@ The code in listing [[lst:customize-org-babel]], [[lst:customize-org]], and
'(org-babel-latex-end-env '(org-babel-latex-end-env
(lambda (_) (lambda (_)
"\\end{document}\n")))) "\\end{document}\n"))))
(with-eval-after-load 'ob-lisp
(with-eval-after-load 'sly
(custom-set-variables
'(org-babel-lisp-eval-fn #'sly-eval))))
#+end_src #+end_src
#+caption[Customize =Org=]: #+caption[Customize =Org=]:
@ -1226,6 +1232,7 @@ this document to =html= and LaTeX correctly.
("marginalia" . "https://github.com/minad/marginalia") ("marginalia" . "https://github.com/minad/marginalia")
("org" . "https://orgmode.org/org.html") ("org" . "https://orgmode.org/org.html")
("orderless" . "https://github.com/oantolin/orderless") ("orderless" . "https://github.com/oantolin/orderless")
("sly" . "https://joaotavora.github.io/sly/")
("vertico" . "https://github.com/minad/vertico")) ("vertico" . "https://github.com/minad/vertico"))
org-info-other-documents org-info-other-documents
:test #'equal))) :test #'equal)))
@ -1798,6 +1805,55 @@ non-interactive =org-element= functions to an =Emacs-lisp= buffer.
:CUSTOM_ID: sec:programming :CUSTOM_ID: sec:programming
:END: :END:
** Common Lisp programming
:PROPERTIES:
:CUSTOM_ID: sec:common-lisp-programming
:END:
Listing [[lst:configure-sly]] configures the [[info:sly#Top][Sly (info)]] Common Lisp IDE for Emacs
for use with [[http://www.sbcl.org/][Steel Bank Common Lisp (sbcl)]]:
1. It configures =sly-default-lisp= and =sly-lisp-implementations= as in the
~sly~ documentation string instead of in the [[info:sly#Multiple
Lisps][multiple lisps (info)]] manual.
2. It ensures the [[info:sly#Auto-SLY][automatic connection to the lisp server (info)]] when opening a
Common Lisp file.
3. It configures searching documentation in the [[http://www.lispworks.com/documentation/HyperSpec/Front/][Common Lisp HyperSpec]] according
to the [[info:sly#Basic customization][basic customization (info)]] manual.
#+caption[Configure =sly=]:
#+caption: Configure =sly=.
#+name: lst:configure-sly
#+begin_src emacs-lisp
(with-eval-after-load 'sly
(custom-set-variables
;; Customize `sly-default-lisp' instead of `inferior-lisp-program',
;; because `sly' uses `inferior-lisp-program' only as a backwards
;; compatibility fallback option.
'(sly-default-lisp 'sbcl)
`(sly-lisp-implementations
'((sbcl (,(executable-find "sbcl")
"--core"
,(no-littering-expand-var-file-name "sbcl.core-for-sly"))))))
(add-hook 'sly-mode-hook
(defun on-sly-mode-hook ()
(unless (sly-connected-p)
(save-excursion (sly)))))
(cond
((eq system-type 'darwin)
(setq common-lisp-hyperspec-root
"file:///usr/local/share/doc/hyperspec/HyperSpec/")
(setq common-lisp-hyperspec-symbol-table
(concat common-lisp-hyperspec-root "Data/Map_Sym.txt")))
((eq system-type 'gnu/linux)
(setq common-lisp-hyperspec-root
"file:///usr/share/doc/hyperspec-7.0/HyperSpec/"))
(t (message "Default Common Lisp HyperSpec access")))
(define-key sly-prefix-map (kbd "M-h") #'sly-documentation-lookup))
#+end_src
** Emacs-lisp programming ** Emacs-lisp programming
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: sec:emacs-lisp-programming :CUSTOM_ID: sec:emacs-lisp-programming
@ -1805,7 +1861,7 @@ non-interactive =org-element= functions to an =Emacs-lisp= buffer.
** [[https://www.seas.upenn.edu/~chaoliu/2017/09/01/python-programming-in-emacs/][Python programming]] ** [[https://www.seas.upenn.edu/~chaoliu/2017/09/01/python-programming-in-emacs/][Python programming]]
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: sec:python-coding :CUSTOM_ID: sec:python-programming
:END: :END:
The [[https://www.emacswiki.org/emacs/PythonProgrammingInEmacs][Python Programming in Emacs]] wiki page lists options to enhance Emacs's The [[https://www.emacswiki.org/emacs/PythonProgrammingInEmacs][Python Programming in Emacs]] wiki page lists options to enhance Emacs's
built-in ~python-mode~. Here, the focus is on two packages: built-in ~python-mode~. Here, the focus is on two packages:
@ -2251,8 +2307,7 @@ LaTeX, Org, and Python.
'(sp-override-key-bindings '(("C-(" . sp-backward-barf-sexp) '(sp-override-key-bindings '(("C-(" . sp-backward-barf-sexp)
("C-)" . sp-forward-slurp-sexp)))) ("C-)" . sp-forward-slurp-sexp))))
(dolist (hook '(prog-mode-hook (dolist (hook '(prog-mode-hook text-mode-hook))
text-mode-hook))
(add-hook hook #'smartparens-mode)) (add-hook hook #'smartparens-mode))
;; Hook on the specific `eval-expression-minibuffer-setup-hook' ;; Hook on the specific `eval-expression-minibuffer-setup-hook'
@ -2260,7 +2315,9 @@ LaTeX, Org, and Python.
(dolist (hook '(emacs-lisp-mode-hook (dolist (hook '(emacs-lisp-mode-hook
eval-expression-minibuffer-setup-hook eval-expression-minibuffer-setup-hook
ielm-mode-hook ielm-mode-hook
python-mode-hook)) lisp-mode-hook
python-mode-hook
sly-mrepl-mode-hook))
(add-hook hook #'smartparens-strict-mode)) (add-hook hook #'smartparens-strict-mode))
;; Tweak for the call to `smartparens-strict-mode' hooked on ;; Tweak for the call to `smartparens-strict-mode' hooked on