From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aaron Ecay Subject: Re: [PATCH] ob-R.el: Add customizable R command primary prompt setting Date: Sat, 23 Aug 2014 04:34:09 -0400 Message-ID: <87zjevpptq.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46036) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XL6mA-0005JQ-Ga for emacs-orgmode@gnu.org; Sat, 23 Aug 2014 04:34:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XL6m4-0004hh-Gd for emacs-orgmode@gnu.org; Sat, 23 Aug 2014 04:34:18 -0400 Received: from mail-qc0-x22e.google.com ([2607:f8b0:400d:c01::22e]:35035) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XL6m4-0004hd-C1 for emacs-orgmode@gnu.org; Sat, 23 Aug 2014 04:34:12 -0400 Received: by mail-qc0-f174.google.com with SMTP id l6so11881158qcy.33 for ; Sat, 23 Aug 2014 01:34:11 -0700 (PDT) In-Reply-To: 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: Grant Rettke , "emacs-orgmode@gnu.org" Hi Grant, We have some discussion of realted issues in the thread that starts at . 2014ko abuztuak 22an, Grant Rettke-ek idatzi zuen: >=20 > list/ob-R.el (org-babel-R-command-primary-prompt, > org-babel-R-evaluate-session): Former adds customizable prompt value > the latter utilizes it. >=20 > My R prompt looks like this "=E2=84=9D> ". Babel needs to know more how = to > handle various situations so the > regex used in `org-babel-R-evaluate-session' to identify the prompt > looks like this "^\\([ ]*[=E2=84=9D>+\\.][ ]?\\)+\\([[0-9]+\\|[ ]\\)". > It is required to handle various R prompt situations correctly. It > may change over time to handle more situations. The > user doesn't need to know about those details. The user only cares > about the R prompt alone. For example, when > they set the prompt in R it looks like this =3Doptions(prompt=3D"=E2=84= =9D> ")=3D, > it is very simple. It should be this simple for bable, too. >=20 > This change adds a user customizable variable for the prompt from user > perspective `org-babel-R-command-primary-prompt'. That variable is > utilized in `org-babel-R-evaluate-session' where the full regular > expression to match the prompt is constructed. This makes it very > easy to handle a custom prompt since from the R side of things, the > value of `org-babel-R-command-primary-prompt' is the only thing that > the user needs to know to set. Via custom it looks like this > '(org-babel-R-command-primary-prompt "=E2=84=9D>"). >=20 > TINYCHANGE > --- > lisp/ob-R.el | 6 ++++++ > 1 file changed, 6 insertions(+) >=20 > diff --git a/lisp/ob-R.el b/lisp/ob-R.el > index 41b943c..1cb675b 100644 > --- a/lisp/ob-R.el > +++ b/lisp/ob-R.el > @@ -87,6 +87,11 @@ this variable.") > :version "24.1" > :type 'string) >=20 > +(defcustom org-babel-R-command-primary-prompt ">" > + "User configurable portion of the primary prompt." > + :group 'org-babel > + :type 'string) > + > (defvar ess-local-process-name) ; dynamically scoped > (defun org-babel-edit-prep:R (info) > (let ((session (cdr (assoc :session (nth 2 info))))) > @@ -413,6 +418,7 @@ last statement in BODY, as elisp." > (list body org-babel-R-eoe-indicator) > "\n")) > (inferior-ess-send-input)))))) "\n")))) > + (concat "^\\([ ]*[" org-babel-R-command-primary-p= rompt "+\\.][ ]?\\)+\\([[0-9]+\\|[ ]\\)") line) I don=E2=80=99t think this does what you want it to: you=E2=80=99re inserti= ng the contents of the variable inside a regex character class (delimited by []). See the patch I just sent for a different approach. --=20 Aaron Ecay