emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [PATCH][babel] add a string input to ob-octave


From: Eric Schulte
Subject: Re: [O] [PATCH][babel] add a string input to ob-octave
Date: Thu, 06 Oct 2011 08:49:33 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

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 <address@hidden> 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 <address@hidden>
> 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/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]