emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ivars Finvers <ifinvers@shaw.ca>
To: emacs-orgmode@gnu.org
Subject: Bug: ob-ref.el table indexing broken [7.8.11 (release_7.8.11-515-g5f1fc2.dirty]
Date: Wed, 15 Aug 2012 11:55:20 -0600 (MDT)	[thread overview]
Message-ID: <2037286474.17591117.1345053320833.JavaMail.root@cds013> (raw)
In-Reply-To: <1383925928.17590575.1345053091810.JavaMail.root@cds013>

Hi,

After updating my org-mode setup to 7.8.11 I noticed that row and column
indexing no longer worked when accessing table data in a code block call. 

An example is:

#+name: test-data
| 10 | 20 | 30 | 40 |
| 11 | 21 | 31 | 41 |
| 12 | 22 | 32 | 42 |

#+begin_src python  :results output raw :var data=test-data[,0:1]
  print data
#+end_src

#+RESULTS:
[[10, 20, 30, 40], [11, 21, 31, 41], [12, 22, 32, 42]]

The correct result should be:

#+RESULTS:
[[10, 20], [11, 21], [12, 22]]

I noticed that a change was recently made to the ob-ref.el file to
remove org-flet usage. After some work with the elisp debugger I believe
the problem occurs due to a mis-aligned closing parenthesis in the
org-babel-ref-index-list function.

The following patch appears to fix the problem (but I don't fully 
understand the function, so there may be some unintended consequences):

diff --git a/lisp/ob-ref.el b/lisp/ob-ref.el
index d223589..05f3ea0 100644
--- a/lisp/ob-ref.el
+++ b/lisp/ob-ref.el
@@ -240,8 +240,8 @@ to \"0:-1\"."
                           (funcall wrap (string-to-number (match-string 2 portion)))
                           (funcall wrap (string-to-number (match-string 3 portion))))
                        (list (funcall wrap 0) (funcall wrap -1)))))
-           (list (nth (funcall wrap (string-to-number portion)) lis)))))))
-  lis)
+           (list (nth (funcall wrap (string-to-number portion)) lis))))))
+  lis))

 (defun org-babel-ref-split-args (arg-string)
   "Split ARG-STRING into top-level arguments of balanced parenthesis."
--

Thanks.

Ivars

Emacs  : GNU Emacs 23.3.1 (x86_64-unknown-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2011-10-19 
Package: Org-mode version 7.8.11 (release_7.8.11-515-g5f1fc2.dirty)

       reply	other threads:[~2012-08-15 17:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1383925928.17590575.1345053091810.JavaMail.root@cds013>
2012-08-15 17:55 ` Ivars Finvers [this message]
2012-08-16  6:14   ` Bug: ob-ref.el table indexing broken [7.8.11 (release_7.8.11-515-g5f1fc2.dirty] Bastien

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=2037286474.17591117.1345053320833.JavaMail.root@cds013 \
    --to=ifinvers@shaw.ca \
    --cc=emacs-orgmode@gnu.org \
    /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).