* Bug: ob-ref.el table indexing broken [7.8.11 (release_7.8.11-515-g5f1fc2.dirty]
[not found] <1383925928.17590575.1345053091810.JavaMail.root@cds013>
@ 2012-08-15 17:55 ` Ivars Finvers
2012-08-16 6:14 ` Bastien
0 siblings, 1 reply; 2+ messages in thread
From: Ivars Finvers @ 2012-08-15 17:55 UTC (permalink / raw)
To: emacs-orgmode
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)
^ permalink raw reply related [flat|nested] 2+ messages in thread