* textmodes/reftex-vars.el (reftex-label-alist-builtin): Add

support for the lstlisting and minted environments, and for the
ctable macro.
* textmodes/reftex.el (reftex-compile-variables): Also recognize
labels written in keyvals syntax.
This commit is contained in:
Tassilo Horn 2012-07-27 09:59:50 +02:00
parent eeaea51562
commit 86332df22a
3 changed files with 27 additions and 2 deletions

View file

@ -1,3 +1,11 @@
2012-07-27 Tassilo Horn <tsdh@gnu.org>
* textmodes/reftex-vars.el (reftex-label-alist-builtin): Add
support for the lstlisting and minted environments, and for the
ctable macro.
* textmodes/reftex.el (reftex-compile-variables): Also recognize
labels written in keyvals syntax.
2012-07-27 Jay Belanger <jay.p.belanger@gmail.com>
* calc/calccomp.el (math-compose-expr): Use parentheses when

View file

@ -122,7 +122,14 @@
;;("\\label{*}" nil nil nil nil)
))
)
(ctable "The ctable package"
(("\\ctable[]{}{}{}" ?t "tab:" "\\ref{%s}" 1 ("table" "Tabelle"))))
(listings "The listings package"
(("lstlisting" ?l "lst:" "~\\ref{%s}" nil (regexp "[Ll]isting"))))
(minted "The minted package"
(("minted" ?l "lst:" "~\\ref{%s}" nil (regexp "[Ll]isting")))))
"The default label environment descriptions.
Lower-case symbols correspond to a style file of the same name in the LaTeX
distribution. Mixed-case symbols are convenience aliases.")

View 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\\)[]}]"))