[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/geiser-gauche 3fee273 027/119: Get autodoc info from all m
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/geiser-gauche 3fee273 027/119: Get autodoc info from all modules |
Date: |
Sun, 1 Aug 2021 18:27:51 -0400 (EDT) |
branch: elpa/geiser-gauche
commit 3fee273fbaef214651b4ac81dbb3ae8619eda739
Author: András Simonyi <andras.simonyi@gmail.com>
Commit: András Simonyi <andras.simonyi@gmail.com>
Get autodoc info from all modules
---
geiser.scm | 42 ++++++++++++++++++++++++++----------------
1 file changed, 26 insertions(+), 16 deletions(-)
diff --git a/geiser.scm b/geiser.scm
index 7d8e758..4a0fc2e 100644
--- a/geiser.scm
+++ b/geiser.scm
@@ -45,19 +45,25 @@
(if (string-prefix? ":" (symbol->string sym))
sym
(symbol-append ': sym)))
+
+;; Return the id of a module as symbol
+(define (module-id module)
+ (let ((module-repr (write-to-string module)))
+ (string->symbol
+ (substring module-repr 9 (- (string-length module-repr) 1)))))
(define (geiser:macroexpand form . rest)
(with-output-to-string
(cut pprint (macroexpand form))))
-
(define (geiser:eval module-name form . rest)
rest
(let* ((output (open-output-string))
(module (or (and (symbol? module-name )
- (find-module module-name))
- (find-module 'user)))
+ (find-module module-name))
+ ;; TODO or should we eval in the currently selected module?
+ (find-module 'user)))
(result (with-output-to-port output
(lambda ()
(eval form module)))))
@@ -100,27 +106,31 @@
;;; Autodoc
(define (geiser:autodoc ids . rest)
- (map (cut gauche-info <>)
- ids))
+ (concatenate
+ (map (cut gauche-info <>)
+ ids)))
(define (gauche-info id)
- (let ((module (find-module 'user)))
- (if (global-variable-bound? 'user id)
- (let1 obj (global-variable-ref (find-module 'user) id)
- (if (is-a? obj <procedure>)
- (process-info (~ obj 'info))
- `(,id ("args" (("required" "...")))
- ("module" gauche))))
- `(,id))))
-
-(define (process-info info)
+ (filter-map (cut gauche-info-in-module id <>)
+ (all-modules)))
+
+(define (gauche-info-in-module id module)
+ (if (hash-table-get (module-table module) id #f)
+ (let1 obj (global-variable-ref module id)
+ (if (is-a? obj <procedure>)
+ (process-info (~ obj 'info) module)
+ `(,id ("args" (("required" "...")))
+ ("module" ,(module-id module)))))
+ #f))
+
+(define (process-info info module)
`(,(car info)
("args"
,((if (list? info)
process-normal-arg-info
process-dotted-arg-info)
(cdr info)))
- ("module" user)))
+ ("module" ,(module-id module))))
(define (process-normal-arg-info arg-info)
(let ((required '("required"))
- [nongnu] elpa/geiser-gauche 6da3f02 011/119: Fix geiser:eval, (continued)
- [nongnu] elpa/geiser-gauche 6da3f02 011/119: Fix geiser:eval, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche b474b09 014/119: Don't filter completions based on context (for now), Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche 9dafd9f 079/119: License-related updates, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche 04208f5 075/119: Cleanup Cask file, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche 687713c 085/119: Update README.md, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche f1ccc62 086/119: Update README.md, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche f9064d8 003/119: Implement get-module and other Emacs functions, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche ca7629e 012/119: geieser-gauche fixes, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche 4cb8586 007/119: Fix gauche prompt regexp, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche 5876bc2 018/119: Deal with dotted signatures in autodoc, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche 3fee273 027/119: Get autodoc info from all modules,
Philip Kaludercic <=
- [nongnu] elpa/geiser-gauche 98c52e6 023/119: Deal with complex key arguments, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche c9d367e 024/119: Fix complex key argument autodocs, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche 5c18e45 030/119: Finish autodoc and symbol signature lookup, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche 752a496 031/119: Add code source reference, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche 2ef21b4 044/119: Remove a TODO comment, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche 762cd22 035/119: Add guessing functions, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche fbcd9a4 050/119: Minor fix, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche 2002cc0 056/119: Cleanup, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche e406a0e 051/119: Minor fixes, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche 8a7dc24 064/119: Semicolon aesthetic changes, Philip Kaludercic, 2021/08/01