diff options
author | Nicolas Goaziou <n.goaziou@gmail.com> | 2013-08-21 12:24:17 +0200 |
---|---|---|
committer | Nicolas Goaziou <n.goaziou@gmail.com> | 2013-08-21 14:16:28 +0200 |
commit | 6fdc2361c93d2f77bcc81b479b6d68d57bd268a2 (patch) | |
tree | e93199bc5ec36ab7516d420b0fb064bfe0938de8 | |
parent | 927f1bd5e9c6aa22082ce2a3add0c30b7dd95ce1 (diff) | |
download | org-mode-6fdc2361c93d2f77bcc81b479b6d68d57bd268a2.tar.gz |
ob-core: Fix wrong indentation of results
* lisp/ob-core.el (org-babel-get-src-block-info): Look for indentation
value at the correct location.
* testing/lisp/test-ob.el: Add test.
-rw-r--r-- | lisp/ob-core.el | 2 | ||||
-rw-r--r-- | testing/lisp/test-ob.el | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/lisp/ob-core.el b/lisp/ob-core.el index 578a52d..8fa0c13 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -258,7 +258,7 @@ Returns a list (save-excursion (goto-char head) (setq info (org-babel-parse-src-block-match)) - (setq indent (nth 5 info)) + (setq indent (car (last info))) (setq info (butlast info)) (while (and (forward-line -1) (looking-at org-babel-multi-line-header-regexp)) diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el index 1192589..93c026b 100644 --- a/testing/lisp/test-ob.el +++ b/testing/lisp/test-ob.el @@ -1167,6 +1167,20 @@ echo \"$data\" (goto-char (match-beginning 0)) (org-babel-execute-src-block)))))) +(ert-deftest test-ob/preserve-results-indentation () + "Preserve indentation when executing a src block." + (should + (equal '(2 2) + (org-test-with-temp-text + " #+begin_src emacs-lisp\n (+ 1 1)\n #+end_src" + (org-babel-execute-src-block) + (buffer-string) + (let ((case-fold-search t)) (search-forward "#+results:")) + ;; Check if both #+RESULTS: keyword and actual results are + ;; indented by 2 columns. + (list (org-get-indentation) + (progn (forward-line) (org-get-indentation))))))) + (provide 'test-ob) ;;; test-ob ends here |