[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/geiser-guile 3398bc2 012/284: Inconsequential refactorings
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/geiser-guile 3398bc2 012/284: Inconsequential refactorings. |
Date: |
Sun, 1 Aug 2021 18:29:06 -0400 (EDT) |
branch: elpa/geiser-guile
commit 3398bc2d5456701d259dca6c93860d6842194b3c
Author: Jose Antonio Ortega Ruiz <jao@gnu.org>
Commit: Jose Antonio Ortega Ruiz <jao@gnu.org>
Inconsequential refactorings.
---
geiser/introspection.scm | 43 ++++++++++++++-----------------------------
1 file changed, 14 insertions(+), 29 deletions(-)
diff --git a/geiser/introspection.scm b/geiser/introspection.scm
index efe9a09..62d3ce5 100644
--- a/geiser/introspection.scm
+++ b/geiser/introspection.scm
@@ -32,13 +32,10 @@
(define (arguments sym . syms)
(let loop ((sym sym) (syms syms))
- (cond ((proc-args sym) => (lambda (args) (cons sym args)))
+ (cond ((obj-args (resolve-symbol sym)) => (lambda (args) (cons sym args)))
((null? syms) #f)
(else (loop (car syms) (cdr syms))))))
-(define (proc-args proc)
- (obj-args (resolve-symbol proc)))
-
(define (resolve-symbol sym)
(and (symbol? sym)
(module-bound? (current-module) sym)
@@ -51,6 +48,15 @@
((macro? obj) (macro-args obj))
(else #f)))
+(define (symbol-module sym)
+ (call/cc
+ (lambda (k)
+ (apropos-fold (lambda (module name var init)
+ (if (eq? name sym) (k (module-name module)) init))
+ #f
+ (symbol->string sym)
+ (apropos-fold-accessible (current-module))))))
+
(define (program-args program)
(let* ((arity (program-arity program))
(arg-no (first arity))
@@ -99,38 +105,17 @@
(apropos-internal (string-append "^" prefix)))
string<?))
+(define (symbol-location sym)
+ (cond ((symbol-module sym) => make-location-from-module-name)
+ (else '())))
+
(define (make-location file line)
(list (cons 'file (if (string? file) file '()))
(cons 'line (if (number? line) (+ 1 line) '()))))
-(define (program-line prog)
- (let ((src (program-source prog 0)))
- (and src (source:line src))))
-
(define module-filename (@@ (ice-9 session) module-filename))
-(define (program-file prog)
- (let* ((mod (and prog (program-module prog)))
- (name (and mod (module-name mod))))
- (and name (module-filename name))))
-
-(define (program-location prog)
- (make-location (program-file prog) (program-line prog)))
-
-(define (symbol-module sym)
- (call/cc
- (lambda (k)
- (apropos-fold (lambda (module name var init)
- (if (eq? name sym) (k (module-name module)) init))
- #f
- (symbol->string sym)
- (apropos-fold-accessible (current-module))))))
-
(define (make-location-from-module-name name)
(make-location (module-filename name) #f))
-(define (symbol-location sym)
- (cond ((symbol-module sym) => make-location-from-module-name)
- (else '())))
-
;;; introspection.scm ends here
- [nongnu] elpa/geiser-guile 4d48077 046/284: Fix recursive require. Nicer arg names in autodoc., (continued)
- [nongnu] elpa/geiser-guile 4d48077 046/284: Fix recursive require. Nicer arg names in autodoc., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 5be0195 049/284: Cache arguments parsed from documentation; don't treat quasiquote as a function., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 6ff9936 052/284: They say call/cc is slow in Guile., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile a96b437 053/284: turn-on/off-geiser-mode commands added and used in scheme-mode-hook., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile d71825c 058/284: Small bug fix., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile fe48642 008/284: M-. working for any symbol whose module can be located., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 75df3b1 024/284: Better symbol documentation., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 8cb76f1 045/284: Breakdown of schemeland into neat submodules., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 7b77380 054/284: New command to display generic methods (C-cC-dg) implemented., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 33b8c53 066/284: Callers/callees (C-c <, C-c >)., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 3398bc2 012/284: Inconsequential refactorings.,
Philip Kaludercic <=
- [nongnu] elpa/geiser-guile af1c5a3 013/284: Small improvements., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile a461795 017/284: Better docstring., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 6f2ed87 018/284: Recognise empty doc string in Emacs side. Small refactorings., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 63c39be 019/284: Initial support for module name completion., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 06fabb2 020/284: Compile command adapted to new compiled-file-name behaviour., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 3432ccf 021/284: New command: module documentation., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 08ba036 023/284: Separate commands for evaluation and compilation., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile d18c35b 025/284: Fix in symbol help signature displaying., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 3655a74 026/284: (geiser eval) functionality moved to (geiser emacs)., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 8377f5e 028/284: Refactoring of the eval/compile procedures., Philip Kaludercic, 2021/08/01