summaryrefslogtreecommitdiff
path: root/elisp/geiser-debug.el
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-12-29 16:16:21 +0000
committerjao <jao@gnu.org>2021-12-29 16:17:20 +0000
commite4175e7b2c012fbefdabad1ee4e96ff8cc25df4e (patch)
treeeecf0b0940b1546d7decb81ff3044aa495431f22 /elisp/geiser-debug.el
parenta910c7f80418fd12058dce3d6c348a752fada032 (diff)
downloadgeiser-e4175e7b2c012fbefdabad1ee4e96ff8cc25df4e.tar.gz
geiser-e4175e7b2c012fbefdabad1ee4e96ff8cc25df4e.tar.bz2
New function geiser-eval-region/wait
Diffstat (limited to 'elisp/geiser-debug.el')
-rw-r--r--elisp/geiser-debug.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/elisp/geiser-debug.el b/elisp/geiser-debug.el
index f5b98a3..f761c8b 100644
--- a/elisp/geiser-debug.el
+++ b/elisp/geiser-debug.el
@@ -286,6 +286,12 @@ buffer.")
str))
(defun geiser-debug--send-region (compile start end and-go wrap &optional nomsg)
+ "Evaluate (or COMPILE) the region delimited by START and END.
+The result of the evaluation is reported asynchronously, so this
+call is not blocking. If AND-GO is t, also jump to the repl
+buffer. If WRAP is t, the region's content is wrapped in a begin
+form. The flag NOMSG can be used to avoid reporting of the
+result in the minibuffer."
(let* ((str (buffer-substring-no-properties start end))
(wrapped (if wrap (geiser-debug--wrap-region str) str))
(code `(,(if compile :comp :eval) (:scm ,wrapped)))
@@ -306,6 +312,14 @@ buffer.")
(geiser-debug--display-retort scstr ret res)))))
(geiser-eval--send code cont (current-buffer))))
+(defun geiser-debug--send-region/wait (compile start end timeout)
+ "Synchronous version of `geiser-debug--send-region', waiting and returning its result."
+ (let* ((str (buffer-substring-no-properties start end))
+ (wrapped (geiser-debug--wrap-region str))
+ (code `(,(if compile :comp :eval) (:scm ,wrapped))))
+ (message "evaluating: %s" code)
+ (geiser-eval--send/wait code timeout)))
+
(defun geiser-debug--expand-region (start end all wrap)
(let* ((str (buffer-substring-no-properties start end))
(wrapped (if wrap (geiser-debug--wrap-region str) str))