emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Grant Rettke <gcr@wisdomandwonder.com>
To: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: [babel-R][RFC] Customizing the R prompt for babel sessions approach, advice, discussion
Date: Wed, 27 Aug 2014 21:11:39 -0500	[thread overview]
Message-ID: <CAAjq1mf-TndJrRuUoHgzLfn29gEEDThk+NbsbzXN-RarFH9VGg@mail.gmail.com> (raw)

[-- 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 --]

             reply	other threads:[~2014-08-28  2:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-28  2:11 Grant Rettke [this message]
2014-08-28  5:12 ` [babel-R][RFC] Customizing the R prompt for babel sessions approach, advice, discussion Aaron Ecay
2014-08-29 17:48   ` Grant Rettke

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=CAAjq1mf-TndJrRuUoHgzLfn29gEEDThk+NbsbzXN-RarFH9VGg@mail.gmail.com \
    --to=gcr@wisdomandwonder.com \
    --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).