branch: elpa/adoc-mode
commit 2b7c1ee8600b630741985e3b457d9f2d58df06bb
Author: Bozhidar Batsov <[email protected]>
Commit: Bozhidar Batsov <[email protected]>
Cache the attribute list element regex as a defconst
adoc-re-attribute-list-elt was a function that rebuilt the same regex
string on every call. Convert it to a defconst so the regex is
constructed once at load time.
---
adoc-mode.el | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/adoc-mode.el b/adoc-mode.el
index d9f2d5cb44..dc40e935f4 100644
--- a/adoc-mode.el
+++ b/adoc-mode.el
@@ -1334,13 +1334,7 @@ further tests to find a proper xref."
(t (error "unknown type"))))
-(defun adoc-re-attribute-list-elt ()
- "Returns a regexp matching an attribute list element.
-
-Subgroups:
-1 attribute name
-2 attribute value if given as string
-3 attribute value if not given as string"
+(defconst adoc-re-attribute-list-elt
(concat
",?[ \t\n]*"
"\\(?:\\([a-zA-Z_]+\\)[ \t\n]*=[ \t\n]*\\)?" ; 1
@@ -1349,7 +1343,13 @@ Subgroups:
;; Real "Unrolling-the-Loop" Pattern'.
"\"\\([^\"\\]*\\(?:\\\\.[^\"\\]*\\)*\\)\"[ \t\n]*" "\\|" ; 2
"\\([^,]+\\)" ; 3
- "\\)"))
+ "\\)")
+ "Regexp matching an attribute list element.
+
+Subgroups:
+1 attribute name
+2 attribute value if given as string
+3 attribute value if not given as string")
(defun adoc-re-precond (&optional unwanted-chars backslash-allowed
disallowed-at-bol)
(concat
@@ -1646,7 +1646,7 @@ text having adoc-reserved set to symbol `block-del'."
'face prop-of-attribute-list)
;; for each attribute in current attribute list
- (while (re-search-forward (adoc-re-attribute-list-elt)
attribute-list-end t)
+ (while (re-search-forward adoc-re-attribute-list-elt
attribute-list-end t)
(when (match-beginning 1); i.e. when it'a named attribute
;; get attribute's name
(setq pos-or-name-of-attribute