diff options
author | Martyn Jago <martyn.jago@btinternet.com> | 2012-01-24 16:12:29 +0000 |
---|---|---|
committer | Eric Schulte <eric.schulte@gmx.com> | 2012-01-24 09:36:40 -0700 |
commit | c82ca2f19aada8c7aeae6a2a98a54df9741a620b (patch) | |
tree | 20bc871c102a7d0b03a150f8eb97f928a0f8aef7 | |
parent | b0eebd1ae1f147ef7922edab0ee8398ca4ed48f4 (diff) | |
download | org-mode-c82ca2f19aada8c7aeae6a2a98a54df9741a620b.tar.gz |
Fix `org-babel-result-end' command to provide consistent result removal where result is type `wrap'.
* lisp/ob.el:
Fix `org-babel-result-end' command to provide consistent result
removal where result is type `wrap'. Prior to this fix
multiple (org-ctrl-c-ctrl-c) commands will add multiple newlines to
the end of results (one newline per block execution).
This fixes the test `test-ob/org-babel-remove-result--results-wrap'
* testing/lisp/test-ob.el:
Uncomment test since it now passes.
-rw-r--r-- | lisp/ob.el | 3 | ||||
-rw-r--r-- | testing/lisp/test-ob.el | 28 |
2 files changed, 16 insertions, 15 deletions
@@ -1920,7 +1920,8 @@ code ---- the results are extracted in the syntax of the source (prvs (org-list-prevs-alist struct))) (org-list-get-list-end (point-at-bol) struct prvs))) ((looking-at "^\\([ \t]*\\):RESULTS:") - (re-search-forward (concat "^" (match-string 1) ":END:"))) + (progn (re-search-forward (concat "^" (match-string 1) ":END:")) + (forward-char 1) (point))) (t (let ((case-fold-search t)) (if (looking-at (concat "[ \t]*#\\+begin_\\([^ \t\n\r]+\\)")) diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el index 178556e..7dccd22 100644 --- a/testing/lisp/test-ob.el +++ b/testing/lisp/test-ob.el @@ -771,20 +771,20 @@ replacement happens correctly." * next heading")) -;; TODO FIXME Activate when Eric's trailing newline fix has been committed -;; (ert-deftest test-ob/org-babel-remove-result--results-wrap () -;; (test-ob-verify-result-and-removed-result -;; ":RESULTS: -;; hello there -;; :END:" -;; -;; "* org-babel-remove-result -;; -;; +begin_src emacs-lisp :results wrap -;; \"hello there\" -;; #+end_src -;; -;; * next heading")) +(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 + ":RESULTS: +hello there +:END:" + + "* org-babel-remove-result + +#+begin_src emacs-lisp :results wrap +\"hello there\" +#+end_src + +* next heading")) (ert-deftest test-ob/org-babel-remove-result--results-org () "Test `org-babel-remove-result' with :results org." |