|
Using eev to install and test Sly
I'm working on some "executable notes" that would let
people install Sly and test it in several ways. Here is a
screenshot on an old version (click to enlarge):
This is a work in progress that is in a very early stage. Many,
many, many thanks to Catie from #emacs for answering zillions of my
questions! =)
To use this you need to install a very recent version of eev - you
need the version from the git repo; the version in ELPA is older - and
then you need to run `M-x find-try-sly-links'. This will display the
following executable notes in a temporary buffer:
# (find-try-sly-links)
# (find-efunction 'find-try-sly-links)
•• 1. Install some Debian packages
•• ===============================
•• Note that the package "hyperspec" will install
•• a local copy of the Common Lisp Hyperspec here:
•• (find-fline "/usr/share/doc/hyperspec/")
••
• (eepitch-shell)
• (eepitch-kill)
• (eepitch-shell)
sudo apt-get install sbcl hyperspec maxima
•• 2. Install some elisp packages
•• ==============================
•• Here we use low-level sexps instead of `M-x list-packages'.
•• Note that some of the sexps below take several seconds to run.
••
• (package-initialize)
• (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
• (package-refresh-contents)
• (package-install 'sly)
• (package-install 'clhs)
•• 3. Download quicklisp.lisp
•• ==========================
••
• (eepitch-shell)
• (eepitch-kill)
• (eepitch-shell)
mkdir -p $S/https/beta.quicklisp.org/
cd $S/https/beta.quicklisp.org/
ls -lAF
rm -fv quicklisp.lisp
wget -nc https://beta.quicklisp.org/quicklisp.lisp
# (find-fline "$S/https/beta.quicklisp.org/")
# (find-fline "$S/https/beta.quicklisp.org/quicklisp.lisp")
•• 4. Run quicklisp.lisp
•• =====================
•• Ask it to install slynk and to change ~/.sbclrc.
••
• (eepitch-shell)
• (eepitch-kill)
• (eepitch-shell)
cd $S/https/beta.quicklisp.org/
sbcl --load quicklisp.lisp
(quicklisp-quickstart:help)
(quicklisp-quickstart:install)
(ql:quickload :slynk)
(ql:add-to-init-file)
;; Inspect the changes in ~/.sbclrc:
;; (find-fline "~/.sbclrc")
;; (find-fline "~/.sbclrc" "added by ql:add-to-init-file:")
;; Inspect the ~/quicklisp/ directory:
;; (code-c-d "ql" "~/quicklisp/")
;; (find-qlfile "")
;; (find-qlsh "find * | sort")
•• 5. Change your ~/.emacs
•• =======================
•• Copy the block below to your ~/.emacs:
••
;; From: (find-try-sly-links)
;; The `code-rstdoc' below defines `find-clhsdoc':
;; (find-code-rstdoc :clhs)
(code-rstdoc :clhs)
;;
;; See: (find-status "hyperspec")
;; (find-vldifile "hyperspec.list")
;; (find-udfile "hyperspec/")
;; (find-evardescr 'clhs-root)
;; (find-evariable 'clhs-root)
;; (find-ehashtable clhs-symbols)
;; Tests: (find-clhsdoc)
;; (find-clhsdoc "Body/m_loop")
;; (find-clhsdoci "loop")
;; (ee-clhs-lookup-index "loop")
;;
(setq clhs-root "file:///usr/share/doc/hyperspec/")
(defun ee-clhs-lookup-index (name)
(require 'clhs)
(gethash (upcase name) (clhs-symbols)))
(defun find-clhsdoci (name &rest rest)
(let* ((str0 (ee-clhs-lookup-index name))
(str (replace-regexp-in-string "\\.html?$" "" str0)))
(find-clhsdoc str)))
(code-c-d "sbcl" "/usr/share/sbcl-source/" "sbcl")
(code-c-d "ql" "~/quicklisp/")
;; (find-qlfile "")
;; (find-qlsh "find * | sort")
•• 6. Test Sly
•• ===========
•• One of its messages will (should?) be:
•• [sly] Connecting to Slynk on port 45477.
••
• (eepitch-sly)
• (eepitch-kill)
• (eepitch-sly)
;; From: (find-es "lisp" "sharpsign-P")
(apropos "PATHNAME")
(make-pathname :name "FOO")
(inspect (make-pathname :name "FOO"))
(macroexpand '(defstruct mypoint x y))
(defvar o)
(setq o (macroexpand '(defstruct mypoint x y)))
••
•• Now try `M-.' on a symbol name, and `M-,' to go back.
•• Then try `C-c I <sexp>' - for example, `C-c I (list 2 3)'.
•• These key sequences are explained in these pages:
•• (find-node "(sly)Finding definitions" "M-." "sly-edit-definition")
•• (find-node "(sly)Inspector" "C-c I" "sly-inspect")
•• Try also this low-level way to run the inspector:
• (eepitch-eval-at-target-window '(sly-inspect "o"))
•• 7. Tell Maxima how to load Sly
•• ==============================
•• Run this,
•• (mkdir "~/.maxima/" t)
•• and then copy the block below to:
•• (find-fline "~/.maxima/startsly.lisp")
;; From: (find-try-sly-links)
;; Based on: (find-angg ".maxima/startsly.lisp")
;;
(load #P"~/quicklisp/setup.lisp")
(ql:quickload :slynk)
(slynk:create-server :port 56789 :dont-close t)
•• 8. Inspect Maxima with Sly
•• ==========================
•• Note that here we have two eepitch targets,
•• and we alternate between them...
••
• (eepitch-maxima)
• (eepitch-kill)
• (eepitch-maxima)
load("startsly");
• (sly-connect "localhost" 56789)
• (eepitch-sly)
(describe '$changevar)
••
•• Now go to the sly-mrepl buffer, put the point
•• on the "MAXIMA::$CHANGEVAR", and type `M-.'.
|
At this moment only people with a lot of practice with eev will be
able to figure out how to execute those executable notes =(, but I am
planning to record a video with instructions very soon... it will be
similar to my video on how to use eev to learn Tikz,
but much simpler. My plans are: 1) send an e-mail to the Maxima
mailing list asking for more things to put in the section "8. Inspect
Maxima with Sly"; 2) test their suggestions and clean them up; 3)
record the video.
Other links:
A question about Sly/Slime: how do I invoke the inspector from Common Lisp?
https://lists.gnu.org/archive/html/help-gnu-emacs/2023-01/msg00165.html
(find-TH "emacsconf2020")
(find-TH "2020-some-template-based")
http://angg.twu.net/emacsconf2020.html
http://angg.twu.net/2020-some-template-based.html
(find-1stclassvideolsubs "eev2020")
(find-1stclassvideolsubs "eevtempl")
(find-eev "eev-tlinks.el" "find-try-sly-links")
|