From e18415d02c9f1009816407bbceddb3351861f78e Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Mon, 9 Mar 2020 23:10:04 +0100 Subject: [PATCH] ob: Fix case when replacing Noweb reference * lisp/ob-core.el (org-babel-expand-noweb-references): Use FIXEDCASE. * testing/lisp/test-ob.el (test-ob/noweb-expansion): Add test. Reported-by: Sebastian Miele --- lisp/ob-core.el | 2 +- testing/lisp/test-ob.el | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lisp/ob-core.el b/lisp/ob-core.el index fb23c2f3e..b9f274650 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -2812,7 +2812,7 @@ block but are passed literally to the \"example-block\"." (mapconcat #'identity (split-string expansion "[\n\r]") (concat "\n" prefix)))))) - body nil t 2))) + body t t 2))) (defun org-babel--script-escape-inner (str) (let (in-single in-double backslash out) diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el index 97e1b49e7..2d66e73fa 100644 --- a/testing/lisp/test-ob.el +++ b/testing/lisp/test-ob.el @@ -782,6 +782,18 @@ x * C #+begin_src emacs-lisp :noweb-ref foo C +#+end_src" + (org-babel-expand-noweb-references)))) + ;; Preserve case when replacing Noweb reference. + (should + (equal "(ignore)" + (org-test-with-temp-text " +#+begin_src emacs-lisp :noweb-ref AA +\(ignore) +#+end_src + +#+begin_src emacs-lisp :noweb yes +<> #+end_src" (org-babel-expand-noweb-references)))))