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.
This commit is contained in:
Nicolas Goaziou 2013-08-21 12:24:17 +02:00
parent 927f1bd5e9
commit 6fdc2361c9
2 changed files with 15 additions and 1 deletions

View File

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

View File

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