emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: "George Kettleborough (EI)" <george.kettleborough@earlham.ac.uk>
Cc: emacs-orgmode@gnu.org
Subject: Re: ob-shell: using a table variable with bash
Date: Wed, 08 Mar 2017 09:24:30 +0100	[thread overview]
Message-ID: <8737eo2n29.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <1811afdb-ffe4-37e7-9858-19b22d7ff2ed@earlham.ac.uk> (George Kettleborough's message of "Fri, 3 Mar 2017 12:40:54 +0000")

Hello,

"George Kettleborough (EI)" <george.kettleborough@earlham.ac.uk> writes:

> I recently updated my org-mode from version 7 (I think) to the latest. 
> The behaviour of using a table as a variable in a shell code source 
> block has changed. I use to use it like this:
>
> #+BEGIN_SRC sh :results output :var table=synteny-names :separator ,
>    IFS=','
>    while read col1 col2; do
>        # do stuff
>    done <<EOF
>    $table
>    EOF
> #+END_SRC
>
> This just stopped working with the new version and I could not figure 
> out why for a long time. But I looked in the new ob-shell.el code and 
> figured out that when the shell is bash it now makes an associative 
> array if the variable is a table. I couldn't seem to find this 
> documented anywhere.
>
> This new behaviour seems like it would be useful in a lot of cases, but 
> in my case, the tables are not key-value pairs, they are merely things I 
> want to iterate over. I wonder if simply checking to see if :separator 
> is set and using the old behaviour if so would be better? This would 
> seem to be a fine fix which maintains backwards compatibility unless 
> there is a reason to set :separator but still expect the new
> behaviour.

I have no objection to this patch, but I think it needs to be
documented, if only as a code comment. IIRC, there is also some
documentation about "ob-shell" on Worg. It would be nice to document
this feature.

Also, could you provide a proper commit message?

Thank you.

Regards,

-- 
Nicolas Goaziou

  reply	other threads:[~2017-03-08 10:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-03 12:40 ob-shell: using a table variable with bash George Kettleborough (EI)
2017-03-08  8:24 ` Nicolas Goaziou [this message]
2017-03-08 11:27   ` George Kettleborough

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=8737eo2n29.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=george.kettleborough@earlham.ac.uk \
    /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).