branch: externals/eev commit 1813b372192556cf218c8bd6e07d1d5916f34d63 Author: Eduardo Ochs <eduardoo...@gmail.com> Commit: Eduardo Ochs <eduardoo...@gmail.com>
Rewrote the DSL that `find-here-links' uses. --- ChangeLog | 27 +++++++ VERSION | 4 +- eev-blinks.el | 1 + eev-elinks.el | 4 +- eev-helpful.el | 8 +- eev-hlinks.el | 240 ++++++++++++++++++++++++++++++++------------------------- eev-rstdoc.el | 52 ++++++++++++- eev-tlinks.el | 146 ++++++++++++++++++++++++++++++++--- 8 files changed, 352 insertions(+), 130 deletions(-) diff --git a/ChangeLog b/ChangeLog index a57451050f..f13d3aa50e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,30 @@ +2023-01-16 Eduardo Ochs <eduardoo...@gmail.com> + + * eev-hlinks.el (ee-efunctiondescr-re): recognize built-in + functions. + (ee-hprog-find-here-links, ee-hlang-sexp1-result) + (ee-hlang-sexp1, ee-hlang-sexp2): new variables. + (ee-hlang-eval, ee-hlang-:lisp, ee-hlang-:or, ee-hlang-:if) + (ee-hlang-run): new functions. + (ee-detect-here): rewritten to use `ee-hlang-run' and + `ee-hprog-find-here-links'. + (ee-find-here-links): same. + (ee-find-here-debug-links): same. + (ee-fhl-main-program, ee-fhl-sexp1, ee-fhl-sexp2, ee-fhl-run) + (ee-fhl-eval, ee-fhl-:eval, ee-fhl-:if, ee-fhl-:or): all these + variables and functions were deleted and replaced by the ones that + have "hprog" and "hlang" in their names, that have better names, + docstrings, and tests. + +2023-01-14 Eduardo Ochs <eduardoo...@gmail.com> + + * eev-rstdoc.el (ee-rstdoc-:clhs): new variable. + +2023-01-11 Eduardo Ochs <eduardoo...@gmail.com> + + * eev-rstdoc.el (ee-rstdoc-htm): new function. + (ee-rstdoc-html, ee-rstdoc-web): use `ee-rstdoc-htm'. + 2023-01-10 Eduardo Ochs <eduardoo...@gmail.com> * eev-tlinks.el (find-try-sly-links): new function. diff --git a/VERSION b/VERSION index 85b83667dd..75e23ebc6c 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -Tue Jan 10 04:39:51 GMT 2023 -Tue Jan 10 01:39:51 -03 2023 +Mon Jan 16 21:12:35 GMT 2023 +Mon Jan 16 18:12:35 -03 2023 diff --git a/eev-blinks.el b/eev-blinks.el index d03c0d8c08..9ab9eb4f86 100644 --- a/eev-blinks.el +++ b/eev-blinks.el @@ -930,6 +930,7 @@ newlines, as \"big strings\". This is a bit childish, I know..." ;; Test: ;; ;; (find-epp (macroexpand ' (cl-defstruct mypoint x y) )) +;; (find-eppm ' (cl-defstruct mypoint x y) ) ;; ;; (cl-defstruct mypoint x y) ;; (cl-defstruct (mypoint-colored (:include point)) color) diff --git a/eev-elinks.el b/eev-elinks.el index ada72eedb3..babc56db51 100644 --- a/eev-elinks.el +++ b/eev-elinks.el @@ -524,8 +524,8 @@ This is an internal function used by `find-ekey-links' and ;; (find-eev "eev-mode.el" "eev-mode-map-set" "\\M-h\\M-i") ;; ;; See: -;; (find-eev "eev-hlinks.el" "ee-fhl-main-program") -;; (find-eev "eev-hlinks.el" "ee-fhl-main-program" "(ee-find-info-links)") +;; (find-eev "eev-hlinks.el" "hprog") +;; (find-eev "eev-hlinks.el" "hprog" "(ee-find-info-links)") ;; (find-eev-quick-intro "10.2. Generating short hyperlinks to info nodes") (defvar ee-info-file "") diff --git a/eev-helpful.el b/eev-helpful.el index 16ce74e4db..9e4d0794ec 100644 --- a/eev-helpful.el +++ b/eev-helpful.el @@ -1,6 +1,6 @@ ;;; eev-helpful.el -- eev support for helpful. -*- lexical-binding: nil; -*- -;; Copyright (C) 2022 Free Software Foundation, Inc. +;; Copyright (C) 2023 Free Software Foundation, Inc. ;; ;; This file is part of GNU eev. ;; @@ -19,7 +19,7 @@ ;; ;; Author: Eduardo Ochs <eduardoo...@gmail.com> ;; Maintainer: Eduardo Ochs <eduardoo...@gmail.com> -;; Version: 20220318 +;; Version: 20230116 ;; Keywords: e-scripts ;; ;; Latest version: <http://angg.twu.net/eev-current/eev-helpful.el> @@ -47,8 +47,8 @@ ;; Note that `find-here-links' calls functions from this file ;; when the major mode is `helpful-mode' - see: ;; -;; (find-eev "eev-hlinks.el" "ee-fhl-main-program") -;; (find-eev "eev-hlinks.el" "ee-fhl-main-program" "helpful") +;; (find-eev "eev-hlinks.el" "hprog") +;; (find-eev "eev-hlinks.el" "hprog" "helpful") ;; ;; Also, `find-efunction-links' and `find-evariable-links' now include ;; links with `find-hfunction' and `find-hvariable' in the temporary diff --git a/eev-hlinks.el b/eev-hlinks.el index 78cfcb638a..9725b677c7 100644 --- a/eev-hlinks.el +++ b/eev-hlinks.el @@ -1,6 +1,6 @@ ;;; eev-hlinks.el --- `find-here-links' and variants. -*- lexical-binding: nil; -*- -;; Copyright (C) 2020-2022 Free Software Foundation, Inc. +;; Copyright (C) 2020-2023 Free Software Foundation, Inc. ;; ;; This file is part of GNU eev. ;; @@ -19,7 +19,7 @@ ;; ;; Author: Eduardo Ochs <eduardoo...@gmail.com> ;; Maintainer: Eduardo Ochs <eduardoo...@gmail.com> -;; Version: 20221218 +;; Version: 20230116 ;; Keywords: e-scripts ;; ;; Latest version: <http://angg.twu.net/eev-current/eev-hlinks.el> @@ -111,9 +111,10 @@ ;; «.find-here-links» (to "find-here-links") ;; «.ee-find-here-links» (to "ee-find-here-links") ;; «.ee-find-here-debug-links» (to "ee-find-here-debug-links") -;; «.ee-find-here-links-tests» (to "ee-find-here-links-tests") -;; «.ee-fhl-main-program» (to "ee-fhl-main-program") -;; «.ee-fhl-run» (to "ee-fhl-run") +;; «.hprog» (to "hprog") +;; «.ee-hprog-find-here-links» (to "ee-hprog-find-here-links") +;; «.hlang» (to "hlang") +;; «.ee-hlang-run» (to "ee-hlang-run") ;; ;; «.ee-find-here-links-old» (to "ee-find-here-links-old") ;; @@ -176,15 +177,15 @@ See: (find-here-links-intro)" (defun ee-find-here-links (&optional arg) "Generate the non-header part of the \"*(find-here-links)*\" buffer. This function runs `(ee-fhl-run ee-fhl-main-program)', that runs -the program in `ee-fhl-main-program' with `ee-fhl-run' until an -expression like this in it +the program in `ee-hprog-find-here-links' with `ee-hlang-run' +until an expression like this in it (:if SEXP1 SEXP2) succeeds. When the successful `(:if ___ ___)' is found its SEXP1 -is stored in the global variable `ee-fhl-sexp1' and its SEXP2 is -stored in the global variable `ee-fhl-sexp2'. Their values will -be things like: +is stored in the global variable `ee-hlang-sexp1' and its SEXP2 +is stored in the global variable `ee-hlang-sexp2'. Their values +will be things like: SEXP1 => (ee-<kind>-bufferp) SEXP2 => (ee-find-<kind>-links) @@ -203,7 +204,7 @@ which kind \"here\" the current buffer is." (ee-detect-here) (if arg (cons "" (ee-find-here-debug-links)) - (cons "" (eval ee-fhl-sexp2)))) + (cons "" (eval ee-hlang-sexp2)))) ;; «ee-find-here-debug-links» (to ".ee-find-here-debug-links") ;; See: (find-eevfile "eev-hlinks.el" "Debug mode") @@ -213,62 +214,56 @@ which kind \"here\" the current buffer is." `("# The last call to" "# '(find-here-links ARG)" "# -> '(ee-detect-here)" - "# -> '(ee-fhl-run ee-fhl-main-program)" + "# -> '(ee-hlang-run ee-hprog-find-here-links)" "# produced this:" - ,(format "# ee-fhl-sexp1 => %s" (ee-S ee-fhl-sexp1)) - ,(format "# ee-fhl-sexp2 => %s" (ee-S ee-fhl-sexp2)) + ,(format "# ee-hlang-sexp1 => %s" (ee-S ee-hlang-sexp1)) + ,(format "# ee-hlang-sexp2 => %s" (ee-S ee-hlang-sexp2)) "# See:" - "# ee-fhl-sexp1" - "# ee-fhl-sexp2" - ,(format "# (find-efunction '%s)" (car ee-fhl-sexp1)) - ,(format "# (find-efunction '%s)" (car ee-fhl-sexp2)) + "# ee-hlang-sexp1" + "# ee-hlang-sexp2" + ,(format "# (find-efunction '%s)" (car ee-hlang-sexp1)) + ,(format "# (find-efunction '%s)" (car ee-hlang-sexp2)) "# (find-eev \"eev-hlinks.el\" \"find-here-links\")" "# (find-eev \"eev-hlinks.el\" \"find-here-links\" \"If ARG\")" "# (find-eev \"eev-hlinks.el\" \"ee-find-here-links\")" "# (find-eev \"eev-hlinks.el\" \"ee-find-here-debug-links\")" - "# (find-eev \"eev-hlinks.el\" \"ee-fhl-run\")" - "# (find-eev \"eev-hlinks.el\" \"ee-fhl-run\" \"ee-detect-here\")" - "# (find-eev \"eev-hlinks.el\" \"ee-fhl-main-program\")" + "# (find-eev \"eev-hlinks.el\" \"ee-hlang-run\")" + "# (find-eev \"eev-hlinks.el\" \"ee-hlang-run\" \"ee-detect-here\")" + "# (find-eev \"eev-hlinks.el\" \"ee-hprog-find-here-links\")" )) - -;; «ee-find-here-links-tests» (to ".ee-find-here-links-tests") -;; Low-level tests (old, written before `ee-find-here-debug-links'): -;; -;; (find-2a nil '(find-here-links)) -;; (find-2a nil '(find-elinks (ee-find-here-links))) -;; (ee-fhl-run ee-fhl-main-program) -;; (list ee-fhl-sexp1 ee-fhl-sexp2) -;; ee-fhl-sexp2 -;; (find-2a nil '(find-elinks (eval ee-fhl-sexp2))) - +;; 2023jan16: removed all the functions and variables with "fhl" in +;; their names, and replaced them with "hprog"s and "hlang"s. +;; An old comment: +;; +;; ;; Note the _AT THIS MOMENT_ the easiest way to add support for a new +;; ;; kind of "here" in `ee-fhl-main-program' is to override this +;; ;; variable by setq-ing it in your init file... this is just because +;; ;; I've been lazy and I haven't implemented YET a way to make +;; ;; `ee-fhl-main-program' call "subprograms". If you need to extend +;; ;; this please get in touch with me and I'll implement the missing +;; ;; parts!!! -;;; _ -;;; _ __ ___ __ _(_)_ __ _ __ _ __ ___ __ _ _ __ __ _ _ __ ___ -;;; | '_ ` _ \ / _` | | '_ \ | '_ \| '__/ _ \ / _` | '__/ _` | '_ ` _ \ -;;; | | | | | | (_| | | | | | | |_) | | | (_) | (_| | | | (_| | | | | | | -;;; |_| |_| |_|\__,_|_|_| |_| | .__/|_| \___/ \__, |_| \__,_|_| |_| |_| -;;; |_| |___/ -;; -;; «ee-fhl-main-program» (to ".ee-fhl-main-program") -;; `ee-find-here-links' runs this "program" with `ee-fhl-run'. -;; -;; Try: (find-eppp ee-fhl-main-program) -;; (ee-fhl-run ee-fhl-main-program) +;;; _ +;;; | |__ _ __ _ __ ___ __ _ +;;; | '_ \| '_ \| '__/ _ \ / _` | +;;; | | | | |_) | | | (_) | (_| | +;;; |_| |_| .__/|_| \___/ \__, | +;;; |_| |___/ ;; -;; Note the _AT THIS MOMENT_ the easiest way to add support for a new -;; kind of "here" in `ee-fhl-main-program' is to override this -;; variable by setq-ing it in your init file... this is just because -;; I've been lazy and I haven't implemented YET a way to make -;; `ee-fhl-main-program' call "subprograms". If you need to extend -;; this please get in touch with me and I'll implement the missing -;; parts!!! +;; «hprog» (to ".hprog") +;; An "hprogram" is a program that identifies what we have "here" and +;; decides how to handle that. My main example of an "hprogram" is the +;; one that is used by `find-here-links' to produce a temporary buffer +;; with hyperlinks to "here". It is here, and my _current_ interpreter +;; for the "hlanguage" in which "hprograms" are written is below. -(defvar ee-fhl-main-program +;; «ee-hprog-find-here-links» (to ".ee-hprog-find-here-links") +(defvar ee-hprog-find-here-links '(:or ;; By major mode: (:if (ee-info-bufferp) (ee-find-info-links)) @@ -309,71 +304,104 @@ which kind \"here\" the current buffer is." ) "See `ee-find-here-links'.") +;; Two e-mails about using an hprogram to detect the thing at point: +;; https://lists.gnu.org/archive/html/help-gnu-emacs/2023-01/msg00027.html +;; https://lists.gnu.org/archive/html/help-gnu-emacs/2023-01/msg00047.html -;;; ____ ____ _ -;;; | _ \/ ___|| | -;;; | | | \___ \| | -;;; | |_| |___) | |___ -;;; |____/|____/|_____| -;;; -;; «ee-fhl-run» (to ".ee-fhl-run") -;; Here we define the interpreter for the DSL that is used in -;; `ee-fhl-main-program'. -;; TODO: implement (:subprogram-in VARNAME). - -(defvar ee-fhl-sexp1 nil - "When `ee-fhl-run' finds an (ee-fhl-:if SEXP1 SEXP2) - that succeeds it stores the SEXP1 in this variable.") - -(defvar ee-fhl-sexp2 nil - "When `ee-fhl-run' finds an (ee-fhl-:if SEXP1 SEXP2) - that succeeds it stores the SEXP2 in this variable.") - -(defun ee-fhl-run (fhl-program) - "See `ee-fhl-main-program'." - (setq ee-fhl-sexp1 nil) - (setq ee-fhl-sexp2 nil) - (ee-fhl-eval fhl-program) - (list ee-fhl-sexp1 ee-fhl-sexp2)) + + +;;; _ _ +;;; | |__ | | __ _ _ __ __ _ +;;; | '_ \| |/ _` | '_ \ / _` | +;;; | | | | | (_| | | | | (_| | +;;; |_| |_|_|\__,_|_| |_|\__, | +;;; |___/ +;; +;; «hlang» (to ".hlang") +;; An interpreter for the "hlanguage" in which "hprograms" are +;; written. This interpreter treats "hsexps" of the form (:if ...) in +;; a very atypical way to make everything easy to debug - see the +;; docstrings of the functions `ee-hlang-:if' and `ee-hlang-run'. +;; ;; Tests: -;; (ee-fhl-eval '(:eval (+ 20 3))) -;; (ee-fhl-eval '(:if (< 1 2) (list 3 4))) -;; (ee-fhl-:eval '(+ 1 2) '(+ 3 4)) -;; (ee-fhl-:if '(< 1 2) '(list 3 4)) -;; (ee-fhl-:if '(> 1 2) '(list 3 4)) -;; (ee-fhl-:or '(:eval nil) '(:eval nil) '(:eval 42) '(:eval 99)) -;; -(defun ee-fhl-eval (fhl-sexp) - (let* ((f (ee-intern "ee-fhl-%s" (car fhl-sexp))) - (rest (cdr fhl-sexp))) - (apply f rest))) - -(defun ee-fhl-:eval (&rest sexps) +;; (ee-hlang-:lisp '(+ 20 3) '(+ 40 5)) +;; (ee-hlang-:or '(:lisp nil) '(:lisp nil) '(:lisp 42) '(:lisp 99)) +;; (ee-hlang-:if '(< 1 2) '(list 'lt)) +;; (ee-hlang-:if '(> 1 2) '(list 'gt)) +;; +;; (ee-hlang-eval '(:lisp (+ 20 3) (+ 40 5))) +;; (ee-hlang-eval '(:or (:lisp nil) (:lisp nil) (:lisp 42) (:lisp 99))) +;; (ee-hlang-eval '(:if (< 1 2) (list 'lt))) +;; (ee-hlang-eval '(:if (> 1 2) (list 'gt))) +;; (ee-hlang-eval '(:or (:if (< 1 2) (list 'lt)) (:if (> 1 2) (list 'gt)))) +;; (ee-hlang-eval '(:or (:if (> 1 2) (list 'gt)) (:if (< 1 2) (list 'lt)))) + +;; The Three Variables. +(defvar ee-hlang-sexp1-result nil "See `ee-hlang-:if'.") +(defvar ee-hlang-sexp1 nil "See `ee-hlang-:if'.") +(defvar ee-hlang-sexp2 nil "See `ee-hlang-:if'.") + +(defun ee-hlang-eval (hsexp) + "If HSEXP is (:foo bar plic ploc), run (ee-hlang-:foo bar plic ploc)." + (let* ((kw (car hsexp)) + (args (cdr hsexp)) + (f (ee-intern "ee-hlang-%s" kw))) + (apply f args))) + +(defun ee-hlang-:lisp (&rest sexps) + "Eval (progn . SEXPS) and return the result. This is mainly for tests." (eval (cons 'progn sexps))) -(defun ee-fhl-:if (sexp1 sexp2) - (when (eval sexp1) - (setq ee-fhl-sexp1 sexp1) - (setq ee-fhl-sexp2 sexp2) - sexp2)) - -(defun ee-fhl-:or (&rest fhl-sexps) - (cl-loop for fhl-sexp in fhl-sexps - for fhl-result = (ee-fhl-eval fhl-sexp) - until fhl-result - finally return fhl-result)) +(defun ee-hlang-:or (&rest hsexps) + "Run `ee-hlang-eval' on each hsexp in HSEXPS until on succeeds. +On success return the result of that hsexp. On failure return nil." + (cl-loop for hsexp in hsexps + for hresult = (ee-hlang-eval hsexp) + until hresult + finally return hresult)) + +(defun ee-hlang-:if (sexp1 sexp2) + "If (eval SEXP1) is true, return (list SEXP1 SEXP2). +Note that on success: + a) we save the result of SEXP1 into `ee-hlang-sexp1-result', + b) we save SEXP1 into `ee-hlang-sexp1', + c) we save SEXP2 into `ee-hlang-sexp2', + d) we DO NOT evaluate SEXP2, + e) we return (list SEXP1 SEXP2) instead of (eval SEXP2). +This semantics is weird but it makes debugging of hprograms very easy." + (let ((result (eval sexp1))) + (when result + (setq ee-hlang-sexp1-result result) + (setq ee-hlang-sexp1 sexp1) + (setq ee-hlang-sexp2 sexp2) + (list sexp1 sexp2)))) + +;; «ee-hlang-run» (to ".ee-hlang-run") +(defun ee-hlang-run (hprogram) + "Clear the Three Variables and run (ee-hlang-eval HPROGRAM). +HPROGRAM is usually an hsexp of the form (:or hsexp1 ... hsexpn). +This is my preferred way of running an hprogram: the first (:if +sexp1 sexp2) in the hprogram that succeeds will have its sexp1, +sexp2 and the result of sexp1 stored in the Three Variables, and +it will make the hprogram abort. If no (:if)s in the hprogram +succeed then the Three Variables will be nil, and this returns +nil." + (setq ee-hlang-sexp1-result nil) + (setq ee-hlang-sexp1 nil) + (setq ee-hlang-sexp2 nil) + (ee-hlang-eval hprogram)) (defun ee-detect-here () "To understand this, run `find-here-links' with a prefix argument. -This is the standard high-level way to call `ee-fhl-run'." - (ee-fhl-run ee-fhl-main-program)) +This is the standard high-level way to call `ee-hlang-run'." + (ee-hlang-run ee-hprog-find-here-links)) ;; «ee-find-here-links-old» (to ".ee-find-here-links-old") -;; Old version: +;; Old version - hard to debug: ;; (defun ee-find-here-links () ;; (cond ;; by major mode ;; ((ee-info-bufferp) (cons "" (ee-find-info-links))) ; M-h M-i @@ -493,8 +521,8 @@ a single whitespace character, and the results are `concat'-ed." (defvar ee-efunctiondescr-re (ee-underlinewsp-re "^\\([^ \t\n]+\\)_is_an?" - "\\(_autoloaded\\|_interactive\\|_compiled\\|_byte-compiled\\)*" - "\\(_Lisp_function\\|_macro\\|_special_form\\)")) + "\\(_autoloaded\\|_interactive\\|_compiled\\|_byte-compiled\\|_built-in\\)*" + "\\(_Lisp_function\\|_function\\|_macro\\|_special_form\\)")) (defun ee-efunctiondescr-bufferp () (ee-buffer-help ee-efunctiondescr-re 1)) (defun ee-find-efunctiondescr-links () (let ((f (ee-efunctiondescr-bufferp))) diff --git a/eev-rstdoc.el b/eev-rstdoc.el index c76cc7e602..d68e59dbe1 100644 --- a/eev-rstdoc.el +++ b/eev-rstdoc.el @@ -1,6 +1,6 @@ ;;; eev-rstdoc.el -- links to documentation generated from RST files. -*- lexical-binding: nil; -*- -;; Copyright (C) 2022 Free Software Foundation, Inc. +;; Copyright (C) 2022-2023 Free Software Foundation, Inc. ;; ;; This file is part of GNU eev. ;; @@ -19,7 +19,7 @@ ;; ;; Author: Eduardo Ochs <eduardoo...@gmail.com> ;; Maintainer: Eduardo Ochs <eduardoo...@gmail.com> -;; Version: 20221204 +;; Version: 20230111 ;; Keywords: e-scripts ;; ;; Latest version: <http://angg.twu.net/eev-current/eev-rstdoc.el> @@ -33,6 +33,8 @@ ;; «.ee-rstdoc-:py» (to "ee-rstdoc-:py") ;; «.ee-rstdoc-:sympy» (to "ee-rstdoc-:sympy") ;; «.ee-rstdoc-:mpl» (to "ee-rstdoc-:mpl") +;; «.other-defvars» (to "other-defvars") +;; «.ee-rstdoc-:clhs» (to "ee-rstdoc-:clhs") ;; «.basic-ops» (to "basic-ops") ;; «.around-point» (to "around-point") ;; «.code-rstdoc» (to "code-rstdoc") @@ -316,6 +318,43 @@ "See: (find-code-rstdoc :mpl)") +;;; ___ _ _ _ __ +;;; / _ \| |_| |__ ___ _ __ __| | ___ / _|_ ____ _ _ __ ___ +;;; | | | | __| '_ \ / _ \ '__| / _` |/ _ \ |_\ \ / / _` | '__/ __| +;;; | |_| | |_| | | | __/ | | (_| | __/ _|\ V / (_| | | \__ \ +;;; \___/ \__|_| |_|\___|_| \__,_|\___|_| \_/ \__,_|_| |___/ +;;; +;; «other-defvars» (to ".other-defvars") + +;; «ee-rstdoc-:clhs» (to ".ee-rstdoc-:clhs") +;; The Common Lisp Hyperspec. +;; The Debian package "hyperspec" installs a local copy +;; of the CLHS in /usr/share/doc/hyperspec/. To use this, +;; put these two lines in your ~/.emacs: +;; +;; ;; (find-code-rstdoc :clhs) +;; (code-rstdoc :clhs) +;; +(defvar ee-rstdoc-:clhs + '(:base "Front/Contents" + :base-web "http://clhs.lisp.se/" + ;; "http://www.lispworks.com/documentation/HyperSpec/" + :base-html "file:///usr/share/doc/hyperspec/" + :base-rst "/BASE-RST/" + :rst ".rst" + :htm ".htm" + :res ("#.*$" "\\?.*$" ".html?$" ".txt$" ".rst$" "^file://" + "http://clhs.lisp.se/" + "http://www.lispworks.com/documentation/HyperSpec/" + "http://www.cs.cmu.edu/afs/cs/project/ai-repository/ai/html/hyperspec/HyperSpec/" + "http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/" + "/usr/share/doc/hyperspec/") + :kill clk + ) + "See: (find-code-rstdoc :clhs)") + + + ;;; ____ _ ;;; | __ ) __ _ ___(_) ___ ___ _ __ ___ ;;; | _ \ / _` / __| |/ __| / _ \| '_ \/ __| @@ -384,20 +423,25 @@ (ee-rstdoc-stem kw str) (ee-rstdoc-hashanchor str))) +(defun ee-rstdoc-htm (kw) + (or (ee-rstdoc-getfield0 kw :htm) ".html")) + (defun ee-rstdoc-html (kw &optional str) (if (not str) (setq str (ee-rstdoc-getfield kw :base))) - (format "%s%s.html%s" + (format "%s%s%s%s" (ee-rstdoc-getfield kw :base-html) (ee-rstdoc-stem kw str) + (ee-rstdoc-htm kw) (ee-rstdoc-hashanchor str))) (defun ee-rstdoc-web (kw &optional str) (if (not str) (setq str (ee-rstdoc-getfield kw :base))) - (format "%s%s.html%s" + (format "%s%s%s%s" (ee-rstdoc-getfield kw :base-web) (ee-rstdoc-stem kw str) + (ee-rstdoc-htm kw) (ee-rstdoc-hashanchor str))) (defun ee-rstdoc-rst (kw &optional str) diff --git a/eev-tlinks.el b/eev-tlinks.el index 7f19a6540a..96b31b2dba 100644 --- a/eev-tlinks.el +++ b/eev-tlinks.el @@ -3925,23 +3925,32 @@ N should be either a number or a symbol; SEXP should be a sexp." ,(ee-template0 (ee-adjust-red-stars "\ This script is incomplete!!! - Make sure that sbcl is installed. - Note: this block only works on Debian. + 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 +sudo apt-get install sbcl hyperspec maxima - Install sly. Use low-level sexps instead of `M-x list-packages'. + + 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) + - Download quicklisp.lisp. + 3. Download quicklisp.lisp + ========================== (eepitch-shell) (eepitch-kill) @@ -3950,13 +3959,13 @@ mkdir -p $S/https/beta.quicklisp.org/ cd $S/https/beta.quicklisp.org/ ls -lAF rm -fv quicklisp.lisp -rm -fv quicklisp.lisp.asc -wget -nc 'https://beta.quicklisp.org/quicklisp.lisp' -wget -nc 'https://beta.quicklisp.org/quicklisp.lisp.asc' +wget -nc https://beta.quicklisp.org/quicklisp.lisp # (find-fline \"$S/https/beta.quicklisp.org/\") # (find-fline \"$S/https/beta.quicklisp.org/quicklisp.lisp\") - Run quicklisp.lisp. + + 4. Run quicklisp.lisp + ===================== Ask it to install slynk and to change ~/.sbclrc. (eepitch-shell) @@ -3970,16 +3979,129 @@ sbcl --load quicklisp.lisp (ql:add-to-init-file) ;; Inspect the changes in ~/.sbclrc: - ;; (find-fline \"~/.sbclrc\") - ;; (find-fline \"~/.sbclrc\" \"added by ql:add-to-init-file:\") + ;; (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) +;; Skel: (find-rstdoc-links :clhs) +(setq ee-rstdoc-:clhs + '(:base \"Front/Contents\" + :base-web \"http://clhs.lisp.se/\" + ;; \"http://www.lispworks.com/documentation/HyperSpec/\" + :base-html \"file:///usr/share/doc/hyperspec/\" + :base-rst \"/BASE-RST/\" + :rst \".rst\" + :htm \".htm\" + :res (\"#.*$\" \"\\\\?.*$\" \".html?$\" \".txt$\" \".rst$\" \"^file://\" + \"http://clhs.lisp.se/\" + \"http://www.lispworks.com/documentation/HyperSpec/\" + \"http://www.cs.cmu.edu/afs/cs/project/ai-repository/ai/html/hyperspec/HyperSpec/\" + \"http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/\" + \"/usr/share/doc/hyperspec/\") + :kill clk + )) - Start Sly. +;; (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))) + (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\") + Note that it contains a \"test block\". See: + http://angg.twu.net/eepitch.html#test-blocks + +;; 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) + +#| + (eepitch-sbcl) + (eepitch-kill) + (eepitch-sbcl) +(load #P\"~/quicklisp/setup.lisp\") +(ql:quickload :slynk) + + (eepitch-maxima) + (eepitch-kill) + (eepitch-maxima) +load(\"startsly\"); + (sly-connect \"localhost\" 56789) + (eepitch-sly) + +|# + + + See: + https://gigamonkeys.com/book/lather-rinse-repeat-a-tour-of-the-repl.html + + + + ")) )