From mboxrd@z Thu Jan 1 00:00:00 1970 From: Grant Rettke Subject: Re: [PATCH] ob-R.el: Add customizable R command primary prompt setting Date: Sat, 23 Aug 2014 08:52:19 -0500 Message-ID: References: <87zjevpptq.fsf@gmail.com> 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]:58625) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XLBjx-0005uZ-Bg for emacs-orgmode@gnu.org; Sat, 23 Aug 2014 09:52:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XLBjw-00032G-52 for emacs-orgmode@gnu.org; Sat, 23 Aug 2014 09:52:21 -0400 Received: from mail-ob0-x235.google.com ([2607:f8b0:4003:c01::235]:49511) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XLBjw-00032C-0J for emacs-orgmode@gnu.org; Sat, 23 Aug 2014 09:52:20 -0400 Received: by mail-ob0-f181.google.com with SMTP id va2so9158512obc.26 for ; Sat, 23 Aug 2014 06:52:19 -0700 (PDT) In-Reply-To: <87zjevpptq.fsf@gmail.com> 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" Gotcha. I wasn't tracking that thread. My desires was independent, I had just wanted supported for a non-standard prompt because my source block evaluation obviously quit working. Good to know it is addressed! Have a great day. Grant Rettke | ACM, ASA, FSF, IEEE, SIAM 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 On Sat, Aug 23, 2014 at 3:34 AM, Aaron Ecay wrote: > Hi Grant, > > We have some discussion of realted issues in the thread that starts at > . > > 2014ko abuztuak 22an, Grant Rettke-ek idatzi zuen: >> >> list/ob-R.el (org-babel-R-command-primary-prompt, >> org-babel-R-evaluate-session): Former adds customizable prompt value >> the latter utilizes it. >> >> 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. >> >> 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>"). >> >> TINYCHANGE >> --- >> lisp/ob-R.el | 6 ++++++ >> 1 file changed, 6 insertions(+) >> >> 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) >> >> +(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-= prompt "+\\.][ ]?\\)+\\([[0-9]+\\|[ ]\\)") line) > > I don=E2=80=99t think this does what you want it to: you=E2=80=99re inser= ting the > contents of the variable inside a regex character class (delimited by > []). > > See the patch I just sent > for a different > approach. > > -- > Aaron Ecay