emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Hendy <jw.hendy@gmail.com>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: org-mode mailing list <emacs-orgmode@gnu.org>,
	Vikas Rawal <vikaslists@agrarianresearch.org>
Subject: Re: org babel, ess, R
Date: Wed, 5 Jul 2017 16:58:00 -0500	[thread overview]
Message-ID: <CA+M2ft8bVGVOUjtX6cpbY1ha--cQf4o5xiWJ7qEXa0GvKuKD1Q@mail.gmail.com> (raw)
In-Reply-To: <87inj660la.fsf@nicolasgoaziou.fr>

On Wed, Jul 5, 2017 at 4:22 PM, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
> Hello,
>
> Vikas Rawal <vikaslists@agrarianresearch.org> writes:
>
>> C-RET seems to be picking up the custom session name if it is already
>> there. But otherwise it generates the default *R* session there,
>
> Is there a bug to fix? If so, could start a new thread about it, ideally
> with an ECM demonstrating the issue?

I guess Vikas can speak for Vikas, but he was responding to my
observation of the same:

"... I'd like Org to pick up the fact that there's a :session
argument with a custom name and use that for C-RET in the edit buffer;
otherwise it generates the default *R* session there, but if you C-c
C-c the block later it puts it into the custom session name."

Here's an ECM:

#+begin_example

* heading

#+name: x
#+begin_src R :session r

x <- 1:10

#+end_src

#+name: y
#+begin_src R :session r

y <- x^2

#+end_src

#+end_example

So, say I start working on a document for the day and enter the
editing buffer with C-c ' on block x. I then C-RET from the edit
buffer, which evaluates x and starts a new R session, *R*. Now I'm
done and go on to block y, but don't need to edit. Maybe I just want
to update a plot or other result in the document, so I C-c C-c:

Error: object 'x' not found

This really, really common for my work. I define a setup block
somewhere in which I load libraries, read in thousands of lines of
sensor code, and process things (moving averages, summary stats, etc.)
and create my sort of "master object." From there I have sections of a
report that subset the data, plot various things, but typically have
them all set to :eval no by default. If I pick up work on a file, edit
my setup code block, but only interactively because I forget I need to
C-c C-c something first to kick off the custom session, the work was
sort of for naught as everything is in the wrong session.

In this example, I realize the error and go back to block x and C-c
C-c after failing on block y. At that point, when I go to a block
interactively to do C-RET again, I get this in the minibuffer.

Process to load into: {r | *R* | *new* }

Then I switch to *R* to quit() and end the spurious session.

Really, it was a comment about how Org behaves, not necessarily a bug.
That said, speaking for myself, I would never want a default session
in interactive mode when I've defined one in the code heading. I'd
love if Org could pick up on that setting, such that the first C-RET
of the day dropped into the session named by the block I'm editing. At
present, interactive mode appears to ignore this.


Hope that helps clarify,
John





> Regards,
>
> --
> Nicolas Goaziou

  reply	other threads:[~2017-07-05 21:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-01  1:36 org babel, ess, R Vikas Rawal
2017-07-01  3:38 ` Vikas Rawal
2017-07-01 12:53 ` Nicolas Goaziou
2017-07-02  2:48   ` Vikas Rawal
2017-07-02  7:05     ` Nicolas Goaziou
2017-07-03  0:17       ` Vikas Rawal
2017-07-03  2:21         ` Andreas Kiermeier
2017-07-03  2:28           ` Vikas Rawal
2017-07-03  2:35             ` Andreas Kiermeier
2017-07-03 19:52         ` John Hendy
2017-07-03 23:19           ` Vikas Rawal
2017-07-04  2:17             ` Charles C. Berry
2017-07-04  9:20               ` Vikas Rawal
2017-07-05 21:22             ` Nicolas Goaziou
2017-07-05 21:58               ` John Hendy [this message]
2017-07-06  4:42                 ` Charles C. Berry
2017-07-06  4:53                   ` Vikas Rawal
2017-07-06  5:25                     ` Charles C. Berry
2017-07-07 11:57                 ` Nicolas Goaziou

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=CA+M2ft8bVGVOUjtX6cpbY1ha--cQf4o5xiWJ7qEXa0GvKuKD1Q@mail.gmail.com \
    --to=jw.hendy@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    --cc=vikaslists@agrarianresearch.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).