emacs-devel
[Top][All Lists]
Advanced

[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: Tue, 18 Oct 2022 07:35:51 +0000

<miha@kamnitnik.top> writes:

>> For context, I am asking because I am trying to figure out how ob-shell
>> works in Org mode. My multiline command can be arbitrary bash script
>> containing multiple single- and multi-line commands. It is hard to
>> figure out which one is which.
>
> I see. Perhaps you could turn your bash script into a single multi-line
> command by encapsulating it into an 'if true' block. So given
>
>     if [ $(( 1 + 1 )) = 2 ]
>     then
>         echo "hello"
>     fi
>     echo $(( 3 + 4 ))
>
> you could encapsulate it into something like
>
>     if true; then
>         echo "multiline_starts_here"
>
>         if [ $(( 1 + 1 )) = 2 ]
>         then
>             echo "hello"
>         fi
>         echo $(( 3 + 4 ))
>
>         echo "multiline_ends_here"
>     fi

There could be multiple such blocks in the script. And it may not be
bash, but something else (fish, csh, posh, etc). Finding ways to do the
wrapping for all the shell flavours will be maintenance hell.

So, I'd prefer comint-based solution.
Such solution may also benefit other comint uses beyond this specific
issue with Org.

-- 
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]