From b6e9c6a996f848d85e14fd910c6d1d4bec7b8c63 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Wed, 23 Jun 2010 15:57:38 -0700 Subject: [PATCH] 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 --- lisp/babel/ob-exp.el | 3 ++- lisp/babel/ob-ref.el | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lisp/babel/ob-exp.el b/lisp/babel/ob-exp.el index a12f2795f..c6a4f4936 100644 --- a/lisp/babel/ob-exp.el +++ b/lisp/babel/ob-exp.el @@ -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)))) diff --git a/lisp/babel/ob-ref.el b/lisp/babel/ob-ref.el index 36bbcbd21..df8a0338e 100644 --- a/lisp/babel/ob-ref.el +++ b/lisp/babel/ob-ref.el @@ -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)