0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-09-29 21:37:50 +00:00

ob: Preserve comma escaping when inserting results

* lisp/ob-core.el (org-babel-insert-result): Fix typo
* testing/lisp/test-ob.el (test-ob/preserve-comma-escape): New test.

Reported-by: "Berry, Charles" <ccberry@ucsd.edu>
<http://lists.gnu.org/r/emacs-orgmode/2019-08/msg00250.html>
This commit is contained in:
Nicolas Goaziou 2019-08-22 10:03:56 +02:00
parent a72466ce8d
commit 4848b8b9aa
2 changed files with 27 additions and 1 deletions

View file

@ -2307,7 +2307,7 @@ INFO may provide the values of these header arguments (in the
(setq start inline-start)
(setq finish inline-finish)
(setq no-newlines t))
(let ((before-finish (marker-position end)))
(let ((before-finish (copy-marker end)))
(goto-char end)
(insert (concat finish (unless no-newlines "\n")))
(goto-char beg)

View file

@ -1532,6 +1532,32 @@ echo \"$data\"
(buffer-substring-no-properties (line-beginning-position)
(point-max)))))))
(ert-deftest test-ob/preserve-comma-escape ()
"Preserve comma escapes when inserting results."
(should
(equal
"#+begin_example
line 1
,* headline 2
,* headline 3
,* headline 4
,* headline 5
#+end_example
"
(org-test-with-temp-text "#+begin_src emacs-lisp :wrap example
\"line 1
,* headline 2
,* headline 3
,* headline 4
,* headline 5
\"
#+end_src
"
(org-babel-execute-src-block)
(let ((case-fold-search t)) (search-forward "result" nil t))
(downcase (buffer-substring-no-properties (line-beginning-position 2)
(point-max)))))))
(ert-deftest test-ob/safe-header-args ()
"Detect safe and unsafe header args."
(let ((safe-args '((:cache . "foo")