From e3373f4beb16395f17e54c3494c0c7e53222ebcd Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Tue, 7 Apr 2020 01:21:33 +0200 Subject: [PATCH] ob-core: Properly replace results in special blocks * lisp/ob-core.el (org-babel-result-end): Handle results in special blocks. * testing/lisp/test-ob.el (test-ob/replace-special-block-result): New test. --- lisp/ob-core.el | 2 +- testing/lisp/test-ob.el | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lisp/ob-core.el b/lisp/ob-core.el index 9ab2fa920..4689a4723 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -2488,7 +2488,7 @@ in the buffer." (if (memq (org-element-type element) ;; Possible results types. '(drawer example-block export-block fixed-width item - plain-list src-block table)) + plain-list special-block src-block table)) (save-excursion (goto-char (min (point-max) ;for narrowed buffers (org-element-property :end element))) diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el index 97e1b49e7..fdd8a0da5 100644 --- a/testing/lisp/test-ob.el +++ b/testing/lisp/test-ob.el @@ -545,6 +545,17 @@ duplicate results block." (org-babel-next-src-block 1) (should (looking-at org-babel-src-block-regexp)))) +(ert-deftest test-ob/replace-special-block-result () + (should-error + (org-test-with-temp-text " +#+begin_src emacs-lisp :wrap special +'foo +#+end_src" + (org-babel-execute-src-block) + (org-babel-execute-src-block) + (buffer-string) + (search-forward "#+begin_special" nil nil 2)))) + (ert-deftest test-ob/catches-all-references () (org-test-with-temp-text " #+NAME: literal-example