> I think you need to add TINYCHANGE cookie to the commit message as you > do not seem to have FSF copyright assignment (correct me if I am wrong) > See https://orgmode.org/worg/org-contribute.html
I did send off the form for FSF copyright assignment, but haven't heard back yet. (Any idea how long this process usually takes?) In the meantime, I've added the TINYCHANGE cookie to the commit. > Please, add a docstring. Here, and in all other new functions. Sorry about that! Docstrings added. > Any specific reason why you set things up differently from > `org-babel-scheme-execute-with-geiser': The `org-babel-scheme-execute-with-geiser' set-up still seems to display the buffer in the current window. My understanding is that `org-babel-initiate-session' shouldn't affect what windows are displayed, rather it should just return the session buffer.
From 9bbff9b143a4ef3121aa00033fbf163906285530 Mon Sep 17 00:00:00 2001 From: Sam <[email protected]> Date: Fri, 14 Nov 2025 21:47:56 +0000 Subject: [PATCH] lisp/ob-scheme.el: Add missing ob-core functions * lisp/ob-scheme.el (org-babel-execute:scheme): (org-babel-scheme--get-impl): Extract logic for determining impl as its own function (org-babel-scheme-initiate-session): (org-babel-prep-session:scheme): (org-babel-load-session:scheme): Added. Implementations similar to those of other languages (e.g. ob-R) These new functions make org-babel-pop-to-session and friends work correctly. TINYCHANGE --- lisp/ob-scheme.el | 47 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/lisp/ob-scheme.el b/lisp/ob-scheme.el index 084d7b75e..c748e78a4 100644 --- a/lisp/ob-scheme.el +++ b/lisp/ob-scheme.el @@ -241,6 +241,13 @@ Emacs-lisp table, otherwise return the results as a string." res)) (t res)))) +(defun org-babel-scheme--get-impl (&optional params) + (or (when (cdr (assq :scheme params)) + (intern (cdr (assq :scheme params)))) + geiser-scheme-implementation + geiser-default-implementation + (car geiser-active-implementations))) + (defun org-babel-execute:scheme (body params) "Execute a block of Scheme code with org-babel. This function is called by `org-babel-execute-src-block'." @@ -250,11 +257,7 @@ This function is called by `org-babel-execute-src-block'." (buffer-name source-buffer)))) (save-excursion (let* ((result-type (cdr (assq :result-type params))) - (impl (or (when (cdr (assq :scheme params)) - (intern (cdr (assq :scheme params)))) - geiser-scheme-implementation - geiser-default-implementation - (car geiser-active-implementations))) + (impl (org-babel-scheme--get-impl params)) (host (cdr (assq :host params))) (port (cdr (assq :port params))) (session (org-babel-scheme-make-session-name @@ -280,6 +283,40 @@ This function is called by `org-babel-execute-src-block'." result (org-babel-scheme--table-or-string table))))))) +(defun org-babel-scheme-initiate-session (session params) + "Return scheme buffer for SESSION according to PARAMS. + +Creates new session buffer if necessary." + (let ((impl (org-babel-scheme--get-impl params)) + (host (cdr (assq :host params))) + (port (cdr (assq :port params))) + (switch-to-buffer-obey-display-actions t) + (display-buffer-overriding-action '(display-buffer-no-window + (allow-no-window t)))) + (save-current-buffer + (org-babel-scheme-get-repl impl + session + host + port)))) + +(defun org-babel-prep-session:scheme (session params) + "Prepare SESSION according to header arguments in PARAMS." + (let ((repl (org-babel-scheme-initiate-session session params))) + (org-babel-scheme-execute-with-geiser + (org-babel-scheme-expand-header-arg-vars (org-babel--get-vars params)) + nil + (org-babel-scheme--get-impl params) + session) + repl)) + +(defun org-babel-load-session:scheme (session body params) + "Load BODY into SESSION." + (save-window-excursion + (with-current-buffer (org-babel-prep-session:scheme session params) + (goto-char (process-mark (get-buffer-process (current-buffer)))) + (insert (org-babel-chomp body)) + (current-buffer)))) + (provide 'ob-scheme) ;;; ob-scheme.el ends here -- 2.51.2
