Reorganize code and text into "Sly" and "Slynk" sections

This commit is contained in:
Gerard Vermeulen 2024-06-22 16:45:09 +02:00
parent 708c766f15
commit b85cd11628

View File

@ -3890,23 +3890,19 @@ Links to Common Lisp books and posts are:
:CUSTOM_ID: sec:sly
: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 does not ensure the [[info:sly#Auto-SLY][automatic connection to the lisp server (info)]] when
opening a Common Lisp file because it does not play well with =ob-lisp=.
Listing [[lst:setup-sly]] sets up 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 sets the =sly-default-lisp= and =sly-lisp-implementations= options. It
uses a core image file to apply the technique to [[info:sly#Loading Slynk faster][load Slynk faster (info)]] and
listing [[lst:sbcl-core-for-sly]] tangles to a script to dump such a [[http://www.sbcl.org/][SBCL]] core.
2. It does not ensure [[info:sly#Auto-SLY][Connecting to SLY automatically (info)]] when opening a
Common Lisp file because that does not play well with =ob-lisp=.
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.
Listing [[lst:slink-sel]] allows to set or get the Sly string elision length.
Finally, listing [[lst:configure-sly]] uses a technique to [[info:sly#Loading Slynk faster][load Slynk faster (info)]]
by means of a custom core file in src_emacs-lisp[:results
none]{(describe-variable 'no-littering-var-directory)}. Listing
[[lst:sbcl-core-for-sly]] tangles to a script to dump such a [[http://www.sbcl.org/][SBCL]] core.
to [[info:sly#Basic customization][Basic customization (info)]].
#+caption[Configure =sly=]:
#+caption: Configure =sly=.
#+name: lst:configure-sly
#+caption[Setup =sly=]:
#+caption: Setup =sly=.
#+name: lst:setup-sly
#+begin_src emacs-lisp -n :results silent
(when (ensure-package-installation 'sly 'sly-macrostep 'sly-named-readtables)
(with-eval-after-load 'sly
@ -3915,19 +3911,13 @@ none]{(describe-variable 'no-littering-var-directory)}. Listing
;; compatibility fallback option.
;; The warning "Value sbcl does not match type function" is due to
;; the buggy `defcustom' type of `sbcl-default-lisp' in `sly.el'.
(setopt sly-db-initial-restart-limit 10
sly-default-lisp 'sbcl
(setopt sly-default-lisp 'sbcl
sly-lisp-implementations
`((ccl (,(executable-find "ccl64")))
(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
@ -3942,6 +3932,32 @@ none]{(describe-variable 'no-littering-var-directory)}. Listing
(keymap-set sly-prefix-map "M-h" #'sly-documentation-lookup)))
#+end_src
#+caption[Script to dump a SBCL core for the Sly Common Lisp IDE]:
#+caption: Script to dump a SBCL core for the Sly Common Lisp IDE.
#+header: :tangle-mode (identity #o755)
#+name: lst:sbcl-core-for-sly
#+begin_src shell -n :eval never :tangle ~/bin/sbcl.core-for-sly
#!/bin/sh
sbcl <<EOF
(mapc 'require '(sb-bsd-sockets sb-posix sb-introspect sb-cltl2 asdf))
(save-lisp-and-die "sbcl.core-for-sly")
EOF
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# sh-basic-offset: 2
# End:
#+end_src
*** [[info:sly#Other configurables][Slynk configurables (info)]]
:PROPERTIES:
:CUSTOM_ID: sec:slynk
:END:
Listing [[lst:slink-sel]] allows to set or get the Sly string elision length.
#+caption[Get/set Sly ~slynk:*string-elision-length*~ functionality]:
#+caption: Get/set Sly ~slynk:*string-elision-length*~ functionality.
#+name: lst:slink-sel
@ -3990,25 +4006,6 @@ Valid LENGTH values are positive integers to set or `nil' to reset."
(slynk-eval-sel-command (slynk-command-set-sel length))))
#+end_src
#+caption[Script to dump a SBCL core for the Sly Common Lisp IDE]:
#+caption: Script to dump a SBCL core for the Sly Common Lisp IDE.
#+header: :tangle-mode (identity #o755)
#+name: lst:sbcl-core-for-sly
#+begin_src shell -n :eval never :tangle ~/bin/sbcl.core-for-sly
#!/bin/sh
sbcl <<EOF
(mapc 'require '(sb-bsd-sockets sb-posix sb-introspect sb-cltl2 asdf))
(save-lisp-and-die "sbcl.core-for-sly")
EOF
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# sh-basic-offset: 2
# End:
#+end_src
*** [[https://courses.cs.northwestern.edu/325/][CS 325 AI Programming]]
:PROPERTIES:
:CUSTOM_ID: sec:cs-325-ai-programming