From 44bb82d38e75edf856224ae7df3570e2bcc44274 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Sat, 24 Apr 2010 13:26:34 -0600 Subject: [PATCH] babel: `org-babel-ref-resolve-reference' doesn't break paren nesting when resolving indicies --- contrib/babel/lisp/org-babel-ref.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/contrib/babel/lisp/org-babel-ref.el b/contrib/babel/lisp/org-babel-ref.el index 8eb200f7c..e508e8b8d 100644 --- a/contrib/babel/lisp/org-babel-ref.el +++ b/contrib/babel/lisp/org-babel-ref.el @@ -98,8 +98,10 @@ return nil." (let ((case-fold-search t) type args new-refere new-referent result lob-info split-file split-ref index index-row index-col) - ;; if ref is indexed grab the indices - (when (string-match "\\[\\(.+\\)\\]" ref) + ;; if ref is indexed grab the indices -- beware nested indicies + (when (and (string-match "\\[\\(.+\\)\\]" ref) + (let ((str (substring ref 0 (match-beginning 0)))) + (= (count ?( str) (count ?) str)))) (setq index (match-string 1 ref)) (setq ref (substring ref 0 (match-beginning 0)))) ;; assign any arguments to pass to source block