summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2013-06-30 17:46:32 -0600
committerEric Schulte <schulte.eric@gmail.com>2013-06-30 17:46:32 -0600
commit884f5ced1333b8836b4539fa914b903fa321988f (patch)
tree61da0ffd80eba971572abc920c2009329eab1752
parentbf5f896bc2b7cff7559c7e803900be771159b8bd (diff)
downloadorg-mode-884f5ced1333b8836b4539fa914b903fa321988f.tar.gz
named call lines insert results like code blocks
* lisp/ob-core.el (org-babel-find-named-result): Call lines are not results. (org-babel-where-is-src-block-result): Don't implicitly name the results of call lines. * lisp/ob-exp.el (org-babel-exp-non-block-elements): There is now another element on the call line info list. * lisp/ob-lob.el (org-babel-lob-get-info): Return the name (if any) at the end of the info list. (org-babel-lob-execute): Pass the name through to execution.
-rw-r--r--lisp/ob-core.el8
-rw-r--r--lisp/ob-exp.el2
-rw-r--r--lisp/ob-lob.el14
3 files changed, 15 insertions, 9 deletions
diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 4115912..ff268f4 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -1717,7 +1717,8 @@ buffer or nil if no such result exists."
(when (and (string= "name" (downcase (match-string 1)))
(or (beginning-of-line 1)
(looking-at org-babel-src-block-regexp)
- (looking-at org-babel-multi-line-header-regexp)))
+ (looking-at org-babel-multi-line-header-regexp)
+ (looking-at org-babel-lob-one-liner-regexp)))
(throw 'is-a-code-block (org-babel-find-named-result name (point))))
(beginning-of-line 0) (point))))))
@@ -1822,10 +1823,7 @@ following the source block."
(looking-at org-babel-lob-one-liner-regexp)))
(inlinep (when (org-babel-get-inline-src-block-matches)
(match-end 0)))
- (name (if on-lob-line
- (mapconcat #'identity (butlast (org-babel-lob-get-info))
- "")
- (nth 4 (or info (org-babel-get-src-block-info 'light)))))
+ (name (nth 4 (or info (org-babel-get-src-block-info 'light))))
(head (unless on-lob-line (org-babel-where-is-src-block-head)))
found beg end)
(when head (goto-char head))
diff --git a/lisp/ob-exp.el b/lisp/ob-exp.el
index 12aa380..d237655 100644
--- a/lisp/ob-exp.el
+++ b/lisp/ob-exp.el
@@ -217,7 +217,7 @@ this template."
(concat
":var results="
(mapconcat 'identity
- (butlast lob-info)
+ (butlast lob-info 2)
" ")))))))
"" nil (car (last lob-info)))
'lob))
diff --git a/lisp/ob-lob.el b/lisp/ob-lob.el
index f9b7b4c..d37940a 100644
--- a/lisp/ob-lob.el
+++ b/lisp/ob-lob.el
@@ -114,12 +114,20 @@ if so then run the appropriate source block from the Library."
(or (funcall nonempty 8 19) ""))
(funcall nonempty 9 18)))
(list (length (if (= (length (match-string 12)) 0)
- (match-string 2) (match-string 11)))))))))
+ (match-string 2) (match-string 11)))
+ (save-excursion
+ (forward-line -1)
+ (and (looking-at (concat org-babel-src-name-regexp
+ "\\([^\n]*\\)$"))
+ (org-no-properties (match-string 1))))))))))
(defvar org-babel-default-header-args:emacs-lisp) ; Defined in ob-emacs-lisp.el
(defun org-babel-lob-execute (info)
"Execute the lob call specified by INFO."
- (let* ((mkinfo (lambda (p) (list "emacs-lisp" "results" p nil nil (nth 2 info))))
+ (let* ((mkinfo (lambda (p)
+ (list "emacs-lisp" "results" p nil
+ (nth 3 info) ;; name
+ (nth 2 info))))
(pre-params (apply #'org-babel-merge-params
org-babel-default-header-args
org-babel-default-header-args:emacs-lisp
@@ -130,7 +138,7 @@ if so then run the appropriate source block from the Library."
(org-no-properties
(concat
":var results="
- (mapconcat #'identity (butlast info)
+ (mapconcat #'identity (butlast info 2)
" "))))))))
(pre-info (funcall mkinfo pre-params))
(cache-p (and (cdr (assoc :cache pre-params))