[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/geiser-guile f857023 007/284: Edit symbol at point for pro
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/geiser-guile f857023 007/284: Edit symbol at point for programs. |
Date: |
Sun, 1 Aug 2021 18:29:05 -0400 (EDT) |
branch: elpa/geiser-guile
commit f857023945f6eee65d9725684f22e022c3e6acc4
Author: Jose Antonio Ortega Ruiz <jao@gnu.org>
Commit: Jose Antonio Ortega Ruiz <jao@gnu.org>
Edit symbol at point for programs.
---
geiser/emacs.scm | 1 +
geiser/eval.scm | 4 +++-
geiser/introspection.scm | 38 +++++++++++++++++++++++++++++++++-----
3 files changed, 37 insertions(+), 6 deletions(-)
diff --git a/geiser/emacs.scm b/geiser/emacs.scm
index 8f0fffd..a3212af 100644
--- a/geiser/emacs.scm
+++ b/geiser/emacs.scm
@@ -27,6 +27,7 @@
(define-module (geiser emacs)
#:re-export (ge:proc-args
ge:completions
+ ge:symbol-location
ge:compile-file
ge:load-file)
#:use-module ((geiser introspection)
diff --git a/geiser/eval.scm b/geiser/eval.scm
index 1400566..8a7f48f 100644
--- a/geiser/eval.scm
+++ b/geiser/eval.scm
@@ -70,7 +70,9 @@ SUBR, MSG and REST."
(current (getcwd)))
(dynamic-wind
(lambda () (chdir dest))
- (lambda () (compile-file path))
+ (lambda ()
+ (and (compile-file path)
+ (load-compiled (string-append dest "/" (compiled-file-name
path)))))
(lambda () (chdir current)))))
(define (load-file path)
diff --git a/geiser/introspection.scm b/geiser/introspection.scm
index 6ac3f69..03d5796 100644
--- a/geiser/introspection.scm
+++ b/geiser/introspection.scm
@@ -25,7 +25,7 @@
;;; Code:
(define-module (geiser introspection)
- #:export (proc-args completions)
+ #:export (proc-args completions symbol-location)
#:use-module (system vm program)
#:use-module (ice-9 session)
#:use-module (srfi srfi-1))
@@ -81,9 +81,37 @@
(apropos-internal (string-append "^" prefix)))
string<?))
-(define (proc-location proc)
- (let ((prog (resolve-symbol proc)))
- (and prog
- (program-source ))))
+(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 name)
+ (let* ((name (map symbol->string name))
+ (reverse-name (reverse name))
+ (leaf (car reverse-name))
+ (dir-hint-module-name (reverse (cdr reverse-name)))
+ (dir-hint (apply string-append
+ (map (lambda (elt)
+ (string-append elt "/"))
+ dir-hint-module-name))))
+ (%search-load-path (in-vicinity dir-hint leaf))))
+
+(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-location sym)
+ (let ((prog (resolve-symbol sym)))
+ (if (program? prog)
+ (program-location prog)
+ '())))
;;; introspection.scm ends here
- [nongnu] elpa/geiser-guile ceca3e5 038/284: Display (quote foo) as 'foo in autodoc strings., (continued)
- [nongnu] elpa/geiser-guile ceca3e5 038/284: Display (quote foo) as 'foo in autodoc strings., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 4ab2e9c 016/284: Autodoc: try symbol at point first. Some cleanups., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile a64467d 022/284: New command to open module file., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 8c8790c 029/284: Capture backtrace. Fix load/compile from Emacs., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 8db7920 030/284: Better stack delimitation: include only frames relevant to the eval'd expression., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile c60b2e0 035/284: Put new procedure-arguments into (geiser introspection) until it goes upstream., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 0d62495 048/284: Fix autodoc support for multiline arities in documentation., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 4a647eb 011/284: Faster, asynchronous autodoc., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 8cd5259 014/284: Small autodoc fixes., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 56671f6 015/284: New command to get docstrings (C-cC-d)., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile f857023 007/284: Edit symbol at point for programs.,
Philip Kaludercic <=
- [nongnu] elpa/geiser-guile d0f98a7 036/284: Simpler handling of rest args in Emacs' side., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 221e64e 042/284: Some refactoring and new ge:macroexpand., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile d69ca12 044/284: Autodoc support for GOOPS methods., Philip Kaludercic, 2021/08/01
- [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