* textmodes/reftex-vars.el (reftex-label-regexps): New defcustom.
authorTassilo Horn <tsdh@gnu.org>
Mon, 15 Apr 2013 07:55:05 +0000 (09:55 +0200)
committerTassilo Horn <tsdh@gnu.org>
Mon, 15 Apr 2013 07:55:05 +0000 (09:55 +0200)
* textmodes/reftex.el (reftex-compile-variables): Use it.

lisp/ChangeLog
lisp/textmodes/reftex-vars.el
lisp/textmodes/reftex.el

index b0997a3..34711b7 100644 (file)
@@ -1,3 +1,9 @@
+2013-04-15  Tassilo Horn  <tsdh@gnu.org>
+
+       * textmodes/reftex-vars.el (reftex-label-regexps): New defcustom.
+
+       * textmodes/reftex.el (reftex-compile-variables): Use it.
+
 2013-04-14  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * files.el (normal-mode): Only use default major-mode if no other mode
index 2a5c9c5..c00cf36 100644 (file)
@@ -863,6 +863,20 @@ DOWNCASE    t:   Downcase words before using them."
                          (string :tag ""))
                 (option (boolean :tag "Downcase words          "))))
 
+(defcustom reftex-label-regexps
+  '(;; Normal \\label{foo} labels
+    "\\\\label{\\(?1:[^}]*\\)}"
+    ;; keyvals [..., label = {foo}, ...] forms used by ctable,
+    ;; listings, minted, ...
+    "\\[[^]]*\\<label[[:space:]]*=[[:space:]]*{?\\(?1:[^],}]+\\)}?")
+  "List of regexps matching \\label definitions.
+The default value matches usual \\label{...} definitions and
+keyval style [..., label = {...}, ...] label definitions.  It is
+assumed that the regexp group 1 matches the label text, so you
+have to define it using \\(?1:...\\) when adding new regexps."
+  :group 'reftex-defining-label-environments
+  :type '(repeat (regexp :tag "Regular Expression")))
+
 (defcustom reftex-label-illegal-re "[^-a-zA-Z0-9_+=:;,.]"
   "Regexp matching characters not valid in labels."
   :group 'reftex-making-and-inserting-labels
index d5bb017..21083fd 100644 (file)
@@ -1081,13 +1081,7 @@ This enforces rescanning the buffer on next use."
            (wbol "\\(^\\)[ \t]*") ; Need to keep the empty group because
                                   ; match numbers are hard coded
            (label-re (concat "\\(?:"
-                            ;; Normal \label{...}
-                            "\\\\label{\\([^}]*\\)}"
-                            "\\|"
-                            ;; keyvals [..., label = {foo}, ...]
-                            ;; forms used by ctable, listings,
-                            ;; minted, ...
-                            "\\[[^]]*label[[:space:]]*=[[:space:]]*{?\\(?1:[^],}]+\\)}?"
+                            (mapconcat 'identity reftex-label-regexps "\\|")
                             "\\)"))
            (include-re (concat wbol
                                "\\\\\\("