From 05ef2ae7cc544b75023efb069fd26e9abbc09cf4 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Thu, 20 Jan 2011 14:59:13 +0000 Subject: [PATCH] ob: Allow babel settings to be made in multiple #+babel: lines * lisp/ob.el (org-babel-params-from-buffer): Process all #+babel: lines in the buffer --- lisp/ob.el | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/lisp/ob.el b/lisp/ob.el index 202a8219f..7485a3b72 100644 --- a/lisp/ob.el +++ b/lisp/ob.el @@ -856,18 +856,20 @@ may be specified in the properties of the current outline entry." (defun org-babel-params-from-buffer () "Retrieve per-buffer parameters. Return an association list of any source block params which -may be specified at the top of the current buffer." +may be specified in the current buffer." (or org-babel-current-buffer-properties - (setq org-babel-current-buffer-properties - (save-match-data - (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))))))))) + (save-match-data + (save-excursion + (save-restriction + (widen) + (goto-char (point-min)) + (while (re-search-forward + (org-make-options-regexp (list "BABEL")) nil t) + (setq org-babel-current-buffer-properties + (org-babel-merge-params + org-babel-current-buffer-properties + (org-babel-parse-header-arguments + (org-match-string-no-properties 2)))))))))) (defvar org-src-preserve-indentation) (defun org-babel-parse-src-block-match ()