mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-11-23 07:18:53 +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:
parent
a72466ce8d
commit
4848b8b9aa
@ -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)
|
||||
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user