[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/geiser-chez b91775c9a7 2/2: support for recognising curren
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/geiser-chez b91775c9a7 2/2: support for recognising current library (not yet used) |
Date: |
Wed, 12 Oct 2022 22:58:47 -0400 (EDT) |
branch: elpa/geiser-chez
commit b91775c9a778ffbb91a9539ed2b1236ae06c68a6
Author: jao <jao@gnu.org>
Commit: jao <jao@gnu.org>
support for recognising current library (not yet used)
---
geiser-chez.el | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/geiser-chez.el b/geiser-chez.el
index 92bede7e4c..af3f11d1ad 100644
--- a/geiser-chez.el
+++ b/geiser-chez.el
@@ -143,23 +143,25 @@ Return its local name."
((car args) (concat "'" (car args)))
(t "#f"))))
(format "(geiser:eval %s '%s)" module form)))
- ((load-file compile-file)
- (format "(geiser:load-file %s)" (car args)))
- ((no-values)
- "(geiser:no-values)")
- (t
- (let ((form (mapconcat 'identity args " ")))
- (format "(geiser:%s %s)" proc form)))))
+ ((load-file compile-file) (format "(geiser:load-file %s)" (car args)))
+ ((no-values) "(geiser:no-values)")
+ (t (let ((form (mapconcat 'identity args " ")))
+ (format "(geiser:%s %s)" proc form)))))
+
+(defun geiser-chez--current-library ()
+ "Find current library."
+ (save-excursion
+ (geiser-syntax--pop-to-top)
+ (when (looking-at "(library[ \n]+\\(([^)]+)\\)")
+ (geiser-chez--get-module (match-string 1)))))
(defun geiser-chez--get-module (&optional module)
- "Find current module, or normalize MODULE."
- (cond ((null module)
- :f)
+ "Find current module (libraries for Chez), or normalize MODULE."
+ (cond ((null module) :f)
+ ;; ((null module) (or (geiser-chez--current-library) :f))
((listp module) module)
- ((stringp module)
- (condition-case nil
- (car (geiser-syntax--read-from-string module))
- (error :f)))
+ ((and (stringp module)
+ (ignore-errors (car (geiser-syntax--read-from-string module)))))
(t :f)))
(defun geiser-chez--symbol-begin (module)