diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2016-02-11 00:32:07 +0100 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2016-02-11 00:32:07 +0100 |
commit | 94dfa7fa9c4d1cb3ba943214ac9698bbe2627f10 (patch) | |
tree | 2cb1df3d7d314da145ef527fc90df584a01a1b09 | |
parent | a00af53e6e65ffd68bbb3b716403098e414d82bf (diff) | |
download | org-mode-94dfa7fa9c4d1cb3ba943214ac9698bbe2627f10.tar.gz |
ob-lob: Improve `org-babel-lob-get-info' consistency
* lisp/ob-lob.el (org-babel-lob-get-info): Make the function on par with
`org-babel-get-src-block-info' by providing the beginning position of
Babel code.
(org-babel-lob-execute):
* lisp/ob-exp.el (org-babel-exp-process-buffer):
(org-babel-exp-results): Handle new data.
-rw-r--r-- | lisp/ob-exp.el | 6 | ||||
-rw-r--r-- | lisp/ob-lob.el | 15 |
2 files changed, 13 insertions, 8 deletions
diff --git a/lisp/ob-exp.el b/lisp/ob-exp.el index bb57e44..2e49a46 100644 --- a/lisp/ob-exp.el +++ b/lisp/ob-exp.el @@ -217,9 +217,9 @@ may make them unreachable." (concat ":var results=" (mapconcat #'identity - (butlast lob-info) + (butlast lob-info 2) " "))))))) - "" (nth 2 lob-info)) + "" (nth 2 lob-info) (nth 3 lob-info)) 'lob)) (rep (org-fill-template org-babel-exp-call-line-template @@ -412,7 +412,7 @@ inhibit insertion of results into the buffer." (org-babel-execute-src-block nil info)) (`lob (save-excursion - (goto-char (org-element-property :begin (org-element-context))) + (goto-char (nth 5 info)) (let (org-confirm-babel-evaluate) (org-babel-execute-src-block nil info)))))))))) diff --git a/lisp/ob-lob.el b/lisp/ob-lob.el index 5b32ef8..98aa602 100644 --- a/lisp/ob-lob.el +++ b/lisp/ob-lob.el @@ -82,15 +82,19 @@ if so then run the appropriate source block from the Library." "Return a Library of Babel function call as a string. Return nil when not on an appropriate location. Build string from `inline-babel-call' or `babel-call' DATUM, when provided." - (let ((context (or datum (org-element-context)))) - (when (memq (org-element-type context) '(babel-call inline-babel-call)) + (let* ((context (or datum (org-element-context))) + (type (org-element-type context))) + (when (memq type '(babel-call inline-babel-call)) (list (format "%s%s(%s)" (org-element-property :call context) (let ((in (org-element-property :inside-header context))) (if in (format "[%s]" in) "")) (or (org-element-property :arguments context) "")) (org-element-property :end-header context) - (org-element-property :name context))))) + (org-element-property :name context) + (org-element-property + (if (eq type 'babel-call) :post-affiliated :begin) + datum))))) (defvar org-babel-default-header-args:emacs-lisp) ; Defined in ob-emacs-lisp.el (defun org-babel-lob-execute (info) @@ -98,7 +102,8 @@ from `inline-babel-call' or `babel-call' DATUM, when provided." (let* ((mkinfo (lambda (p) ;; Make plist P compatible with ;; `org-babel-get-src-block-info'. - (list "emacs-lisp" "results" p nil (nth 2 info)))) + (list + "emacs-lisp" "results" p nil (nth 2 info) (nth 3 info)))) (pre-params (apply #'org-babel-merge-params org-babel-default-header-args @@ -109,7 +114,7 @@ from `inline-babel-call' or `babel-call' DATUM, when provided." (org-babel-parse-header-arguments (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)) (string= "yes" (cdr (assoc :cache pre-params))))) |