babel: variables can now accept null literal values

* lisp/babel/ob-exp.el (org-babel-exp-results): now checking to see if
  return value of `org-babel-ref-literal' is equal to the null
  indicator flag -- meaning it's now possible to accept a value of
  null

* lisp/babel/ob-ref.el (org-babel-ref-parse):  now checking to see if
  return value of `org-babel-ref-literal' is equal to the null
  indicator flag -- meaning it's now possible to accept a value of
  null

  (org-babel-ref-literal): now returning a null indicator flag when
  the value is *not* a literal value, meaning it is possible to pass
  in a literal value of null
This commit is contained in:
Eric Schulte 2010-06-23 15:57:38 -07:00
parent 6da29f1519
commit b6e9c6a996
2 changed files with 8 additions and 4 deletions

View File

@ -245,7 +245,8 @@ results into the buffer."
(if (and org-current-export-file
(eq (car pair) :var)
(string-match org-babel-ref-split-regexp (cdr pair))
(null (org-babel-ref-literal (match-string 2 (cdr pair)))))
(equal :ob-must-be-reference
(org-babel-ref-literal (match-string 2 (cdr pair)))))
`(:var . ,(concat (match-string 1 (cdr pair))
"=" org-current-export-file
":" (match-string 2 (cdr pair))))

View File

@ -83,8 +83,10 @@ emacs-lisp representation of the value of the variable."
(let ((var (match-string 1 assignment))
(ref (match-string 2 assignment)))
(cons (intern var)
(or (org-babel-ref-literal ref)
(org-babel-ref-resolve-reference ref params))))))
((lambda (val)
(if (equal :ob-must-be-reference val)
(org-babel-ref-resolve-reference ref params)
val)) (org-babel-ref-literal ref))))))
(defun org-babel-ref-literal (ref)
"Determine if the right side of a header argument variable
@ -95,7 +97,8 @@ return nil."
(let ((out (org-babel-read ref)))
(if (equal out ref)
(if (string-match "^\".+\"$" ref)
(read ref))
(read ref)
:ob-must-be-reference)
out)))
(defvar org-babel-library-of-babel)