Prechádzať zdrojové kódy

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.
Nicolas Goaziou 6 rokov pred
rodič
commit
70dde3f617
1 zmenil súbory, kde vykonal 8 pridanie a 3 odobranie
  1. 8 3
      lisp/ob-core.el

+ 8 - 3
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]*"