From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id UECDFE28j2DVIQEAgWs5BA (envelope-from ) for ; Mon, 03 May 2021 11:03:09 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id +GQ9EE28j2BzbwAA1q6Kng (envelope-from ) for ; Mon, 03 May 2021 09:03:09 +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 880F61F5AE for ; Mon, 3 May 2021 11:03:08 +0200 (CEST) Received: from localhost ([::1]:47412 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ldUTr-0005Dw-Jn for larch@yhetil.org; Mon, 03 May 2021 05:03:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57282) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldUL7-0003IH-5D for emacs-orgmode@gnu.org; Mon, 03 May 2021 04:54:05 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:51758) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ldUL4-0001Rm-1B for emacs-orgmode@gnu.org; Mon, 03 May 2021 04:54:04 -0400 Received: by mail-wm1-x32b.google.com with SMTP id n205so1961608wmf.1 for ; Mon, 03 May 2021 01:54:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-transfer-encoding; bh=P8XMShDHwzvsdgzQDLwBpejGQaBfd/svvMVXQcGIWzg=; b=kcgqYXmX5N4xrTaxmLXwyNKGgPd+5VOZCSbTDK+whqck1MNti5XbbbdRPJb0zBN4oB OaY7Cu7SdRysE0tvcgOSTM8vGjcDtAc1Qk+0CRwV78QgP57KEx3pjJ7Nq/vQVLxRYEHT iflnRP/P2e3bazzyvAvvKgzk7/POAGbMx/1J2YfmVTne1nR+Y9I61YXqOJL0o6dR6B+2 St0d6mnLKOU8h9wzQAYUbZC+73NyYhkSWluB7CgSzDJrcXjzgQ7bdlnpYVhwMH5dH6jX H8tHc4i3m6nA48bdVoDbzjuZYU8tRLTHUaEcW+2Rj0qwWXDNhQ8mCNVGPFuJRp+eK6if aVeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=P8XMShDHwzvsdgzQDLwBpejGQaBfd/svvMVXQcGIWzg=; b=ivl4q6yuqLRNgksn39S30RFWtRqhGhfMtC2kG8MAejMHb9w+f8H2yp9U6LdsRZAvpU JIE6Zgsx8YZqfcA4FgQXSVrCMrKdZ1OcfpfHGiyqk2jzNLt9EGbkJUZMck2wFaq7FnEX ag+lM8ateIJqzYpRdsgJOJKO5hKdJhwMfhVAuSsmjidT23C0/i6BmAtysKtTciHA/zfD 9O+lv6wXSGXOWdQflJrAZvV6geWULvQFYRxXtGRr4TBRcvrzJMzAfNu/z0recVYABfVz cb92VxJAzaVUaXVqf51Cox256PFoCKxD0n/H9V/S9Bo0VwGNE3t+dZ7bh6OXJjZaPhJU iR6w== X-Gm-Message-State: AOAM533ZAf/mOW8OWzi59iN/xmYJgu5uHGw2KkreKeaSXQyhoSLGy8ZI lKphZ7nNELJMXyYwUq49SFM= X-Google-Smtp-Source: ABdhPJwYyHfyqpHVT6JA7W7qA7RAdUYG1EJkIGExeLSNopts1BlV3AJXEA+dGNDxMfTVKDBgcaJ1xA== X-Received: by 2002:a1c:c28a:: with SMTP id s132mr1685226wmf.145.1620032040476; Mon, 03 May 2021 01:54:00 -0700 (PDT) Received: from freegnu (82-64-129-7.subs.proxad.net. [82.64.129.7]) by smtp.gmail.com with ESMTPSA id v13sm11697340wrt.65.2021.05.03.01.53.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 May 2021 01:53:59 -0700 (PDT) From: Jeremie Juste To: Jack Kamm Subject: Re: Help debugging R source code block output problem with :session In-Reply-To: <87h7slgbi5.fsf@gmail.com> References: <87r1rqled0.fsf@havana> <87k0xifa9h.fsf@gmail.com> <87d03art6a.fsf@havana> <87h7slgbi5.fsf@gmail.com> Date: Mon, 03 May 2021 10:53:59 +0200 Message-ID: <87zgxc42qg.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=jeremiejuste@gmail.com; helo=mail-wm1-x32b.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, 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: "Berry, Charles" , emacs-orgmode@gnu.org, Ilja Kocken , Dylan Schwilk 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=1620032588; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=P8XMShDHwzvsdgzQDLwBpejGQaBfd/svvMVXQcGIWzg=; b=dvoj5EEWut8pOL1qycFVqQAIx7OJvW9aEIpM4XWIZKJynRBvdy9qtqTuOb9uFNStwtJjql SfSOlF85Hq1wuvBtWq9jT6XTdvj/nBzsVbedcLMAwRNn0S/NGrM/tpicwRETvSDFKTYdEe BJ8hGHD6DhnamBOpEoXJSaHrHjY13CChLEeT8jkjuUFCmAcjBmoQ/TqJobjZBM6bLDAi6j otXQwqjT43rOixo0Woa8940Q1o6Pn649MSSXHIRPlWncwX9IKgpRE5jAc+XEZmHb66q8+S SlinTQpLzk8wJMCIICxqvA/5p9iEBcx56Cv4JhI76Sw99nBmC9MIJ5RygMKHfA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1620032588; a=rsa-sha256; cv=none; b=nfaS7gVY9t12Xg5s99vAVFlEof8XhBVUXvjSEar6b52zfnSz+q9t0U6QtkOcTzDMEgjFiP RURttZSqQgn+xTM1pdywCNNM3ah6FdFeNsKmZNIN4H87sm1i2631iCHSpJVqY0rNlbSdQ9 6s849as8e8IGmD1vZokf6fFbK+naElViNDOo6fWAb10SpzN0TK+zCfAv3U++d2K/Jt99hi oMbeiBjjNNfs15mkJFUGx6QE3wRVDc6h9F9ZMvYiDbn0zOEARSRPmKWwk4UONRDDcxORNJ D9Pvnd2tTEYA76fM0ZgXGFtT8OpOKs6qxbma+RpYaw0KMy6yWmc0C+AFtT7eLQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=kcgqYXmX; 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.36 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=kcgqYXmX; 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: 880F61F5AE X-Spam-Score: -1.36 X-Migadu-Scanner: scn0.migadu.com X-TUID: fD2Gj9G+8Wit Hello, I must apologize again for the delay. I'll be more responsive from now on. @Jack, I have applied the patch at the bottom of the mail. It is not your latest patch but it works as well and is able to handle R errors. > https://orgmode.org/list/87ft7t9wqk.fsf@gmail.com/ I have also added the 2 test cases with to make sure we are aware if this feature breaks in the future. > https://orgmode.org/list/87h7slgbi5.fsf@gmail.com/ > I'd be interested to hear if the attached patch works for the common > cases you encounter, such as with tibbles. @ Ilja, sorry for the delayed reply. Regarding tibbles we are still not out of the woods. But the current patch would work if crayon option is removed. #+BEGIN_SRC R :results output :session "local1" :pre options(crayon.enabled=3DFALSE) library(tidyr) library(dplyr) as_tibble(iris) #+END_SRC #+RESULTS: #+begin_example # A tibble: 150 x 5 Sepal.Length Sepal.Width Petal.Length Petal.Width Species =20=20 1 5.1 3.5 1.4 0.2 setosa=20 2 4.9 3 1.4 0.2 setosa=20 3 4.7 3.2 1.3 0.2 setosa=20 4 4.6 3.1 1.5 0.2 setosa=20 5 5 3.6 1.4 0.2 setosa=20 6 5.4 3.9 1.7 0.4 setosa=20 7 4.6 3.4 1.4 0.3 setosa=20 8 5 3.4 1.5 0.2 setosa=20 9 4.4 2.9 1.4 0.2 setosa=20 10 4.9 3.1 1.5 0.1 setosa=20 # =E2=80=A6 with 140 more rows #+end_example >=20 @Chuck > https://orgmode.org/list/352C7149-743F-4944-ACA5-7A1242B5A3AA@health.ucsd= .edu/ >If you do decide to dig into solving this, please be sure that remote >sessions and graphical outputs are not broken. test-ob-R.el does not >cover those cases. In fact, it is pretty short, so there are probably >other things that could break without `make test' complaining. The current patch have been tested for remote connections as well and AFAIK, nothing breaks. But I'm afraid that the graphical output is broken and has long been even before the path. The test for graphical output is compromised and does not do the right test. I will suggest new ones.=20 Please feel free to contact me or reply on the mailing list if you have see any improvements to be made. Best regards, Jeremie On Saturday, 29 Aug 2020 at 00:24, Jack Kamm wrote: >>>From 9eaf81d708f88d06f14f9b6b9cf4182dd0fbb997 Mon Sep 17 00:00:00 2001 > From: Jack Kamm > Date: Sat, 29 Aug 2020 00:07:58 -0700 > Subject: [PATCH] ob-R: Fix prompt mangling in session output > > * lisp/ob-R.el (org-babel-R-evaluate-session): Force comint prompt > regexp to start at beginning of line, to prevent > org-babel-comint-with-output from splitting mid-line. > > Fixes https://orgmode.org/list/875zgjh8wn.fsf@gmail.com/ and > https://orgmode.org/list/87r1rqled0.fsf@havana/ > --- > lisp/ob-R.el | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/lisp/ob-R.el b/lisp/ob-R.el > index 5e9d35f58..10b3b6fe3 100644 > --- a/lisp/ob-R.el > +++ b/lisp/ob-R.el > @@ -450,11 +450,13 @@ (defun org-babel-R-evaluate-session > (car (split-string line "\n"))) > (substring line (match-end 1)) > line)) > - (org-babel-comint-with-output (session org-babel-R-eoe-output) > - (insert (mapconcat 'org-babel-chomp > - (list body org-babel-R-eoe-indicator) > - "\n")) > - (inferior-ess-send-input)))))) "\n")))) > + (with-current-buffer session > + (let ((comint-prompt-regexp (concat "^" comint-prompt-regexp))) > + (org-babel-comint-with-output (session org-babel-R-eoe-output) > + (insert (mapconcat 'org-babel-chomp > + (list body org-babel-R-eoe-indicator) > + "\n")) > + (inferior-ess-send-input)))))))) "\n")))) >=20=20 > (defun org-babel-R-process-value-result (result column-names-p) > "R-specific processing of return value. > --=20 > 2.28.0