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
This commit is contained in:
parent
d2a0a5378b
commit
50a35c42db
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
Loading…
Reference in New Issue