lisp/ob-scheme.el: Fix mit-scheme evaluation

* lisp/ob-scheme.el (org-babel-scheme-execute-with-geiser): Do not
sent top comment when evaluating code block.  mit-scheme has problems
processing it for some reason.
This commit is contained in:
Ihor Radchenko 2024-05-19 15:38:45 +02:00
parent c0b66bf9c1
commit bf71c8c597
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 44 additions and 39 deletions

View File

@ -182,6 +182,7 @@ is true; otherwise returns the last value."
(with-temp-buffer
(insert (format ";; -*- geiser-scheme-implementation: %s -*-" impl))
(newline)
(let ((beg (point)))
(insert code)
(geiser-mode)
(let ((geiser-repl-window-allow-split nil)
@ -203,7 +204,11 @@ is true; otherwise returns the last value."
(let ((ret (funcall (if (fboundp 'geiser-eval-region/wait)
#'geiser-eval-region/wait
#'geiser-eval-region)
(point-min)
;; Do not include top comment into evaluation.
;; Apparently, mit-scheme has
;; problems with the top comment we add:
;; "Unexpected read restart on: #[textual-i/o-port 27 for console]"
beg
(point-max))))
(let ((err (geiser-eval--retort-error ret)))
(setq result (cond
@ -221,7 +226,7 @@ is true; otherwise returns the last value."
(let ((msg (geiser-eval--error-msg err)))
(org-babel-eval-error-notify
nil
(concat (if (listp msg) (car msg) msg) "\n"))))))))))
(concat (if (listp msg) (car msg) msg) "\n")))))))))))
result))
(defun org-babel-scheme--table-or-string (results)