1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-12-14 09:39:21 +00:00

lisp/ob-scheme.el: Use synchronous eval.

* ob-scheme.el (org-babel-scheme-execute-with-geiser): If available,
use the synchronous `geiser-eval-region/wait' function to get the
evaluation result.

Works with geiser 0.18 (before introduction of async evaluation) and
geiser 0.22 (which introduces `geiser-eval-region/wait').

Modified from a patch proposal by Felipe Lema.

TINYCHANGE
This commit is contained in:
Tim Van den Langenbergh 2022-04-23 14:57:27 +02:00 committed by Ihor Radchenko
parent 2e4ed52b19
commit 06d08e6f30
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B

View File

@ -55,6 +55,8 @@
(declare-function geiser-mode "ext:geiser-mode" ())
(declare-function geiser-eval-region "ext:geiser-mode"
(start end &optional and-go raw nomsg))
(declare-function geiser-eval-region/wait "ext:geiser-mode"
(start end &optional timeout))
(declare-function geiser-repl-exit "ext:geiser-repl" (&optional arg))
(declare-function geiser-eval--retort-output "ext:geiser-eval" (ret))
(declare-function geiser-eval--retort-result-str "ext:geiser-eval" (ret prefix))
@ -176,7 +178,13 @@ is true; otherwise returns the last value."
(setq geiser-impl--implementation nil)
(let ((geiser-debug-jump-to-debug-p nil)
(geiser-debug-show-debug-p nil))
(let ((ret (geiser-eval-region (point-min) (point-max))))
;; `geiser-eval-region/wait' was introduced to await the
;; result of async evaluation in geiser version 0.22.
(let ((ret (funcall (if (fboundp 'geiser-eval-region/wait)
#'geiser-eval-region/wait
#'geiser-eval-region)
(point-min)
(point-max))))
(setq result (if output
(or (geiser-eval--retort-output ret)
"Geiser Interpreter produced no output")