summaryrefslogtreecommitdiff
path: root/geiser-chez.el
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2023-02-28 22:53:04 +0000
committerjao <jao@gnu.org>2023-02-28 22:53:04 +0000
commit04ab4387fed68659f21377dbe74513edac2fd134 (patch)
treed52c00aed0527a0512ba980c9f0d69255ff286b1 /geiser-chez.el
parent246ec4c8bc4e7f64414e5cbe0fa66f0e5ef7d527 (diff)
downloadgeiser-chez-04ab4387fed68659f21377dbe74513edac2fd134.tar.gz
geiser-chez-04ab4387fed68659f21377dbe74513edac2fd134.tar.bz2
doc browser: links to TSPL and User Manual in documentation window0.18
Diffstat (limited to 'geiser-chez.el')
-rw-r--r--geiser-chez.el44
1 files changed, 43 insertions, 1 deletions
diff --git a/geiser-chez.el b/geiser-chez.el
index 170570d..a96b357 100644
--- a/geiser-chez.el
+++ b/geiser-chez.el
@@ -65,6 +65,27 @@ host."
(define-obsolete-variable-alias 'geiser-chez-debug-on-exception-p
'geiser-chez-debug-on-exception "0.18")
+(geiser-custom--defcustom geiser-chez-browse-function #'eww
+ "Function used to open HTML pages for the manuals."
+ :type 'function)
+
+(geiser-custom--defcustom geiser-chez-csug-url
+ "https://cisco.github.io/ChezScheme/csug9.5/"
+ "Base URL for the Chez Scheme User's Guide HTML documents.
+
+Set it to a local file URI such as
+'file:///usr/share/doc/chezscheme-doc/html/' for quicker offline
+access."
+ :type 'string)
+
+(geiser-custom--defcustom geiser-chez-tspl-url
+ "https://scheme.com/tspl4/"
+ "Base URL for the The Scheme Programming Languange HTML version.
+
+Set it to a local file URI such as
+'file:///usr/share/doc/tlsp/html/' for quicker offline access."
+ :type 'string)
+
(defconst geiser-chez-minimum-version "9.4")
;;; REPL support
@@ -273,6 +294,27 @@ Return its local name."
(with-output-to-file 1)
(with-output-to-string 0))
+;;; Documentation display
+(defun geiser-chez--insert-button (url label)
+ (insert-text-button label
+ 'button-data url
+ 'action geiser-chez-browse-function))
+
+(defun geiser-chez--display-docstring (res)
+ (when-let ((labels (cdr (assoc "labels" res))))
+ (insert (format "%s\n" (or (cdr (assoc "docstring" res)) "")))
+ (let* ((csug (cdr (assoc 'csug labels)))
+ (csug-url (and (stringp csug) (concat geiser-chez-csug-url csug)))
+ (tspl (cdr (assoc 'tspl labels)))
+ (tspl-url (and (stringp tspl) (concat geiser-chez-tspl-url tspl))))
+ (when csug-url
+ (insert "\n")
+ (geiser-chez--insert-button csug-url "· Chez Manual Entry"))
+ (when tspl-url
+ (insert "\n")
+ (geiser-chez--insert-button tspl-url "· TSLP Entry")))
+ t))
+
;;; Implementation definition:
(define-geiser-implementation chez
@@ -291,8 +333,8 @@ Return its local name."
(import-command geiser-chez--import-command)
(find-symbol-begin geiser-chez--symbol-begin)
(display-error geiser-chez--display-error)
+ (display-docstring geiser-chez--display-docstring)
;; (external-help geiser-chez--manual-look-up)
- ;; (check-buffer geiser-chez--guess)
(keywords geiser-chez--keywords)
(nested-definitions t)
(case-sensitive nil))