From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: [PATCH][babel] add a string input to ob-octave Date: Thu, 06 Oct 2011 08:49:33 -0600 Message-ID: <87r52qi2m9.fsf@gmail.com> References: <87r52xmuri.fsf@gmail.com> <87bou1faqh.fsf@gmail.com> <8762k9szhf.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:45271) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RBpU3-0003bx-GS for emacs-orgmode@gnu.org; Thu, 06 Oct 2011 11:03:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RBpTy-0006by-9j for emacs-orgmode@gnu.org; Thu, 06 Oct 2011 11:03:39 -0400 Received: from mail-qy0-f169.google.com ([209.85.216.169]:59364) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RBpTy-0006bu-4K for emacs-orgmode@gnu.org; Thu, 06 Oct 2011 11:03:34 -0400 Received: by qyl38 with SMTP id 38so5856119qyl.0 for ; Thu, 06 Oct 2011 08:03:33 -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: Litvinov Sergey Cc: emacs-orgmode@gnu.org Fantastic, I will apply this as soon as your FSF attribution goes through. Speaking of has there been any progress on that front? Thanks -- Eric Litvinov Sergey writes: >> In other words, replacing (or var "nil") with var would be enough > > Thanks. Fixed in the patch below. The patch also adds an ert test. > > From b4b679abdc7bec9f3033b50f81d567a0bb48b147 Mon Sep 17 00:00:00 2001 > From: Litvinov Sergey > Date: Sat, 1 Oct 2011 13:37:56 +0200 > Subject: [PATCH 2/2] Remove redundant condition check in ob-octave.el. Add a test. > > --- > lisp/ob-octave.el | 4 ++-- > testing/examples/ob-octave-test.org | 6 ++++-- > testing/lisp/test-ob-octave.el | 6 ++++++ > 3 files changed, 12 insertions(+), 4 deletions(-) > > diff --git a/lisp/ob-octave.el b/lisp/ob-octave.el > index cfc1f1d..f840739 100644 > --- a/lisp/ob-octave.el > +++ b/lisp/ob-octave.el > @@ -119,9 +119,9 @@ specifying a variable of the same value." > (if (listp (car var)) "; " ",")) "]") > (cond > ((stringp var) > - (format "\'%s\'" (or var "nil"))) > + (format "\'%s\'" var)) > (t > - (format "%s" (or var "nil")))))) > + (format "%s" var))))) > > (defun org-babel-prep-session:octave (session params &optional matlabp) > "Prepare SESSION according to the header arguments specified in PARAMS." > diff --git a/testing/examples/ob-octave-test.org b/testing/examples/ob-octave-test.org > index 37cf3f9..97d9b00 100644 > --- a/testing/examples/ob-octave-test.org > +++ b/testing/examples/ob-octave-test.org > @@ -24,7 +24,6 @@ Input an integer variable > ans = s > #+end_src > > - > Input an array > #+begin_src octave :exports results :results silent :var s='(1.0 2.0 3.0) > ans = s > @@ -40,4 +39,7 @@ Input a string > ans = s(1:2) > #+end_src > > - > +Input elisp nil > +#+begin_src octave :exports results :results silent :var s='nil > +ans = s > +#+end_src > diff --git a/testing/lisp/test-ob-octave.el b/testing/lisp/test-ob-octave.el > index f3972ec..145266d 100644 > --- a/testing/lisp/test-ob-octave.el > +++ b/testing/lisp/test-ob-octave.el > @@ -53,3 +53,9 @@ > (org-babel-next-src-block 4) > (should (equal "te" (org-babel-execute-src-block))))) > > +(ert-deftest ob-octave/input-nil () > + "Input elisp nil" > + (org-test-at-id "cc2d82bb-2ac0-45be-a0c8-d1463b86a3ba" > + (org-babel-next-src-block 5) > + (should (equal nil (org-babel-execute-src-block))))) > + -- Eric Schulte http://cs.unm.edu/~eschulte/