emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: Nick Savage <nick@nicksavage.ca>
Cc: "Emanuel Berg via General discussions about Org-mode."
	<emacs-orgmode@gnu.org>, Ihor Radchenko <yantar92@gmail.com>
Subject: Re: babel output seems to drop anything before % (in session)
Date: Tue, 8 Jun 2021 23:54:17 -0400	[thread overview]
Message-ID: <CAFyQvY27mW8Tg-6z5rUEWEYR-o6+bd6s1opC2+nsLz=HDtBzLA@mail.gmail.com> (raw)
In-Reply-To: <5780a7fb-17b5-6bde-f3a1-ef741af57734@nicksavage.ca>

[-- Attachment #1: Type: text/plain, Size: 1906 bytes --]

On Thu, May 6, 2021 at 7:45 PM Nick Savage <nick@nicksavage.ca> wrote:

> So I have a patch written that doesn't completely fix the problem, but
> maybe makes enough progress that someone else can figure it out.
> The issue is that comint-prompt-regexp is reading the "% " as a prompt,
> and taking everyone off before it. I've added another parameter to
> org-babel-comint-with-output in the "meta" to pass our own regexp to
> replace comint-prompt-regexp, which works except when it doesn't. The
> regexp I've added is just "\n" now, so the newline characters are removed.
> The tests that Daniele added as a patch don't quite pass though with
> this. The issue is that something in the way the output is posted in the
> output buffer includes the prompt occasionally is included in a line and
> occasionally not. It seems the first time the block of code is executed,
> it is included (and therefore needs to be removed) and each other time
> it is not, so it is only the first time that it is run is not working
> properly.
> This is obviously way too fragile to actually merge, but I was hoping
> the work I've done so far is enough to help someone else make progress.
> I'll probably take another stab at this tomorrow (since it's bugging
> me), but thought I'd share what I have for now.
> Cheers,
> Nick

Thanks! I tried out your patch and it does fix the truncation of results
output. Though, it retains the shell prompt in the first eval block and
removes it only from the second eval block onwards.

Here's a MWE:

#+property: header-args:shell :exports both :results output :session

#+begin_src shell
echo "1 > 0"

: sh-4.2$ 1 > 0

#+begin_src shell
echo "1 > 0"

: 1 > 0

#+begin_src shell
echo "1 > 0"

: 1 > 0

#+begin_src shell
echo "1 > 0"

: 1 > 0

[-- Attachment #2: Type: text/html, Size: 2623 bytes --]

  parent reply	other threads:[~2021-06-09  3:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-05 15:15 Daniele Pizzolli
2021-05-06  2:35 ` John Corless
2021-05-06 11:39   ` Nicholas Savage
2021-05-06 12:24     ` Ihor Radchenko
2021-05-06 23:44       ` Nick Savage
2021-05-15 20:47         ` Bastien
2021-06-09  3:41           ` Kaushal Modi
2021-06-09  3:54         ` Kaushal Modi [this message]
2021-06-09  4:01           ` Kaushal Modi
2021-11-09 21:21             ` Kaushal Modi
2021-11-10  4:13               ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFyQvY27mW8Tg-6z5rUEWEYR-o6+bd6s1opC2+nsLz=HDtBzLA@mail.gmail.com' \
    --to=kaushal.modi@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=nick@nicksavage.ca \
    --cc=yantar92@gmail.com \
    --subject='Re: babel output seems to drop anything before % (in session)' \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).