(Re)generate: (find-try-sly-intro) Source code: (find-efunction 'find-try-sly-intro) More intros: (find-eev-quick-intro) (find-eev-intro) (find-eepitch-intro) This buffer is _temporary_ and _editable_. It is meant as both a tutorial and a sandbox. Prerequisites: (find-windows-beginner-intro "7. Test Maxima") and, for the last sections, a Maxima compiled with SBCL. The Maxima in Debian uses GCL, that is not supported by Quicklisp or by Sly. This is rewrite of: (find-try-sly-links)1. Install the Common Lisp Hyperspec
Run this with <f8>s: * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) sudo apt-get install -y hyperspec Note that the package "hyperspec" will install a local copy of the CLHS here: (find-fline "/usr/share/doc/hyperspec/") The low-level way to point to pages of the CLHS is with `find-clhsdoc'. The easiest way to define the function `find-clhsdoc' is by running `ee-rstdoc-default-defuns'. Try: ;; See: (find-rstdoc-intro "0. Preparation") (ee-rstdoc-default-defuns) Then this should open the contents page of the local copy of the CLHS: (find-clhsdoc "Front/Contents")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. (progn (package-initialize) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/")) (package-refresh-contents) (package-install 'sly) (package-install 'clhs) ) The high-level way to point to pages of the CLHS is with `find-clhsdoci'. Try: ;; See: (find-eev "eev-plinks.el" "find-clhsdoci") (find-clhsdoci "car")3. Adjust your ~/.emacs
Now add these sexps to your ~/.emacs: (code-c-d "sly" (ee-locate-library "sly.el") "sly") (code-c-d "ql" "~/quicklisp/") The best way to do that is with: (find-dot-emacs-links "sly")4. Download quicklisp.lisp
Quicklisp is a package manager for Common Lisp. See: https://beta.quicklisp.org/ ** To delete a previous installation, do: ** * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) ls -lAF $S/https/beta.quicklisp.org/quicklisp* rm -Rfv $S/https/beta.quicklisp.org/quicklisp* ls -lAF ~/quicklisp/ rm -Rfv ~/quicklisp/ ** Then download the Quicklisp installer with: ** * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) mkdir -p $S/https/beta.quicklisp.org/ cd $S/https/beta.quicklisp.org/ ls -lAF wget -N https://beta.quicklisp.org/quicklisp.lisp # (find-fline "$S/https/beta.quicklisp.org/") # (find-fline "$S/https/beta.quicklisp.org/quicklisp.lisp")5. Install Quicklisp and Slynk
See: https://joaotavora.github.io/sly/ https://joaotavora.github.io/sly/#Connecting-to-a-remote-Lisp (find-slynode "Connecting to a remote Lisp") ** Install Quicklisp * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) cd $S/https/beta.quicklisp.org/ sbcl --load quicklisp.lisp (quicklisp-quickstart:help) (quicklisp-quickstart:install) (exit) ** Install Slynk * (eepitch-sbcl) * (eepitch-kill) * (eepitch-sbcl) (load #P"~/quicklisp/setup.lisp") (ql:quickload :slynk) (exit) ** Make SBCL load Quicklisp by default. ** This is optional! * (eepitch-sbcl) * (eepitch-kill) * (eepitch-sbcl) (load #P"~/quicklisp/setup.lisp") (ql-impl-util::write-init-forms t) ; write the init block to stdout (ql:add-to-init-file) ; write the init block to ~/.sbclrc (exit)6. Sly: basic keys
If you run this, * (eepitch-sly) * (eepitch-kill) * (eepitch-sly) (inspect (make-pathname :name "FOO")) you will get a target buffer with a name like "*sly-mrepl for sbcl*", and the output of the `(inspect ...)' will be something like this: CL-USER> (inspect (make-pathname :name "FOO")) The object is a PATHNAME. 0. NAMESTRING: NIL 1. HOST: #<SB-IMPL::UNIX-HOST {<}100010D353{>}> 2. DEVICE: NIL 3. DIR+HASH: NIL 4. NAME: "FOO" 5. TYPE: NIL 6. VERSION: NIL > We will use that buffer to learn how to use three key sequences: `M-.', `M-,', and `C-c I'. They are explained in these info pages: (find-slynode "Finding definitions" "M-." "Go to") (find-slynode "Finding definitions" "M-," "Go back") (find-emajormode-links 'sly-inspector-mode) The major mode of our target buffer is `sly-mrepl-mode', and if you run `C-h m' on that buffer you will see that the list of active minor modes there has several modes of with names like `sly-*'. This means that `M-.', `M-,', and `C-c I' may be defined in keymaps that are not `sly-mrepl-mode-map'; if you have `helpful' installed, try: (find-emajormode-links 'sly-mrepl-mode) (find-hfunction 'sly-mrepl-mode) (find-hvariable 'sly-mrepl-mode-map) (find-hfunction 'sly-autodoc-mode) (find-hvariable 'sly-autodoc-mode-map) (find-hfunction 'sly-interactive-buttons-mode) (find-hfunction 'sly-mode) (find-hvariable 'sly-mode-map) (find-hfunction 'sly-stickers-shortcut-mode) (find-hvariable 'sly-stickers-shortcut-mode-map) (find-hvariable 'sly-stickers-mode-map) (find-hfunction 'sly-trace-dialog-shortcut-mode) (find-hvariable 'sly-trace-dialog-shortcut-mode-map) They are all in `sly-mode-map'. Anyway, run this again, * (eepitch-sly) * (eepitch-kill) * (eepitch-sly) (inspect (make-pathname :name "FOO")) put the point on the "SB-IMPL::UNIX-HOST" in the target buffer, and type `M-.'; this will take you to the source of SB-IMPL::UNIX-HOST. Then type `M-,'; this will take you back to the previous buffer. Then go to the target buffer again, put the point between the two closing parentheses of the (inspect (...)) sexp , and type `C-c I'. The default for `C-c I' is to inspect the sexp before point, so it will say [sly] Inspect value (evaluated): (make-pathname :name "FOO") in the minibuffer, and ask for a confirmation. Type RET; this will open a buffer with a name like "*sly-inspector for sbcl*", whose major mode is `sly-inspector-mode'. Again, its Sly-related keybings are in several keymaps: (find-emajormode-links 'sly-inspector-mode) (find-hfunction 'sly-inspector-mode) (find-hvariable 'sly-inspector-mode-map) (find-hfunction 'sly-mode) (find-hvariable 'sly-mode-map) (find-hfunction 'sly-stickers-shortcut-mode) (find-hvariable 'sly-stickers-shortcut-mode-map) (find-hvariable 'sly-stickers-mode-map) (find-hfunction 'sly-trace-dialog-shortcut-mode) (find-hvariable 'sly-trace-dialog-shortcut-mode-map)7. Tell Maxima how to load Sly
Use this: ;;-- (ee-copy-rest-3m nil ";;-- end" "~/.maxima/startsly.lisp") ;; From: (find-try-sly-intro "7. Tell Maxima how to load Sly") ;; Based on: (find-angg ".maxima/startsly.lisp") ;; (load #P"~/quicklisp/setup.lisp") (ql:quickload :slynk) (slynk:create-server :port 56789 :dont-close t) ;;-- end8. Inspect Maxima with Sly
Note that here we have two eepitch targets, and we alternate between them... * (eepitch-sly) * (eepitch-kill) * (eepitch-sly) * (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-.'. ** This blocks starts the Sly debugger and shows a backtrace. ** See: (find-slynode "Debugger") ** * (eepitch-maxima) :lisp (defun foo () "Foo") ?foo(); :lisp (defun foo () (breakhere) "Foo") ?foo();