diff options
author | jao <jao@gnu.org> | 2022-10-13 03:45:51 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2022-10-13 03:45:51 +0100 |
commit | b91775c9a778ffbb91a9539ed2b1236ae06c68a6 (patch) | |
tree | 792425539559ce5ebd541b992b3975ce62cd5179 | |
parent | cf5ef755d7152c6a21b1655fb85ea02cb16ae285 (diff) | |
download | geiser-chez-b91775c9a778ffbb91a9539ed2b1236ae06c68a6.tar.gz geiser-chez-b91775c9a778ffbb91a9539ed2b1236ae06c68a6.tar.bz2 |
support for recognising current library (not yet used)
-rw-r--r-- | geiser-chez.el | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/geiser-chez.el b/geiser-chez.el index 92bede7..af3f11d 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) |