emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: Litvinov Sergey <slitvinov@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH][babel] add a string input to ob-octave
Date: Thu, 06 Oct 2011 08:49:33 -0600	[thread overview]
Message-ID: <87r52qi2m9.fsf@gmail.com> (raw)
In-Reply-To: 8762k9szhf.fsf@gmail.com

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 <slitvinov@gmail.com> 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 <slitvinov@gmail.com>
> 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	other threads:[~2011-10-06 15:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-01  0:16 [PATCH][babel] add a string input to ob-octave Litvinov Sergey
2011-10-01  7:10 ` Nicolas Goaziou
2011-10-01 11:49   ` Litvinov Sergey
2011-10-06 14:49     ` Eric Schulte [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r52qi2m9.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=slitvinov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).