1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-25 07:27:57 +00:00

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.
This commit is contained in:
Nicolas Goaziou 2016-02-11 00:32:07 +01:00
parent a00af53e6e
commit 94dfa7fa9c
2 changed files with 13 additions and 8 deletions

View File

@ -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))))))))))

View File

@ -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)))))