[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: comint-output-filter-functions and multi-line input
From: |
Ihor Radchenko |
Subject: |
Re: comint-output-filter-functions and multi-line input |
Date: |
Fri, 21 Oct 2022 05:32:55 +0000 |
<miha@kamnitnik.top> writes:
>> So, I'd prefer comint-based solution.
>> Such solution may also benefit other comint uses beyond this specific
>> issue with Org.
>
>>> Or maybe inject something like 'oldps=$PS2; PS2=""' before the command
>>> and 'PS2=$oldps' after the command. But whether this works could depend
>>> on the shell, some shells might have something like $PS3 or $RPS1, for
>>> example.
>
>> But will accept-process-output correctly work with PS2=""?
>
> Looking at the code in ob-shell.el, it probably wouldn't just work if
> you were to prepend your command with PS2="". You'd probably have to
> move accept-process-output at the end outside of the loop. (Inside the
> loop, accept-process-output could wait forever, since the process
> wouldn't print anything, PS2="" after all.)
At the end, I did go into PS2="", but instead of sending script
line-by-line, I just send it once and for all outside the loop, as you
suggested. It also works and looks less fragile.
Also, I figured something called PROMPT_COMMAND, which can also
interfere with prompt. Just using PS1/2 is not always enough.
--
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>
Re: comint-output-filter-functions and multi-line input, Stefan Monnier, 2022/10/17