[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/geiser-chez ca9223e0b2 2/2: wee refactorings
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/geiser-chez ca9223e0b2 2/2: wee refactorings |
Date: |
Thu, 13 Oct 2022 23:58:31 -0400 (EDT) |
branch: elpa/geiser-chez
commit ca9223e0b2cac5a2cab6d967b7cd8b94082bba29
Author: jao <jao@gnu.org>
Commit: jao <jao@gnu.org>
wee refactorings
---
src/geiser/geiser-data.ss | 4 +---
src/geiser/geiser.ss | 18 ++++++++----------
2 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/src/geiser/geiser-data.ss b/src/geiser/geiser-data.ss
index 0176e59cb3..e4aeba7765 100644
--- a/src/geiser/geiser-data.ss
+++ b/src/geiser/geiser-data.ss
@@ -26,9 +26,7 @@
(let ((id (car x))
(sgs (let* ((s (format "(~a)" (cadr x)))
(as (with-input-from-string s read)))
- (and (list? as)
- (list? (car as))
- (map cdr (remove '~ as))))))
+ (and (list? (car as)) (map cdr (remove '~
as))))))
(symbol-hashtable-set! h id (cons id (cons sgs (cddr
x))))))
d)
h))
diff --git a/src/geiser/geiser.ss b/src/geiser/geiser.ss
index 9ec73e81d1..62cd6ad39e 100644
--- a/src/geiser/geiser.ss
+++ b/src/geiser/geiser.ss
@@ -187,7 +187,7 @@
(l (string-length s)))
(if (<= l max-len) s (string-append (substring s 0 sub-len) sub-str))))
- (define (operator-arglist operator)
+ (define (id-autodoc id)
(define (procedure-parameter-list id p)
(and (procedure? p)
(or (source->parameter-list p)
@@ -199,21 +199,19 @@
(else `(("required" . ,(reverse req))
("optional" ,args)))))
(define (autodoc-arglist arglist) (autodoc-arglist* arglist '()))
- (let ([binding (try-eval operator)])
+ (define (signature as) `(,id ("args" ,@(map autodoc-arglist as))))
+ (let ([binding (try-eval id)])
(if (not (eq? binding not-found))
- (let ([arglists (procedure-parameter-list operator binding)])
- (cond ((null? arglists) `(,operator ("args" (("required")))))
- (arglists
- `(,operator ("args" ,@(map autodoc-arglist arglists))))
- (else `(,operator ("value" . ,(value->string binding))))))
- (let ((s (symbol-signatures operator)))
- (if s `(,operator ("args" ,@(map autodoc-arglist s))) '())))))
+ (let ([as (procedure-parameter-list id binding)])
+ (if as (signature as) `(,id ("value" . ,(value->string binding)))))
+ (let ((s (symbol-signatures id)))
+ (if s (signature s) '())))))
(define (geiser:autodoc ids)
(cond ((null? ids) '())
((not (list? ids)) (geiser:autodoc (list ids)))
((not (symbol? (car ids))) (geiser:autodoc (cdr ids)))
- (else (map operator-arglist ids))))
+ (else (map id-autodoc ids))))
(define (geiser:symbol-location id . env)
(let* ([b (try-eval id (current-environment))]