]> code.delx.au - gnu-emacs/blobdiff - lisp/textmodes/reftex.el
* textmodes/reftex-vars.el (reftex-label-alist-builtin): Add
[gnu-emacs] / lisp / textmodes / reftex.el
index 8c349a2e20a0c614aba6c30b58950f352feb355c..c22703238435c4c9a7d3c738f380507a02a74550 100644 (file)
@@ -1284,7 +1284,15 @@ This enforces rescanning the buffer on next use."
 ;          (wbol "\\(\\`\\|[\n\r]\\)[ \t]*")
            (wbol "\\(^\\)[ \t]*")  ; Need to keep the empty group because
                                   ;;; because match number are hard coded
-           (label-re "\\\\label{\\([^}]*\\)}")
+           (label-re (concat "\\(?:"
+                            ;; Normal \label{...}
+                            "\\\\label{\\([^}]*\\)}"
+                            "\\|"
+                            ;; keyvals [..., label = {foo}, ...]
+                            ;; forms used by ctable, listings,
+                            ;; minted, ...
+                            "\\[[^]]*label[[:space:]]*=[[:space:]]*{?\\(?1:[^],}]+\\)}?[^[]*\\]"
+                            "\\)"))
            (include-re (concat wbol
                                "\\\\\\("
                                (mapconcat 'identity
@@ -1312,6 +1320,8 @@ This enforces rescanning the buffer on next use."
                     "\\)\\([[{][^]}]*[]}]\\)*[[{]\\(%s\\)[]}]"))
            (find-label-re-format
             (concat "\\("
+                   "\\[[^]]*label[[:space:]]*=[[:space:]]*{?\\(?1:[^],}]+\\)}?[^[]*\\]"
+                   "\\|"
                     (mapconcat 'regexp-quote (append '("\\label")
                                                      macros-with-labels) "\\|")
                     "\\)\\([[{][^]}]*[]}]\\)*[[{]\\(%s\\)[]}]"))