summaryrefslogtreecommitdiff
path: root/lisp/org/ob-ref.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/org/ob-ref.el')
-rw-r--r--lisp/org/ob-ref.el21
1 files changed, 9 insertions, 12 deletions
diff --git a/lisp/org/ob-ref.el b/lisp/org/ob-ref.el
index de30a761293..872f7f98151 100644
--- a/lisp/org/ob-ref.el
+++ b/lisp/org/ob-ref.el
@@ -65,24 +65,21 @@
(declare-function org-show-context "org" (&optional key))
(declare-function org-trim "org" (s &optional keep-lead))
-(defvar org-babel-ref-split-regexp
- "[ \f\t\n\r\v]*\\(.+?\\)[ \f\t\n\r\v]*=[ \f\t\n\r\v]*\\(.+\\)[ \f\t\n\r\v]*")
-
(defvar org-babel-update-intermediate nil
"Update the in-buffer results of code blocks executed to resolve references.")
(defun org-babel-ref-parse (assignment)
"Parse a variable ASSIGNMENT in a header argument.
+
If the right hand side of the assignment has a literal value
-return that value, otherwise interpret as a reference to an
-external resource and find its value using
-`org-babel-ref-resolve'. Return a list with two elements. The
-first element of the list will be the name of the variable, and
-the second will be an emacs-lisp representation of the value of
-the variable."
- (when (string-match org-babel-ref-split-regexp assignment)
- (let ((var (match-string 1 assignment))
- (ref (match-string 2 assignment)))
+return that value, otherwise interpret it as a reference to an
+external resource and find its value using `org-babel-ref-resolve'.
+
+Return a list with two elements: the name of the variable, and an
+Emacs Lisp representation of the value of the variable."
+ (when (string-match "\\(.+?\\)=" assignment)
+ (let ((var (org-trim (match-string 1 assignment)))
+ (ref (org-trim (substring assignment (match-end 0)))))
(cons (intern var)
(let ((out (save-excursion
(when org-babel-current-src-block-location