0001-lisp-ob-scheme.el-Use-synchronous-eval.patch 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. From d06f6d5b7342693b4065c0c361e430c4bdb065e5 Mon Sep 17 00:00:00 2001
  2. From: Tim Van den Langenbergh <tmt_vdl@gmx.com>
  3. Date: Sat, 23 Apr 2022 14:57:27 +0200
  4. Subject: [PATCH] lisp/ob-scheme.el: Use synchronous eval.
  5. * ob-scheme.el (org-babel-scheme-execute-with-geiser): If available,
  6. use the synchronous `geiser-eval-region/wait' function to get the
  7. evaluation result.
  8. Works with geiser 0.18 (before introduction of async evaluation) and
  9. geiser 0.22 (which introduces `geiser-eval-region/wait').
  10. Modified from a patch proposal by Felipe Lema.
  11. TINYCHANGE
  12. ---
  13. lisp/ob-scheme.el | 8 +++++++-
  14. 1 file changed, 7 insertions(+), 1 deletion(-)
  15. diff --git a/lisp/ob-scheme.el b/lisp/ob-scheme.el
  16. index 72d2e029e..f28cadd87 100644
  17. --- a/lisp/ob-scheme.el
  18. +++ b/lisp/ob-scheme.el
  19. @@ -55,6 +55,8 @@
  20. (declare-function geiser-mode "ext:geiser-mode" ())
  21. (declare-function geiser-eval-region "ext:geiser-mode"
  22. (start end &optional and-go raw nomsg))
  23. +(declare-function geiser-eval-region/wait "ext:geiser-mode"
  24. + (start end &optional timeout))
  25. (declare-function geiser-repl-exit "ext:geiser-repl" (&optional arg))
  26. (declare-function geiser-eval--retort-output "ext:geiser-eval" (ret))
  27. (declare-function geiser-eval--retort-result-str "ext:geiser-eval" (ret prefix))
  28. @@ -176,7 +178,11 @@ is true; otherwise returns the last value."
  29. (setq geiser-impl--implementation nil)
  30. (let ((geiser-debug-jump-to-debug-p nil)
  31. (geiser-debug-show-debug-p nil))
  32. - (let ((ret (geiser-eval-region (point-min) (point-max))))
  33. + (let ((ret (funcall (if (fboundp 'geiser-eval-region/wait)
  34. + #'geiser-eval-region/wait
  35. + #'geiser-eval-region)
  36. + (point-min)
  37. + (point-max))))
  38. (setq result (if output
  39. (or (geiser-eval--retort-output ret)
  40. "Geiser Interpreter produced no output")
  41. --
  42. 2.35.3