emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [babel-R][RFC] Customizing the R prompt for babel sessions approach, advice, discussion
@ 2014-08-28  2:11 Grant Rettke
  2014-08-28  5:12 ` Aaron Ecay
  0 siblings, 1 reply; 3+ messages in thread
From: Grant Rettke @ 2014-08-28  2:11 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 2835 bytes --]

Good evening,

The `R' programming language lets you set a custom prompt by evaluating
this `R' code:

╭────
│ options(prompt="ℝ> ")
╰────

When you are using `ess' [1] you need to let it know that you are using
a different prompt than the defult by customizing the following value
like this:

╭────
│ (defcustom inferior-S-prompt "[]a-zA-Z0-9.[]*\\(?:[>+.] \\)*ℝ+> "
│   "Regexp used in S and R inferior and transcript buffers for prompt
navigation.
│ Customise it to make `comint-previous-prompt' quiqly navigate to
│ interesting portions of the buffer.
│  "
│   :group 'ess-proc
│   :type 'string)
╰────

In order for `babel' to work correctly with the custom prompt currently
I make a change manually to ob-R.el in the function
`org-babel-R-evaluate-session' to modify the regex to look like this:

╭────
│ "^\\([ ]*[ℝ>+\\.][ ]?\\)+\\([[0-9]+\\|[ ]\\)"
╰────

Instead of making the change by hand I would like to add a new
customizable value to ob-R that contains the regex. The goal is to let
the user customize it themselves to accomodate any prompt. A couple of
weeks ago I posted a [patch] with that intent, and aaronecay provided
valuable feedback… but what I did wrong was both not discussing it with
anyone before I sent that patch and I also was too aggressive with the
change (it was a bad idea for the change).

Question:
• What do you think of such a change?
• Do you have a desired approach?
• Would you like a patch?
  • My change would be really basic, just add a new defcustom to store
    the regex and reference it in the session evalution function

It would change from this

╭────
│ (if (string-match
│      "^\\([ ]*[ℝ>+\\.][ ]?\\)+\\([[0-9]+\\|[ ]\\)" line)
│     (substring line (match-end 1))
│   line)
╰────

to this

╭────
│ (if (string-match
│      inferior-R-prompt line)
│     (substring line (match-end 1))
│   line)
╰────

╭────
│ emacs-version
╰────

╭────
│ 24.3.1
╰────

╭────
│ org-version
╰────

╭────
│ 8.2.7c
╰────

╭────
│ ess-version
╰────

╭────
│ 14.06
╰────

Kind regards,


[patch]
https://lists.gnu.org/archive/html/emacs-orgmode/2014-08/msg00753.html



Footnotes
─────────

[1] [http://ess.r-project.org/]

Grant Rettke | ACM, ASA, FSF
gcr@wisdomandwonder.com | http://www.wisdomandwonder.com/
“Wisdom begins in wonder.” --Socrates
((λ (x) (x x)) (λ (x) (x x)))
“Life has become immeasurably better since I have been forced to stop
taking it seriously.” --Thompson

[-- Attachment #2: Type: text/html, Size: 4344 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [babel-R][RFC] Customizing the R prompt for babel sessions approach, advice, discussion
  2014-08-28  2:11 [babel-R][RFC] Customizing the R prompt for babel sessions approach, advice, discussion Grant Rettke
@ 2014-08-28  5:12 ` Aaron Ecay
  2014-08-29 17:48   ` Grant Rettke
  0 siblings, 1 reply; 3+ messages in thread
From: Aaron Ecay @ 2014-08-28  5:12 UTC (permalink / raw)
  To: Grant Rettke, emacs-orgmode@gnu.org

Hi Grant,

2014ko abuztuak 27an, Grant Rettke-ek idatzi zuen:

[...]

> 
> Question:
> • What do you think of such a change?
> • Do you have a desired approach?
> • Would you like a patch?
>   • My change would be really basic, just add a new defcustom to store
>     the regex and reference it in the session evalution function

I think this patch will be made superfluous by the approach that Charles
Berry and I are working on in the thread I linked in my response to your
previous email (with useful contributions also from others).  Babel will
no longer need to know about the user’s prompt customizations (or lack
thereof) at all.

It’s taking a little bit for me to digest the discussion in that thread,
but I hope that if you can live with your local modifications a bit
longer you will be pleased with the end result.

-- 
Aaron Ecay

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [babel-R][RFC] Customizing the R prompt for babel sessions approach, advice, discussion
  2014-08-28  5:12 ` Aaron Ecay
@ 2014-08-29 17:48   ` Grant Rettke
  0 siblings, 0 replies; 3+ messages in thread
From: Grant Rettke @ 2014-08-29 17:48 UTC (permalink / raw)
  To: Grant Rettke, emacs-orgmode@gnu.org

Gotcha thanks for explaining that because I didn't understand how it
would fix it and just wanted to communicate my intent here.

Love that we can make customizations and am sure to enjoy the end
result of that discussion.
Grant Rettke | ACM, ASA, FSF
gcr@wisdomandwonder.com | http://www.wisdomandwonder.com/
“Wisdom begins in wonder.” --Socrates
((λ (x) (x x)) (λ (x) (x x)))
“Life has become immeasurably better since I have been forced to stop
taking it seriously.” --Thompson


On Thu, Aug 28, 2014 at 12:12 AM, Aaron Ecay <aaronecay@gmail.com> wrote:
> Hi Grant,
>
> 2014ko abuztuak 27an, Grant Rettke-ek idatzi zuen:
>
> [...]
>
>>
>> Question:
>> • What do you think of such a change?
>> • Do you have a desired approach?
>> • Would you like a patch?
>>   • My change would be really basic, just add a new defcustom to store
>>     the regex and reference it in the session evalution function
>
> I think this patch will be made superfluous by the approach that Charles
> Berry and I are working on in the thread I linked in my response to your
> previous email (with useful contributions also from others).  Babel will
> no longer need to know about the user’s prompt customizations (or lack
> thereof) at all.
>
> It’s taking a little bit for me to digest the discussion in that thread,
> but I hope that if you can live with your local modifications a bit
> longer you will be pleased with the end result.
>
> --
> Aaron Ecay

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-08-29 17:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-28  2:11 [babel-R][RFC] Customizing the R prompt for babel sessions approach, advice, discussion Grant Rettke
2014-08-28  5:12 ` Aaron Ecay
2014-08-29 17:48   ` Grant Rettke

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).