diff --git a/lisp/org-babel-ref.el b/lisp/org-babel-ref.el index 31b22b2f0..c44bc3678 100644 --- a/lisp/org-babel-ref.el +++ b/lisp/org-babel-ref.el @@ -96,11 +96,12 @@ return nil." (when (string-match "^\\(.+?\\)\(\\(.*\\)\)$" ref) (setq new-refere (match-string 1 ref)) (setq new-referent (match-string 2 ref)) - ;; (message (format "first second %S -- %S" new-refere new-referent)) ;; debugging + (message (format "first second %S -- %S" new-refere new-referent)) ;; debugging (when (> (length new-refere) 0) (if (> (length new-referent) 0) (setq args (mapcar (lambda (ref) (cons :var ref)) (split-string new-referent ",[ \f\t\n\r\v]*")))) + (message "nested args = %S" args) (setq ref new-refere))) (when (string-match "\\(.+\\):\\(.+\\)" ref) (find-file (match-string 1 ref)) diff --git a/org-babel.org b/org-babel.org index 99f933679..26f42c018 100644 --- a/org-babel.org +++ b/org-babel.org @@ -263,7 +263,6 @@ in a test to ensure that we continue to test it as we move forward. I can take a look at implementing this once I get a chance. **** demonstration - After uncommenting the debugging statements located [[file:lisp/org-babel-ref.el::message%20format%20first%20second%20S%20S%20new%20refere%20new%20referent%20debugging][here]] and more importantly [[file:lisp/org-babel-ref.el::message%20nested%20args%20S%20args%20debugging][here]], we can see that the current reference code does evaluate the references correctly, and it uses the =:var= header @@ -271,23 +270,46 @@ argument to set =a=8=, however the default variables specified using the functional syntax in =adder(a=3, b=2)= is overriding this specification. -#+srcname: adder(a=3, b=2) +***** doesn't work with functional syntax + +#+srcname: adder-func(a=3, b=2) #+begin_src python a + b #+end_src -#+resname: adder +#+resname: adder-func : 5 - -#+srcname: after-adder(arg=adder(a=8)) +#+srcname: after-adder-func(arg=adder-func(a=8)) #+begin_src python arg #+end_src -#+resname: after-adder +#+resname: after-adder-func : 5 +***** still does work with =:var= syntax + +so it looks like regardless of the syntax used we're not overriding +the default argument values. + +#+srcname: adder-header +#+begin_src python :var a=3 :var b=2 +a + b +#+end_src + +#+resname: adder-header +: 5 + +#+srcname: after-adder-header +#+begin_src python :var arg=adder-header(a=8, b=0) +arg +#+end_src + +#+resname: after-adder-header +: 5 + + *** Parse tree algorithm Seeing as we're just trying to parse a string like f(a=1,b=g(c=2,d=3)) it shouldn't be too hard. But of course there