summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2019-08-22 10:03:56 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2019-08-22 10:03:56 +0200
commit4848b8b9aaee7cc66ffca8dd9b5f15b54f6fd0c3 (patch)
tree6617d31bd6900ffa75be5778bc7bb996027d4753
parenta72466ce8dbc15b3a214156483e7b6d28c275c1a (diff)
downloadorg-mode-4848b8b9aaee7cc66ffca8dd9b5f15b54f6fd0c3.tar.gz
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>
-rw-r--r--lisp/ob-core.el2
-rw-r--r--testing/lisp/test-ob.el26
2 files changed, 27 insertions, 1 deletions
diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index a4b2294..ee66536 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -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)
diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el
index d1b3f33..367c70f 100644
--- a/testing/lisp/test-ob.el
+++ b/testing/lisp/test-ob.el
@@ -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")