From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id eDuJIsI7wGCGwwAAgWs5BA (envelope-from ) for ; Wed, 09 Jun 2021 05:55:46 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id MAEGHsI7wGBQEgAAB5/wlQ (envelope-from ) for ; Wed, 09 Jun 2021 03:55:46 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 8BFDA1BC25 for ; Wed, 9 Jun 2021 05:55:45 +0200 (CEST) Received: from localhost ([::1]:56632 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lqpJg-0002Eo-Gz for larch@yhetil.org; Tue, 08 Jun 2021 23:55:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34172) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqpIu-0002Ed-19 for emacs-orgmode@gnu.org; Tue, 08 Jun 2021 23:54:56 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:33396) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lqpIs-00074h-Bm for emacs-orgmode@gnu.org; Tue, 08 Jun 2021 23:54:55 -0400 Received: by mail-wr1-x42f.google.com with SMTP id a20so23858746wrc.0 for ; Tue, 08 Jun 2021 20:54:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4U6yPLDnPgvransVoUOrdc58fDclFC7hHWr0X1/GPgo=; b=bNQTCpYr0Rns2YxQw1MSxUCHdzkwlv5lZIdgKlmmSmiI/DrcR8CHyQY1GY2EzMgI8O sx1/6bcwKt6WgQNdcOT/9t0cC6iyRvhyahWsf+Z5+EmTHNFWGumda/icjaTnARKHgRBd Iodd5G+YCBF5p5O1sSucW/5Tz7yv9yDFb1wa/PsP1SHSIWMdrP0t43FXSC25/d3WOtUQ c3GbLvxlMJLpovm+0W2mMLW+Uy4olKK9m1gp72SuLgV31VJS7oDHObyviGSg+YiMETdU Ae4W76MDAB66sKg3NAoKS9YGJVF2WQeYur1aa5J5E+oibD8GOQMWwCZVS3nw9DFf9JsA Ddrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4U6yPLDnPgvransVoUOrdc58fDclFC7hHWr0X1/GPgo=; b=U2tTHaSBz7ViTc24hiCz94q/mEK/hTo6eliA0T0EMos6vtI+EQmiSLipIixXF14/ao 2PzWw/fk/SSVaFWuCTe8tzrbAhVSs3loGkBsDWIRFWfQZ4oZiyDSjtopBXvElVtHB2dx nLgFWYhgw4tvobttWkcCyvMdzsVJEXNqR5xLVx62DqZGDuzKP7BphyPDKOHhf0X2/MA7 pdFa6IkxaT52/hGb4G/UuHSbKAv9mIokJy/DrnrR10A3+R3qJRUIndCGUa58oqhcy1Ts oA0Oo0NpYSgD69J+sehQC940iKH6V1Aakj9CvInSIz9Wc/MnPNmZ9THhlb7TZHFIuOeS P3Rg== X-Gm-Message-State: AOAM530za+kc42oOeVsdxPn0Cu93s0gumzrzxPFfUdrZUOwv2YmNgs7s 5Mwz0D3EMSUetllax0z5H9vtVxon7idC1lUJ40s= X-Google-Smtp-Source: ABdhPJx9rSsP1lQ1/dCXrdMYJDsjVdlHlBPGyHQtPSFglfpZdbui1PcmJmvft3n96ZzP8NtFLv1uAvbuTipzX+4oaVc= X-Received: by 2002:adf:c38a:: with SMTP id p10mr25761761wrf.138.1623210892934; Tue, 08 Jun 2021 20:54:52 -0700 (PDT) MIME-Version: 1.0 References: <87h7jhus7k.fsf@spx.local.example> <87wnsc2gp2.fsf@localhost> <5780a7fb-17b5-6bde-f3a1-ef741af57734@nicksavage.ca> In-Reply-To: <5780a7fb-17b5-6bde-f3a1-ef741af57734@nicksavage.ca> From: Kaushal Modi Date: Tue, 8 Jun 2021 23:54:17 -0400 Message-ID: Subject: Re: babel output seems to drop anything before % (in session) To: Nick Savage Content-Type: multipart/alternative; boundary="000000000000ab40cd05c44d3c76" Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=kaushal.modi@gmail.com; helo=mail-wr1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Emanuel Berg via General discussions about Org-mode." , Ihor Radchenko Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1623210946; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=4U6yPLDnPgvransVoUOrdc58fDclFC7hHWr0X1/GPgo=; b=WwKu3LwM4fHq4sYpFPMezdodo+RETylngYxyTdUOI20SiiMUlqiOF/yZR3VeR/z+TCPCaM 5p38ziRCG0ZVoVpWZS1/CbT4tMmuoL2WiTVikZAsEguC5XwYLaqKXVATa6ycLh2Qjdcdup mFcLY71Bsc1bLqXYOGSjI5QlfUe9UL7wPDGXrRCQmjkKKHO966gs/FdhTAG7mifZvJ6CBI 5EZS6xytgQyp5OGFV+M7qD6MzSQ3Ql/mUrTR+aO3+jLHUN4kY9DQPpJ9Zeo+yQKlK7Ehjc QfooKwhBwTP0eoBPl6Yi1PiikIFqjUtuJSYn39YkIB9A45FeGc4tnNC5nO/5DQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1623210946; a=rsa-sha256; cv=none; b=rBbDCJGjmP8Qd+coLzfo6eXp/IDT1AJnjS4VG8x/fMtRFDwQKqNHDeAfa6ZUSjMB88RAcr VidmYE9exHEYvbQZDa3q4qdjTNwNeiq0iilI5xxsrwTGXrdMoSHLCHeqY0//ubfByXhXM9 zzFOJu1T31cHfC8HYYR+uuG79JPtnKIAOn0fGyLERo70cwzKRnRVExsXR8HiINkoEL7VPi rxr4fAI6vFbQ1a1+hNWnR7Dgn8eRXqhvsrp33/yo39x8+QDwudm+o77tX+X80hwHkFzXD3 WZX2dN2TD9t7FesCdo2qA48YSPHK2eGG9JFUKdoJddzuMKcnAsfaoTf7K2I8Mw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=bNQTCpYr; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -1.33 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=bNQTCpYr; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 8BFDA1BC25 X-Spam-Score: -1.33 X-Migadu-Scanner: scn1.migadu.com X-TUID: DDrNR3ZfjeNA --000000000000ab40cd05c44d3c76 Content-Type: text/plain; charset="UTF-8" On Thu, May 6, 2021 at 7:45 PM Nick Savage 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 *ob-shell-session-issue* #+begin_src shell echo "1 > 0" #+end_src #+RESULTS: : : sh-4.2$ 1 > 0 #+begin_src shell echo "1 > 0" #+end_src #+RESULTS: : : 1 > 0 #+begin_src shell echo "1 > 0" #+end_src #+RESULTS: : : 1 > 0 #+begin_src shell echo "1 > 0" #+end_src #+RESULTS: : : 1 > 0 ===== --000000000000ab40cd05c44d3c76 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

On Thu, May 6, 2021 at 7:45 PM Nick Savag= e <nick@nicksavage.ca> wrot= e:
So I have a p= atch 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 p= rompt,
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 <= br> 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 buggin= g
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 bl= ock onwards.

Here's a MWE:

=3D=3D=3D=3D=3D
#+property: header-args:shell :exports both= :results output :session *ob-shell-session-issue*

#+begin_src shell=
echo "1 > 0"
#+end_src

#+RESULTS:
:
: sh-= 4.2$ 1 > 0

#+begin_src shell
echo "1 > 0"
#+en= d_src

#+RESULTS:
:
: 1 > 0

#+begin_src shell
ech= o "1 > 0"
#+end_src

#+RESULTS:
:
: 1 > 0
#+begin_src shell
echo "1 > 0"
#+end_src

#+= RESULTS:
:
: 1 > 0
=3D=3D=3D=3D=3D
--000000000000ab40cd05c44d3c76--