summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <eric.schulte@gmx.com>2012-03-27 07:09:22 -0400
committerEric Schulte <eric.schulte@gmx.com>2012-03-27 07:09:22 -0400
commitdbe4bf805f3a50f0c47036e556606de1366a947a (patch)
tree4e40d5c61330517623f72d0b372776aca229c046
parente7a3dd375051c0c3868a7918ce8f0d381a51cc1b (diff)
downloadorg-mode-dbe4bf805f3a50f0c47036e556606de1366a947a.tar.gz
fix bug in indented wrapped results insertion
* lisp/ob.el (org-babel-insert-result): Fix bug in indented wrapped results insertion. * testing/lisp/test-ob.el (test-ob/org-babel-results-indented-wrap): Test correct indentation behavior.
-rw-r--r--lisp/ob.el3
-rw-r--r--testing/lisp/test-ob.el13
2 files changed, 15 insertions, 1 deletions
diff --git a/lisp/ob.el b/lisp/ob.el
index 4601e73..09c9961 100644
--- a/lisp/ob.el
+++ b/lisp/ob.el
@@ -1838,7 +1838,8 @@ code ---- the results are extracted in the syntax of the source
(flet ((wrap (start finish)
(goto-char end) (insert (concat finish "\n"))
(goto-char beg) (insert (concat start "\n"))
- (goto-char end) (setq end (point-marker)))
+ (goto-char end) (goto-char (point-at-eol))
+ (setq end (point-marker)))
(proper-list-p (it) (and (listp it) (null (cdr (last it))))))
;; insert results based on type
(cond
diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el
index 3f4186e..8fba224 100644
--- a/testing/lisp/test-ob.el
+++ b/testing/lisp/test-ob.el
@@ -699,6 +699,19 @@ replacement happens correctly."
* next heading"))
+(ert-deftest test-ob/org-babel-results-indented-wrap ()
+ "Ensure that wrapped results are inserted correction when indented.
+If not inserted correctly then the second evaluation will fail
+trying to find the :END: marker."
+ (org-test-with-temp-text
+ "- indented
+ #+begin_src sh :results file wrap
+ echo test.txt
+ #+end_src"
+ (org-babel-next-src-block 1)
+ (org-babel-execute-src-block)
+ (org-babel-execute-src-block)))
+
(ert-deftest test-ob/org-babel-remove-result--results-wrap ()
"Test `org-babel-remove-result' with :results wrap."
(test-ob-verify-result-and-removed-result