emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: James Powell <powellj@pdx.edu>
To: emacs-orgmode@gnu.org
Subject: Bug: :session results in unfriendly error reporting
Date: Sun, 15 Aug 2021 16:41:15 -0700	[thread overview]
Message-ID: <5406173c-742f-1e4c-a8da-2d73b4e668ca@pdx.edu> (raw)

I write a deliberate syntax error into a code block:

: #+begin_src R :session
:   x <- 1
:   y xx z
: #+end_src

I put my cursor in there and C-c C-c.

What I expect: a gentle useful report about the error.
Maybe even org would move the cursor to the point of the
error in the org buffer.  If not, at least the buffer
"*Org-Babel Error Output*" will open and show me the error,
something like this (see also [1]),

: Error: unexpected symbol in:
: "x <- 1
: y xx"
: -UUU:@**--F2  *Org-Babel Error Output*   All L17    (Compilation etu) 
4:13PM 0.53 Mail --------------------------------------------------$

What happens instead:

- the *R* buffer is displayed.  It contains a long spammy traceback
   that has run off of the top of the screen.  To learn more I have to
   move the cursor into the *R* buffer and page back to the top of the
   traceback.

On the other hand, if I set ":session none", I get much friendlier
behavior.  The Error Output buffer opens with the simple error message
in it as I showed above when I use this source block:

: #+begin_src R :session none
:   x <- 1
:   y xx z
: #+end_src

I do not want to abandon :session because my code reads in a lot of
data to get started and I want my scripts, not my environment to be
"real" so I am not depending on R's ability to save and reload the
workspace at all [2] or on "Org's (clever and useful but) somewhat clunky
and inflexible method of passing data explicitly" [3].

Is there a way to get back to the "Error Output" buffer opening with a
simple message /while/ having :session being enabled?

thank you,
   James P.

References

[1] "Currently the only action Babel takes with STDERR is to display it in a
     pop-up buffer when code block evaluation fails" (Eric Schulte in 
2012, at
https://lists.gnu.org/archive/html/emacs-orgmode/2012-03/msg00057.html).

[2] « what will you save as your lasting record of what happened?
   [...[ As a beginning R user, it's OK to consider your environment
   [...]  "real."  However, in the long run, you'll be much better off
   if you consider your R scripts as "real." » (p. 111, Wickham, H. "R
   for data science : import, tidy, transform, visualize, and model
   data" O'Reilly Media, 2016).  To facilitate this, I have disabled
   'save workspace' permanently:
   : q <- function (save = "no", status = 0, runLast = TRUE)
   : .Internal(quit(save, status, runLast))

[3] «When I look at Org and think of "session-based" blocks, I see a
     potential big benefit in having multiple source-blocks throughout
     my document share the same session»
(https://lists.gnu.org/archive/html/emacs-orgmode/2011-06/msg00654.html,
     the only good hit for a search for "session Org-Babel Error Output" at
     https://lists.gnu.org/archive/html/emacs-orgmode/ as of
     [2021-08-15 Sun]).


-- 
James E. Powell, MS
Pronouns: he/him/his
Applied Physics PhD Candidate
Department of Physics
Portland State University
Home page: http://web.pdx.edu/~powellj
Office: SRTC 409B Phone: +1-503-725-8515



             reply	other threads:[~2021-08-15 23:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-15 23:41 James Powell [this message]
2021-08-16 18:25 ` Bug: :session results in unfriendly error reporting Berry, Charles via General discussions about Org-mode.
2021-08-17  5:02   ` Greg Minshall
2021-08-17  6:23     ` Tim Cross
2021-08-17  7:44       ` Greg Minshall
2021-09-27  8:42         ` Bastien
2021-09-27  9:52       ` Greg Minshall

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=5406173c-742f-1e4c-a8da-2d73b4e668ca@pdx.edu \
    --to=powellj@pdx.edu \
    --cc=emacs-orgmode@gnu.org \
    /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).