From: Jeremie Juste <jeremiejuste@gmail.com>
To: Jack Kamm <jackkamm@gmail.com>
Cc: "Berry, Charles" <ccberry@health.ucsd.edu>,
emacs-orgmode@gnu.org, Ilja Kocken <i.j.kocken@uu.nl>,
Dylan Schwilk <dylan@schwilk.org>
Subject: Re: Help debugging R source code block output problem with :session
Date: Mon, 03 May 2021 10:53:59 +0200 [thread overview]
Message-ID: <87zgxc42qg.fsf@gmail.com> (raw)
In-Reply-To: <87h7slgbi5.fsf@gmail.com>
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=FALSE)
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
<dbl> <dbl> <dbl> <dbl> <fct>
1 5.1 3.5 1.4 0.2 setosa
2 4.9 3 1.4 0.2 setosa
3 4.7 3.2 1.3 0.2 setosa
4 4.6 3.1 1.5 0.2 setosa
5 5 3.6 1.4 0.2 setosa
6 5.4 3.9 1.7 0.4 setosa
7 4.6 3.4 1.4 0.3 setosa
8 5 3.4 1.5 0.2 setosa
9 4.4 2.9 1.4 0.2 setosa
10 4.9 3.1 1.5 0.1 setosa
# … with 140 more rows
#+end_example
>
@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.
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 <jackkamm@gmail.com>
> 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"))))
>
> (defun org-babel-R-process-value-result (result column-names-p)
> "R-specific processing of return value.
> --
> 2.28.0
next prev parent reply other threads:[~2021-05-03 9:03 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-28 20:11 Help debugging R source code block output problem with :session Dylan Schwilk
2020-08-29 2:36 ` Jack Kamm
2020-08-29 4:07 ` Dylan Schwilk
2020-08-29 7:24 ` Jack Kamm
2020-08-29 20:35 ` Berry, Charles via General discussions about Org-mode.
2020-08-30 4:37 ` Dylan Schwilk
2020-08-30 15:08 ` Jack Kamm
2020-09-07 8:18 ` Jack Kamm
2020-09-07 8:45 ` Jack Kamm
2020-09-07 17:37 ` Berry, Charles via General discussions about Org-mode.
2020-09-07 20:07 ` Jack Kamm
2020-09-07 22:12 ` Berry, Charles via General discussions about Org-mode.
2020-09-08 1:06 ` Jack Kamm
2020-09-08 2:08 ` Berry, Charles via General discussions about Org-mode.
2020-09-08 14:51 ` Jack Kamm
2020-09-08 16:45 ` Berry, Charles via General discussions about Org-mode.
2020-09-08 17:41 ` Jack Kamm
2020-09-18 16:39 ` Dylan Schwilk
2020-10-28 13:13 ` Jack Kamm
2020-10-28 13:46 ` Jeremie Juste
2020-08-30 4:18 ` Dylan Schwilk
2021-05-03 8:53 ` Jeremie Juste [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-01-11 23:36 John Hendy
2022-01-12 7:49 ` Jeremie Juste
2022-01-12 15:04 ` John Hendy
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
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=87zgxc42qg.fsf@gmail.com \
--to=jeremiejuste@gmail.com \
--cc=ccberry@health.ucsd.edu \
--cc=dylan@schwilk.org \
--cc=emacs-orgmode@gnu.org \
--cc=i.j.kocken@uu.nl \
--cc=jackkamm@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
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).