diff --git a/lisp/ob-lob.el b/lisp/ob-lob.el index 81533b41b..0f9a27910 100644 --- a/lisp/ob-lob.el +++ b/lisp/ob-lob.el @@ -59,7 +59,8 @@ To add files to this list use the `org-babel-lob-ingest' command." (assq-delete-all source-name org-babel-library-of-babel)) lob-ingest-count (1+ lob-ingest-count))))) (message "%d src block%s added to Library of Babel" - lob-ingest-count (if (> lob-ingest-count 1) "s" "")))) + lob-ingest-count (if (> lob-ingest-count 1) "s" "")) + lob-ingest-count)) (defconst org-babel-lob-call-aliases '("lob" "call") "Aliases to call a source block function. diff --git a/lisp/ob.el b/lisp/ob.el index c51f68a5d..aa2552e5b 100644 --- a/lisp/ob.el +++ b/lisp/ob.el @@ -175,22 +175,20 @@ Returns a list (setq info (org-babel-parse-src-block-match)) (setq indent (car (last info))) (setq info (butlast info)) - (forward-line -1) - (when (looking-at org-babel-src-name-w-name-regexp) - (setq name (org-babel-clean-text-properties (match-string 3))) - (when (match-string 5) - (setf (nth 2 info) ;; merge functional-syntax vars and header-args - (org-babel-merge-params - (mapcar (lambda (ref) (cons :var ref)) - (org-babel-ref-split-args (match-string 5))) - (nth 2 info))))) - (goto-char head) (while (and (forward-line -1) (looking-at org-babel-multi-line-header-regexp)) (setf (nth 2 info) (org-babel-merge-params (org-babel-parse-header-arguments (match-string 1)) - (nth 2 info))))) + (nth 2 info)))) + (when (looking-at org-babel-src-name-w-name-regexp) + (setq name (org-babel-clean-text-properties (match-string 4))) + (when (match-string 5) + (setf (nth 2 info) ;; merge functional-syntax vars and header-args + (org-babel-merge-params + (mapcar (lambda (ref) (cons :var ref)) + (org-babel-ref-split-args (match-string 5))) + (nth 2 info)))))) ;; inline source block (when (save-excursion (re-search-backward "[ \f\t\n\r\v]" nil t) (looking-at org-babel-inline-src-block-regexp)) @@ -1549,11 +1547,13 @@ parameters when merging lists." (:var (let ((name (if (listp (cdr pair)) (cadr pair) - (string-match - "^\\([^= \f\t\n\r\v]+\\)[ \t]*=" - (cdr pair)) - (intern (match-string 1 (cdr pair)))))) - (unless (member name (mapcar #'car vars)) + (and + (string-match + "^\\([^= \f\t\n\r\v]+\\)[ \t]*=" + (cdr pair)) + (intern (match-string 1 (cdr pair))))))) + (when (and name + (not (member name (mapcar #'car vars)))) (setq vars (cons (cons name (cdr pair)) vars))))) (:results (setq results diff --git a/testing/lisp/test-ob-lob.el b/testing/lisp/test-ob-lob.el new file mode 100644 index 000000000..546166324 --- /dev/null +++ b/testing/lisp/test-ob-lob.el @@ -0,0 +1,31 @@ +;;; test-ob-lob.el + +;; Copyright (c) 2010 Eric Schulte +;; Authors: Eric Schulte + +;; Released under the GNU General Public License version 3 +;; see: http://www.gnu.org/licenses/gpl-3.0.html + +;;;; Comments: + +;; Template test file for Org-mode tests + + +;;; Code: +(let ((load-path (cons (expand-file-name + ".." (file-name-directory + (or load-file-name buffer-file-name))) + load-path))) + (require 'org-test) + (require 'org-test-ob-consts)) + + +;;; Tests +(ert-deftest test-ob-lob/ingest () + "Test the ingestion of an org-mode file." + (should (< 0 (org-babel-lob-ingest + (expand-file-name "babel.org" org-test-example-dir))))) + +(provide 'test-ob-lob) + +;;; test-ob-lob.el ends here