mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-29 22:07:49 +00:00
so it looks like regardless of the syntax used we're not overriding
the default argument values.
This commit is contained in:
parent
a58dd8e3af
commit
53c08df3ae
|
@ -96,11 +96,12 @@ return nil."
|
||||||
(when (string-match "^\\(.+?\\)\(\\(.*\\)\)$" ref)
|
(when (string-match "^\\(.+?\\)\(\\(.*\\)\)$" ref)
|
||||||
(setq new-refere (match-string 1 ref))
|
(setq new-refere (match-string 1 ref))
|
||||||
(setq new-referent (match-string 2 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)
|
(when (> (length new-refere) 0)
|
||||||
(if (> (length new-referent) 0)
|
(if (> (length new-referent) 0)
|
||||||
(setq args (mapcar (lambda (ref) (cons :var ref))
|
(setq args (mapcar (lambda (ref) (cons :var ref))
|
||||||
(split-string new-referent ",[ \f\t\n\r\v]*"))))
|
(split-string new-referent ",[ \f\t\n\r\v]*"))))
|
||||||
|
(message "nested args = %S" args)
|
||||||
(setq ref new-refere)))
|
(setq ref new-refere)))
|
||||||
(when (string-match "\\(.+\\):\\(.+\\)" ref)
|
(when (string-match "\\(.+\\):\\(.+\\)" ref)
|
||||||
(find-file (match-string 1 ref))
|
(find-file (match-string 1 ref))
|
||||||
|
|
|
@ -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.
|
can take a look at implementing this once I get a chance.
|
||||||
|
|
||||||
**** demonstration
|
**** 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
|
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
|
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
|
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
|
the functional syntax in =adder(a=3, b=2)= is overriding this
|
||||||
specification.
|
specification.
|
||||||
|
|
||||||
#+srcname: adder(a=3, b=2)
|
***** doesn't work with functional syntax
|
||||||
|
|
||||||
|
#+srcname: adder-func(a=3, b=2)
|
||||||
#+begin_src python
|
#+begin_src python
|
||||||
a + b
|
a + b
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+resname: adder
|
#+resname: adder-func
|
||||||
: 5
|
: 5
|
||||||
|
|
||||||
|
#+srcname: after-adder-func(arg=adder-func(a=8))
|
||||||
#+srcname: after-adder(arg=adder(a=8))
|
|
||||||
#+begin_src python
|
#+begin_src python
|
||||||
arg
|
arg
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+resname: after-adder
|
#+resname: after-adder-func
|
||||||
: 5
|
: 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
|
*** Parse tree algorithm
|
||||||
Seeing as we're just trying to parse a string like
|
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
|
f(a=1,b=g(c=2,d=3)) it shouldn't be too hard. But of course there
|
||||||
|
|
Loading…
Reference in a new issue