From mboxrd@z Thu Jan 1 00:00:00 1970 From: Grant Rettke Subject: [babel-R][RFC] Customizing the R prompt for babel sessions approach, advice, discussion Date: Wed, 27 Aug 2014 21:11:39 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11348abc9db89f0501a70e1d Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36401) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMpBf-0006Ab-8E for emacs-orgmode@gnu.org; Wed, 27 Aug 2014 22:11:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XMpBd-0000dA-BQ for emacs-orgmode@gnu.org; Wed, 27 Aug 2014 22:11:43 -0400 Received: from mail-oi0-x233.google.com ([2607:f8b0:4003:c06::233]:38561) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMpBd-0000cG-45 for emacs-orgmode@gnu.org; Wed, 27 Aug 2014 22:11:41 -0400 Received: by mail-oi0-f51.google.com with SMTP id v63so101288oia.38 for ; Wed, 27 Aug 2014 19:11:40 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "emacs-orgmode@gnu.org" --001a11348abc9db89f0501a70e1d Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Good evening, The `R' programming language lets you set a custom prompt by evaluating this `R' code: =E2=95=AD=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=94=82 options(prompt=3D"=E2=84=9D> ") =E2=95=B0=E2=94=80=E2=94=80=E2=94=80=E2=94=80 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: =E2=95=AD=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=94=82 (defcustom inferior-S-prompt "[]a-zA-Z0-9.[]*\\(?:[>+.] \\)*=E2= =84=9D+> " =E2=94=82 "Regexp used in S and R inferior and transcript buffers for pro= mpt navigation. =E2=94=82 Customise it to make `comint-previous-prompt' quiqly navigate to =E2=94=82 interesting portions of the buffer. =E2=94=82 " =E2=94=82 :group 'ess-proc =E2=94=82 :type 'string) =E2=95=B0=E2=94=80=E2=94=80=E2=94=80=E2=94=80 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: =E2=95=AD=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=94=82 "^\\([ ]*[=E2=84=9D>+\\.][ ]?\\)+\\([[0-9]+\\|[ ]\\)" =E2=95=B0=E2=94=80=E2=94=80=E2=94=80=E2=94=80 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=E2=80=A6 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: =E2=80=A2 What do you think of such a change? =E2=80=A2 Do you have a desired approach? =E2=80=A2 Would you like a patch? =E2=80=A2 My change would be really basic, just add a new defcustom to st= ore the regex and reference it in the session evalution function It would change from this =E2=95=AD=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=94=82 (if (string-match =E2=94=82 "^\\([ ]*[=E2=84=9D>+\\.][ ]?\\)+\\([[0-9]+\\|[ ]\\)" line) =E2=94=82 (substring line (match-end 1)) =E2=94=82 line) =E2=95=B0=E2=94=80=E2=94=80=E2=94=80=E2=94=80 to this =E2=95=AD=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=94=82 (if (string-match =E2=94=82 inferior-R-prompt line) =E2=94=82 (substring line (match-end 1)) =E2=94=82 line) =E2=95=B0=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=95=AD=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=94=82 emacs-version =E2=95=B0=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=95=AD=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=94=82 24.3.1 =E2=95=B0=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=95=AD=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=94=82 org-version =E2=95=B0=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=95=AD=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=94=82 8.2.7c =E2=95=B0=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=95=AD=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=94=82 ess-version =E2=95=B0=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=95=AD=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=94=82 14.06 =E2=95=B0=E2=94=80=E2=94=80=E2=94=80=E2=94=80 Kind regards, [patch] https://lists.gnu.org/archive/html/emacs-orgmode/2014-08/msg00753.html Footnotes =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80 [1] [http://ess.r-project.org/] Grant Rettke | ACM, ASA, FSF gcr@wisdomandwonder.com | http://www.wisdomandwonder.com/ =E2=80=9CWisdom begins in wonder.=E2=80=9D --Socrates ((=CE=BB (x) (x x)) (=CE=BB (x) (x x))) =E2=80=9CLife has become immeasurably better since I have been forced to st= op taking it seriously.=E2=80=9D --Thompson --001a11348abc9db89f0501a70e1d Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Good evening,

The `R' pr= ogramming language lets you set a custom prompt by evaluating
thi= s `R' code:

=E2=95=AD=E2=94=80=E2=94=80=E2=94= =80=E2=94=80
=E2=94=82 options(prompt=3D"=E2=84=9D> "= ;)
=E2=95=B0=E2=94=80=E2=94=80=E2=94=80=E2=94=80

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

=E2=95=AD=E2=94=80=E2=94=80=E2=94=80=E2=94=80
=E2= =94=82 (defcustom inferior-S-prompt "[]a-zA-Z0-9.[]*\\(?:[>+.] \\)*= =E2=84=9D+> "
=E2=94=82 =C2=A0 "Regexp used in S and= R inferior and transcript buffers for prompt navigation.
=E2=94=82 Customise it to make `comint-previous-prompt' quiqly navigate= to
=E2=94=82 interesting portions of the buffer.
=E2= =94=82 =C2=A0"
=E2=94=82 =C2=A0 :group 'ess-proc
=E2=94=82 =C2=A0 :type 'string)
=E2=95=B0=E2=94=80=E2=94= =80=E2=94=80=E2=94=80

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

=E2=95=AD=E2=94=80=E2=94=80=E2=94=80=E2=94=80
=E2=94=82 "^\\([ ]*[=E2=84=9D>+\\.][ ]?\\)+\\([[0-9]+\\|[ ]\\)&quo= t;
=E2=95=B0=E2=94=80=E2=94=80=E2=94=80=E2=94=80

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 l= et
the user customize it themselves to accomodate any prompt. A couple of=
weeks ago I posted a [patch] with that intent, and aaronecay pro= vided
valuable feedback=E2=80=A6 but what I did wrong was both no= t 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).

<= div>Question:
=E2=80=A2 What do you think of such a change?
=
=E2=80=A2 Do you have a desired approach?
=E2=80=A2 Would you lik= e a patch?
=C2=A0 =E2=80=A2 My change would be really basic, just= add a new defcustom to store
=C2=A0 =C2=A0 the regex and referen= ce it in the session evalution function

It would change from this

=E2= =95=AD=E2=94=80=E2=94=80=E2=94=80=E2=94=80
=E2=94=82 (if (string-= match
=E2=94=82 =C2=A0 =C2=A0 =C2=A0"^\\([ ]*[=E2=84=9D>+= \\.][ ]?\\)+\\([[0-9]+\\|[ ]\\)" line)
=E2=94=82 =C2=A0 =C2= =A0 (substring line (match-end 1))
=E2=94=82 =C2=A0 line)
=E2=95=B0=E2=94=80=E2=94=80=E2=94=80= =E2=94=80

to this

=E2=95= =AD=E2=94=80=E2=94=80=E2=94=80=E2=94=80
=E2=94=82 (if (string-mat= ch
=E2=94=82 =C2=A0 =C2=A0 =C2=A0inferior-R-prompt line)
=E2=94=82 =C2=A0 =C2=A0 (substring line (match-end 1))
=E2=94=82 =C2=A0 line)
=E2=95=B0=E2=94=80=E2=94=80=E2=94=80=E2=94= =80

=E2=95=AD=E2=94=80=E2=94=80=E2=94=80=E2=94=80<= /div>
=E2=94=82 emacs-version
=E2=95=B0=E2=94=80=E2=94=80=E2= =94=80=E2=94=80

=E2=95=AD=E2=94=80=E2=94=80=E2=94= =80=E2=94=80
=E2=94=82 24.3.1
=E2=95=B0=E2=94=80=E2=94= =80=E2=94=80=E2=94=80

=E2=95=AD=E2=94=80=E2=94=80= =E2=94=80=E2=94=80
=E2=94=82 org-version
=E2=95=B0=E2=94=80=E2=94=80=E2=94=80=E2=94=80

=E2=95=AD=E2=94=80=E2=94=80=E2=94=80=E2=94=80
=E2=94=82 8.2.7c
=E2=95=B0=E2=94=80=E2=94=80=E2=94=80=E2=94=80

=
=E2=95=AD=E2=94=80=E2=94=80=E2=94=80=E2=94=80
=E2=94=82 ess-= version
=E2=95=B0=E2=94=80=E2=94=80=E2=94=80=E2=94=80
<= br>
=E2=95=AD=E2=94=80=E2=94=80=E2=94=80=E2=94=80
=E2= =94=82 14.06
=E2=95=B0=E2=94=80=E2=94=80=E2=94=80=E2=94=80
<= div>
Kind regards,


[patch= ]



Footnotes
=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80


--001a11348abc9db89f0501a70e1d--