diff --git a/lisp/ob-core.el b/lisp/ob-core.el index a4b2294d7..ee66536bf 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 d1b3f333a..367c70f83 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")