diff --git a/lisp/ob-core.el b/lisp/ob-core.el index 4dcfbd3b0..0be19ff06 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -194,15 +194,17 @@ This string must include a \"%s\" which will be replaced by the results." :package-version '(Org . "9.1") :safe #'booleanp) -(defun org-babel-noweb-wrap (&optional regexp) +(defun org-babel-noweb-wrap (&optional regexp info) "Return regexp matching a Noweb reference. Match any reference, or only those matching REGEXP, if non-nil. When matching, reference is stored in match group 1." - (concat (regexp-quote org-babel-noweb-wrap-start) + (concat (regexp-quote (or (cdr (assq :noweb-start (nth 2 info))) + org-babel-noweb-wrap-start)) (or regexp "\\([^ \t\n]\\(?:.*?[^ \t\n]\\)?\\)") - (regexp-quote org-babel-noweb-wrap-end))) + (regexp-quote (or (cdr (assq :noweb-end (nth 2 info))) + org-babel-noweb-wrap-end)))) (defvar org-babel-src-name-regexp "^[ \t]*#\\+name:[ \t]*" @@ -3116,7 +3118,7 @@ block but are passed literally to the \"example-block\"." (not (equal (cdr v) "no")))))) (noweb-re (format "\\(.*?\\)\\(%s\\)" (with-current-buffer parent-buffer - (org-babel-noweb-wrap))))) + (org-babel-noweb-wrap nil info))))) (unless (equal (cons parent-buffer (with-current-buffer parent-buffer (buffer-chars-modified-tick)))