[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/geiser-chez 7f12bcfe8b 13/15: initial implementation of sy
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/geiser-chez 7f12bcfe8b 13/15: initial implementation of symbol-location and module-location |
Date: |
Tue, 11 Oct 2022 13:58:55 -0400 (EDT) |
branch: elpa/geiser-chez
commit 7f12bcfe8b62a06cd9bce15b48d76ec2ebf66de4
Author: jao <jao@gnu.org>
Commit: jao <jao@gnu.org>
initial implementation of symbol-location and module-location
---
src/geiser/geiser.ss | 37 +++++++++++++++++++++++++++++++++----
1 file changed, 33 insertions(+), 4 deletions(-)
diff --git a/src/geiser/geiser.ss b/src/geiser/geiser.ss
index 04fbca8190..c39926e837 100644
--- a/src/geiser/geiser.ss
+++ b/src/geiser/geiser.ss
@@ -6,7 +6,9 @@
geiser:no-values
geiser:load-file
geiser:newline
- geiser:macroexpand)
+ geiser:macroexpand
+ geiser:symbol-location
+ geiser:module-location)
(import (chezscheme))
(define-syntax as-string
@@ -44,11 +46,13 @@
(last-index-of (cdr str-list) char (+ 1 idx)
(if (char=? char (car str-list)) idx last-idx))))
- (define (obj-file-name name)
+ (define (with-extension name ext)
(let ((idx (last-index-of (string->list name) #\. 0 -1)))
(if (= idx -1)
- (string-append name ".so")
- (string-append (substring name 0 idx) ".so"))))
+ (string-append name ext)
+ (string-append (substring name 0 idx) ext))))
+
+ (define (obj-file-name name) (with-extension name ".so"))
(define (geiser:load-file filename)
(let ((output-filename (obj-file-name filename)))
@@ -171,6 +175,31 @@
((not (symbol? (car ids))) (geiser:autodoc (cdr ids)))
(else (map operator-arglist ids))))
+ (define (geiser:symbol-location id)
+ (let* ([b (try-eval id)]
+ [c (and (not (eq? not-found b))
+ ((inspect/object b) 'code))])
+ (if c
+ (call-with-values (lambda () (c 'source-path))
+ (lambda (path line . col)
+ (let ((line (if (null? col) '() line))
+ (char (if (null? col) line '()))
+ (col (if (null? col) '() (car col))))
+ `(("name" . ,(c 'name))
+ ("file" . ,path)
+ ("line" . ,line)
+ ("column" . ,col)
+ ("char" . ,char)))))
+ '())))
+
+ (define (geiser:module-location id)
+ (let ((obj (library-object-filename id)))
+ (let loop ((exts (if obj (map car (library-extensions)) '())))
+ (cond ((null? exts) '())
+ ((file-exists? (with-extension obj (car exts)))
+ `(("file" . ,(with-extension obj (car exts)))))
+ (else (loop (cdr exts)))))))
+
(define (geiser:no-values) #f)
(define (geiser:newline) #f)
- [nongnu] elpa/geiser-chez updated (48427d4aec -> 53b7279550), ELPA Syncer, 2022/10/11
- [nongnu] elpa/geiser-chez db4d645996 01/15: better display of evaluation results (dups, spurious compile msgs), ELPA Syncer, 2022/10/11
- [nongnu] elpa/geiser-chez 52fbf028e5 04/15: fixes for the above in the face of non-continuable conditions, ELPA Syncer, 2022/10/11
- [nongnu] elpa/geiser-chez e80f797a5c 10/15: autodoc: fix for arity 0 functions, ELPA Syncer, 2022/10/11
- [nongnu] elpa/geiser-chez 3bfa85afb9 05/15: following the error reporting protocol now that geiser does too, ELPA Syncer, 2022/10/11
- [nongnu] elpa/geiser-chez 7f12bcfe8b 13/15: initial implementation of symbol-location and module-location,
ELPA Syncer <=
- [nongnu] elpa/geiser-chez 00ab1e6c7a 12/15: 'module' recognised as a keyword in chez, ELPA Syncer, 2022/10/11
- [nongnu] elpa/geiser-chez 3996898343 14/15: add-to-load-path, ELPA Syncer, 2022/10/11
- [nongnu] elpa/geiser-chez 2d8cd83c64 08/15: wee refactoring, ELPA Syncer, 2022/10/11
- [nongnu] elpa/geiser-chez 501fa22da4 06/15: whitespace and spurious rest arg, ELPA Syncer, 2022/10/11
- [nongnu] elpa/geiser-chez a70c47c557 07/15: unit test fixes, ELPA Syncer, 2022/10/11
- [nongnu] elpa/geiser-chez 21d35aa8d6 02/15: autodoc improvements (signatures from arities, values), ELPA Syncer, 2022/10/11
- [nongnu] elpa/geiser-chez 0cd37833ab 03/15: geiser-chez-debug-on-exception-p -> geiser-chez-debug-on-exception, ELPA Syncer, 2022/10/11
- [nongnu] elpa/geiser-chez 39b7e9357d 09/15: remote connections: wee refactoring, ELPA Syncer, 2022/10/11
- [nongnu] elpa/geiser-chez 846f96ba19 11/15: whitespace, ELPA Syncer, 2022/10/11
- [nongnu] elpa/geiser-chez 53b7279550 15/15: load-file: adjust current-directory to loaded file's, ELPA Syncer, 2022/10/11