Ihor Radchenko writes: > "Christopher M. Miles" writes: > >> So currently ob-shell.el is async sending command into session buffer >> without waiting for command to be finished. >> >> I checked out the ob-shell.el source code. I suppose this is the core >> part of the problem. From intuitive view, session async evaluation >> indeed should not wait for command to be finished. But still feel a >> little weird. > > The core of the problem is in how Emacs comint is sending multiline > input. My earlier example with M-x shell also demonstrates what is > penning. comint.el basically simulates user input verbatim, as if you > typed the whole thing symbol by symbol, including newlines. > > And it makes total sense as long as you are actually typing things > interactively in the comint buffer. > > ob-shell :session in this case gets a bit weird. On one hand, it > faithfully simulates interactive session. On the other hand, it does not > feel fully interactive from user perspective, as you send a bunch of > commands together within a single source block. > > One way to avoid the situations like with mpv could be packing the whole > code block into script and then sending that script to comint session > buffer. But then people who would like to actually switch to that buffer > and work with it manually will get confused about what is going on > there. (see `org-babel-switch-to-session' and > `org-babel-switch-to-session-with-code'). >> If this :stdin interesting idea works, maybe other similar ideas will too.🙋 >> >> For examples: >> >> - Wrap command "mpv" with a shell function which disable accepting interactive input. > > Is there such a function? For all possible POSIX shells? > >> - Setting shell or environment variable in :prolog for source block to preventing interactive input. > > Again, do you know how to do this? I tested with bash and wrap mpv into a function. The :prolog way is not working too. Seems those workaround tries can't get around the essential problem. I'm too naive.... -- [ stardiviner ] I try to make every word tell the meaning that I want to express without misunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3