emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/geiser-gauche 3d540b3 061/119: Symbol location work


From: Philip Kaludercic
Subject: [nongnu] elpa/geiser-gauche 3d540b3 061/119: Symbol location work
Date: Sun, 1 Aug 2021 18:27:57 -0400 (EDT)

branch: elpa/geiser-gauche
commit 3d540b3c2de3e91522cae97c9f3adcfbd971bfdf
Author: András Simonyi <andras.simonyi@gmail.com>
Commit: András Simonyi <andras.simonyi@gmail.com>

    Symbol location work
---
 geiser-gauche.el |  5 +++--
 geiser.scm       | 19 +++++++++++++++++--
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/geiser-gauche.el b/geiser-gauche.el
index 2711857..9afc5f8 100644
--- a/geiser-gauche.el
+++ b/geiser-gauche.el
@@ -86,8 +86,9 @@
   (cl-case proc
     ;; Autodoc (alone) makes use of the {{cur-module}} cookie to pass current
     ;; module information
-    ((autodoc) (format "(eval '(geiser:autodoc %s {{cur-module}}) (find-module 
'geiser))"
-                      (mapconcat 'identity args " ")))
+    ((autodoc symbol-location)
+     (format "(eval '(geiser:%s %s {{cur-module}}) (find-module 'geiser))"
+            proc (mapconcat 'identity args " ")))
     ;; Eval and compile are (module) context sensitive
     ((eval compile)
      (let ((module (cond ((string-equal "'()" (car args))
diff --git a/geiser.scm b/geiser.scm
index 4cd8edb..5dd7d23 100644
--- a/geiser.scm
+++ b/geiser.scm
@@ -13,6 +13,7 @@
    geiser:module-completions
    geiser:add-to-load-path
    geiser:symbol-documentation
+   geiser:symbol-location
    geiser:module-location
    geiser:module-exports
    ;; Missing functions:
@@ -136,8 +137,8 @@
 
 ;;; Autodoc
 
-(define (geiser:autodoc symbols . rest)
-  (map (cut formatted-autodoc <> (car rest))
+(define (geiser:autodoc symbols pref-module)
+  (map (cut formatted-autodoc <> pref-module)
        symbols))
 
 (define (formatted-autodoc symbol pref-module)
@@ -244,7 +245,21 @@
 
 ;; Further
 
+(define (geiser:symbol-location symbol pref-module)
+  (if (find-module symbol)
+      (geiser:module-location symbol)
+      (let* ((module (or pref-module 'user))
+            (obj (global-variable-ref module symbol #f)))
+       (if (and obj (or (is-a? obj <procedure>)
+                        (is-a? obj <generic>)))
+           (let* ((sl (source-location obj))
+                  (file (car sl))
+                  (line (cadr sl)))
+             `(("file" . ,file) ("line" . ,line) ("column")))
+           ()))))
+
 ;; TODO We add the load-path at the end. Is this correct?
 (define-macro (geiser:add-to-load-path dir)
   `(add-load-path ,dir :after))
 
+



reply via email to

[Prev in Thread] Current Thread [Next in Thread]