[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/geiser-guile f1ac35f 140/284: Guile: filtering gensym name
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/geiser-guile f1ac35f 140/284: Guile: filtering gensym names in autodoc display. |
Date: |
Sun, 1 Aug 2021 18:29:32 -0400 (EDT) |
branch: elpa/geiser-guile
commit f1ac35fa6563827c16f175f3aedc285c58616bec
Author: Jose Antonio Ortega Ruiz <jao@gnu.org>
Commit: Jose Antonio Ortega Ruiz <jao@gnu.org>
Guile: filtering gensym names in autodoc display.
---
geiser/doc.scm | 24 +++++++++++-------------
geiser/modules.scm | 14 +++++++-------
geiser/utils.scm | 12 ++++++++++--
3 files changed, 28 insertions(+), 22 deletions(-)
diff --git a/geiser/doc.scm b/geiser/doc.scm
index 982af95..85bf4d4 100644
--- a/geiser/doc.scm
+++ b/geiser/doc.scm
@@ -38,11 +38,14 @@
(and args (signature name args))))
(define (signature id args-list)
+ (define (rem-gensyms args)
+ (map (lambda (s) (if (gensym? s) '_
+ (if (list? s) (rem-gensyms s) s))) args))
(define (arglst args kind)
(let ((args (assq-ref args kind)))
- (cond ((or (not args) (null? args)) '())
- ((list? args) args)
- (else (list args)))))
+ (rem-gensyms (cond ((or (not args) (null? args)) '())
+ ((list? args) args)
+ (else (list args))))))
(define (mkargs as)
`((required ,@(arglst as 'required))
(optional ,@(arglst as 'optional)
@@ -80,24 +83,19 @@
(else #f))))
(define (arity->args art)
+ (define (gen-arg-names count)
+ (map (lambda (x) '_) (iota (max count 0))))
(let ((req (car art))
(opt (cadr art))
(rest (caddr art)))
`(,@(if (> req 0)
- (list (cons 'required (gen-arg-names 1 req)))
+ (list (cons 'required (gen-arg-names req)))
'())
,@(if (> opt 0)
- (list (cons 'optional (gen-arg-names (+ 1 req) opt)))
+ (list (cons 'optional (gen-arg-names opt)))
'())
,@(if rest (list (cons 'rest 'rest)) '()))))
-(define (gen-arg-names fst count)
- (let* ((letts (list->vector '(#\x #\y #\z #\u #\v #\w #\t)))
- (len (vector-length letts))
- (lett (lambda (n) (vector-ref letts (modulo n len)))))
- (map (lambda (n) (string->symbol (format "~A" (lett (- n 1)))))
- (iota (max count 1) fst))))
-
(define (arglist->args arglist)
`((required . ,(car arglist))
(optional . ,(cadr arglist))
@@ -173,7 +171,7 @@
(with-output-to-string
(lambda ()
(let* ((type (cond ((macro? obj) "A macro")
- ((procedure? obj) "A procedure")
+ ((procedure? obj) "A procedure")
((program? obj) "A compiled program")
(else "An object")))
(modname (symbol-module sym))
diff --git a/geiser/modules.scm b/geiser/modules.scm
index 6f499dd..7ca18c9 100644
--- a/geiser/modules.scm
+++ b/geiser/modules.scm
@@ -25,7 +25,7 @@
(define (module-name? module-name)
(and (list? module-name)
- (> (length module-name) 0)
+ (not (null? module-name))
(every symbol? module-name)))
(define (symbol-module sym . all)
@@ -67,13 +67,13 @@
(define (all-modules)
(define (maybe-name m)
- (let ((name (format "~A" (module-name m))))
- (and (not (string-match "^[(]#[{]" name)) name)))
+ (let ((name (module-name m)))
+ (and (not (gensym? (car name)))
+ (format "~A" name))))
(let* ((guile (resolve-module '(guile)))
- (roots (remove (lambda (m) (eq? m guile)) (root-modules))))
- (cons "(guile)"
- (filter-map maybe-name
- (apply append (map all-child-modules roots))))))
+ (roots (remove (lambda (m) (eq? m guile)) (root-modules)))
+ (children (append-map all-child-modules roots)))
+ (cons "(guile)" (filter-map maybe-name children))))
(define* (all-child-modules mod #:optional (seen '()))
(let ((cs (filter (lambda (m) (not (member m seen))) (submodules mod))))
diff --git a/geiser/utils.scm b/geiser/utils.scm
index b047e6c..01dfaa0 100644
--- a/geiser/utils.scm
+++ b/geiser/utils.scm
@@ -1,6 +1,6 @@
;;; utils.scm -- utility functions
-;; Copyright (C) 2009 Jose Antonio Ortega Ruiz
+;; Copyright (C) 2009, 2010 Jose Antonio Ortega Ruiz
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the Modified BSD License. You should
@@ -13,7 +13,9 @@
#:export (make-location
symbol->object
pair->list
- sort-symbols!))
+ sort-symbols!
+ gensym?)
+ #:use-module (ice-9 regex))
(define (symbol->object sym)
(and (symbol? sym)
@@ -35,4 +37,10 @@
(string<? (symbol->string l) (symbol->string r)))))
(sort! syms cmp)))
+(define (gensym? sym)
+ (and (symbol? sym) (gensym-name? (format "~A" sym))))
+
+(define (gensym-name? name)
+ (and (string-match "^#[{]" name) #t))
+
;;; utils.scm ends here
- [nongnu] elpa/geiser-guile 0e5a52b 090/284: Leftover removed., (continued)
- [nongnu] elpa/geiser-guile 0e5a52b 090/284: Leftover removed., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 58ae3a1 100/284: Cosmetics., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 5807a76 105/284: Guile: adjustment to stack size display., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile a405f22 104/284: Guile: fix for file loading (we always compile them now)., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 134606d 102/284: Guile: Support for multiple arities in autodoc., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile c34995d 110/284: Guile: support for the REPL debugger, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 55c37c7 109/284: Guile: Minimal support for the new REPL debug mode., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile a9f26f1 115/284: Guile: slightly better compilation error regexps., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 11c2d58 138/284: Guile: excluding anonymous module names from completion., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 1c9457a 116/284: Guile: heuristically resolving relative paths in REPL errors., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile f1ac35f 140/284: Guile: filtering gensym names in autodoc display.,
Philip Kaludercic <=
- [nongnu] elpa/geiser-guile 6baa7d3 124/284: Guile: better stack trace limits during evaluation., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 14c1689 132/284: Guile: no more module loading under the rug., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile e43cfa8 121/284: Guile: evaluation fixes (current git head)., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile d41ac93 123/284: Debugging leftover., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 6907aea 145/284: Guile: geiser commands working at the debugging prompt., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 1178462 155/284: Guile: show error message upon entering the debugger, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile d1d05b7 175/284: Guile: using the new syntax for sending eval requests, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 8552404 176/284: Guile: using meta-commands to talk with Guile, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 1a35206 150/284: More docs., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile e2e3a0d 151/284: Redisplaying the prompt after empty lines on the REPL., Philip Kaludercic, 2021/08/01