emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ob-shell sessions will send final echo '...' as input key sequence w


From: Ihor Radchenko
Subject: Re: ob-shell sessions will send final echo '...' as input key sequence when previous command reads input interactively
Date: Wed, 03 May 2023 12:01:21 +0000

"Christopher M. Miles" <numbchild@gmail.com> 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?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]