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: miha
Subject: Re: comint-output-filter-functions and multi-line input
Date: Tue, 18 Oct 2022 09:22:39 +0200

Ihor Radchenko <yantar92@posteo.net> writes:

> miha@kamnitnik.top writes:
>
>>> Is it possible to distinguish the actual script output, empty lines in
>>> the actual script output, and the incomplete prompts?
>>
>> You could prepend your multiline command with a dummy
>> 'echo multiline_starts_here' command have your
>> 'comint-output-filter-functions' discard output that arrives before
>> "multiline_starts_here".
>
> 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

Attachment: signature.asc
Description: PGP signature


reply via email to

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