From mboxrd@z Thu Jan 1 00:00:00 1970 From: Litvinov Sergey Subject: Re: [PATCH][babel] add a string input to ob-octave Date: Sat, 01 Oct 2011 13:49:48 +0200 Message-ID: <8762k9szhf.fsf@gmail.com> References: <87r52xmuri.fsf@gmail.com> <87bou1faqh.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:37885) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R9y4x-0003zq-Oe for emacs-orgmode@gnu.org; Sat, 01 Oct 2011 07:50:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R9y4w-000729-UB for emacs-orgmode@gnu.org; Sat, 01 Oct 2011 07:50:03 -0400 Received: from lo.gmane.org ([80.91.229.12]:42288) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R9y4w-00071z-GR for emacs-orgmode@gnu.org; Sat, 01 Oct 2011 07:50:02 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1R9y4v-0007tY-1l for emacs-orgmode@gnu.org; Sat, 01 Oct 2011 13:50:01 +0200 Received: from e181030083.adsl.alicedsl.de ([85.181.30.83]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 01 Oct 2011 13:50:00 +0200 Received: from slitvinov by e181030083.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 01 Oct 2011 13:50:00 +0200 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 --=-=-= Content-Type: text/plain > 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. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0002-Remove-redundant-condition-check-in-ob-octave.el.-Ad.patch >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))))) + -- 1.7.4.1 --=-=-=--