summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2019-02-04 18:01:04 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2019-02-04 18:02:38 +0100
commit70dde3f6174c701f7712cd77eb522a65dbcd2b52 (patch)
tree1165b580b69a5ff8494c770234878fc9a61f76d8
parent69c9f632f4cd6738083160b4a9ee9a93b6567925 (diff)
downloadorg-mode-70dde3f6174c701f7712cd77eb522a65dbcd2b52.tar.gz
ob-core: Fix Noweb reference regexp
* lisp/ob-core.el (org-babel-noweb-wrap): Fix regexp, which could not match 2 character long references. Add docstring.
-rw-r--r--lisp/ob-core.el11
1 files changed, 8 insertions, 3 deletions
diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 3992686..9ac998d 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -175,9 +175,14 @@ This string must include a \"%s\" which will be replaced by the results."
:safe #'booleanp)
(defun org-babel-noweb-wrap (&optional regexp)
- (concat org-babel-noweb-wrap-start
- (or regexp "\\([^ \t\n].+?[^ \t]\\|[^ \t\n]\\)")
- org-babel-noweb-wrap-end))
+ "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)
+ (or regexp "\\([^ \t\n]\\(?:.*?[^ \t\n]\\)?\\)")
+ (regexp-quote org-babel-noweb-wrap-end)))
(defvar org-babel-src-name-regexp
"^[ \t]*#\\+name:[ \t]*"