diff --git a/contrib/babel/lisp/org-babel-lob.el b/contrib/babel/lisp/org-babel-lob.el index 4ea3078b0..06c310ac3 100644 --- a/contrib/babel/lisp/org-babel-lob.el +++ b/contrib/babel/lisp/org-babel-lob.el @@ -100,6 +100,7 @@ the word 'call'." (defun org-babel-lob-execute (info) (let ((params (org-babel-merge-params org-babel-default-header-args + (org-babel-params-from-buffer) (org-babel-params-from-properties) (org-babel-parse-header-arguments (org-babel-clean-text-properties diff --git a/contrib/babel/lisp/org-babel.el b/contrib/babel/lisp/org-babel.el index ae362320f..d7cd6be07 100644 --- a/contrib/babel/lisp/org-babel.el +++ b/contrib/babel/lisp/org-babel.el @@ -108,6 +108,9 @@ header arguments as well.") '((:session . "none") (:results . "silent") (:exports . "results")) "Default arguments to use when evaluating an inline source block.") +(defvar org-babel-current-buffer-properties) +(make-variable-buffer-local 'org-babel-current-buffer-properties) + (defvar org-babel-src-block-regexp nil "Regexp used to test when inside of a org-babel src-block") @@ -610,6 +613,20 @@ may be specified in the properties of the current outline entry." (setq sym (intern (concat "org-babel-header-arg-names:" lang))) (and (boundp sym) (eval sym)))))))))) +(defun org-babel-params-from-buffer () + "Return an association list of any source block params which +may be specified at the top of the current buffer." + (or org-babel-current-buffer-properties + (setq org-babel-current-buffer-properties + (save-excursion + (save-restriction + (widen) + (goto-char (point-min)) + (when (re-search-forward + (org-make-options-regexp (list "BABEL")) nil t) + (org-babel-parse-header-arguments + (org-match-string-no-properties 2)))))))) + (defun org-babel-parse-src-block-match () (let* ((block-indentation (length (match-string 1))) (lang (org-babel-clean-text-properties (match-string 2))) @@ -627,6 +644,7 @@ may be specified in the properties of the current outline entry." (buffer-string))) (org-babel-merge-params org-babel-default-header-args + (org-babel-params-from-buffer) (org-babel-params-from-properties lang) (if (boundp lang-headers) (eval lang-headers) nil) (org-babel-parse-header-arguments @@ -642,6 +660,7 @@ may be specified in the properties of the current outline entry." (org-babel-clean-text-properties (match-string 5))) (org-babel-merge-params org-babel-default-inline-header-args + (org-babel-params-from-buffer) (org-babel-params-from-properties lang) (if (boundp lang-headers) (eval lang-headers) nil) (org-babel-parse-header-arguments