No new patch this time. Seems like we need to sort out window management
with `geiser' first...

Ihor Radchenko <[email protected]> writes:

>>> 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.
>
> Do you mean displays transiently, disappearing after evaluation is complete?

Only if `:session' is "none". Otherwise it hangs around, replacing the
org buffer.

> If so, what about simply
>
> (defun org-babel-scheme-get-repl (impl name &optional host port)
>   "Switch to a Scheme REPL, creating it if it doesn't exist.
>
> If the variables HOST and PORT are set, connect to the running Scheme REPL."
>   (let ((buffer (org-babel-scheme-get-session-buffer name)))
>     (or buffer
>       (let ((inhibit-redisplay t)) ;; avoid flickering when geiser juggles 
> current buffer window
>           (if (fboundp 'geiser)
>               (if (and host port)
>                   (geiser-connect impl host port)
>                 (geiser impl))
>             ;; Obsolete since Geiser 0.26.
>           (run-geiser impl))
>         (when name
>           (rename-buffer name t)
>           (org-babel-scheme-set-session-buffer name (current-buffer)))
>         (current-buffer)))))

I wasn't aware of `inhibit-redisplay'. That could help, but isn't the
whole solution as mentioned above.

For `org-babel-load-session:scheme', I basically re-used the logic from
`ob-R'. However, I'm a little worried by the docstring of
`save-window-excursion', which explicitly advises against being used in
this way.

IMO the issue is with geiser. From what I could see, there is no way of
creating an active REPL buffer without also switching to it. If there's
some safe way to temporarily and globally disable *all* changes to
window state, then we can use that as a workaround. Otherwise I'm not
sure what to suggest...

Cheers,
Sam

Reply via email to