diff options
author | Martyn Jago <martyn.jago@btinternet.com> | 2012-01-24 16:12:29 +0000 |
---|---|---|
committer | Eric Schulte <eric.schulte@gmx.com> | 2012-02-19 08:27:56 -0700 |
commit | 50a35c42dbc1df91c69cf9bcf03fc72cc3a518d7 (patch) | |
tree | 489c560617aca4f4124b5611fa1f79598acbd784 | |
parent | d2a0a5378b6777a6145be4df19ccc2a9719e9002 (diff) | |
download | org-mode-50a35c42dbc1df91c69cf9bcf03fc72cc3a518d7.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.
Conflicts:
testing/lisp/test-ob.el
-rw-r--r-- | lisp/ob.el | 3 | ||||
-rw-r--r-- | testing/lisp/test-ob.el | 108 |
2 files changed, 110 insertions, 1 deletions
@@ -1921,7 +1921,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) (blocks-re (regexp-opt diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el index 3c6b27d..5de3e69 100644 --- a/testing/lisp/test-ob.el +++ b/testing/lisp/test-ob.el @@ -618,6 +618,114 @@ on two lines (buffer-substring-no-properties (point-min) (point-max))))))) +(ert-deftest test-ob/org-babel-remove-result--results-default () + "Test `org-babel-remove-result' with default :results." + (mapcar (lambda (language) + (test-ob-verify-result-and-removed-result + "\n" + (concat +"* org-babel-remove-result +#+begin_src " language " +#+end_src + +* next heading"))) + '("sh" "emacs-lisp"))) + +(ert-deftest test-ob/org-babel-remove-result--results-list () + "Test `org-babel-remove-result' with :results list." + (test-ob-verify-result-and-removed-result + "- 1 +- 2 +- 3 +- (quote (4 5))" + +"* org-babel-remove-result +#+begin_src emacs-lisp :results list +'(1 2 3 '(4 5)) +#+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." + (test-ob-verify-result-and-removed-result + "#+BEGIN_ORG +* heading +** subheading +content +#+END_ORG" + +"* org-babel-remove-result +#+begin_src emacs-lisp :results org +\"* heading +** subheading +content\" +#+end_src + +* next heading")) + +(ert-deftest test-ob/org-babel-remove-result--results-html () + "Test `org-babel-remove-result' with :results html." + (test-ob-verify-result-and-removed-result + "#+BEGIN_HTML +<head><body></body></head> +#+END_HTML" + +"* org-babel-remove-result +#+begin_src emacs-lisp :results html +\"<head><body></body></head>\" +#+end_src + +* next heading")) + +(ert-deftest test-ob/org-babel-remove-result--results-latex () + "Test `org-babel-remove-result' with :results latex." + (test-ob-verify-result-and-removed-result + "#+BEGIN_LaTeX +Line 1 +Line 2 +Line 3 +#+END_LaTeX" + +"* org-babel-remove-result +#+begin_src emacs-lisp :results latex +\"Line 1 +Line 2 +Line 3\" +#+end_src + +* next heading")) + +(ert-deftest test-ob/org-babel-remove-result--results-code () + "Test `org-babel-remove-result' with :results code." + + (test-ob-verify-result-and-removed-result + "#+BEGIN_SRC emacs-lisp +\"I am working!\" +#+END_SRC" + +"* org-babel-remove-result +#+begin_src emacs-lisp :results code +(message \"I am working!\") +#+end_src + +* next heading")) + (ert-deftest test-org-babel/inline-src_blk-preceded-by-letter () "Test inline source block invalid where preceded by letter" |