Ihor Radchenko <[email protected]> writes: > They should generally reply within a week. > If there is no reply for over a month, I can write to them to push > things forward. When did you send the assignment?
Only on Thursday, I was expecting an automated response I suppose. No need to push for now so long as TINYCHANGE is acceptable. >>> Please, add a docstring. Here, and in all other new functions. >> >> Sorry about that! Docstrings added. > > Almost :) You need to mention all the arguments in the docstring. > Still not the case in `org-babel-load-session:scheme'. > (try M-x checkdoc) Fair enough. Fixed! >>> 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. > > Does it mean that normal block evaluation spawns a new window now? It displays the REPL in the current window. This patch doesn't fix that issue (unless the user manually calls `org-babel-scheme-initiate-session' before evaluation) but I can make another if you're interested. >> * 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. > > Also, few nitpicks since we are not committing this patch yet: > 1. Please end sentences with "." > 2. Please quote Elisp symbols as `symbol'. Done. Thanks for all the feedback! Happy to make any more changes as necessary! Cheers, Sam
>From 3d31432c6e4322eb4b117e0130d80f4de09652f3 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 | 49 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/lisp/ob-scheme.el b/lisp/ob-scheme.el index 084d7b75e..6bb0365cc 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,42 @@ 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. + +Also evaluates any variable assignments in PARAMS before loading BODY." + (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
