From: Tassilo Horn Date: Fri, 27 Jul 2012 07:59:50 +0000 (+0200) Subject: * textmodes/reftex-vars.el (reftex-label-alist-builtin): Add X-Git-Tag: emacs-24.2.90~1061 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=86332df22ae3934334c7ced64aa6aedd5767b121;p=emacs.git * 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. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 99d41ee19bc..a91d5a2ea98 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2012-07-27 Tassilo Horn + + * 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 * calc/calccomp.el (math-compose-expr): Use parentheses when diff --git a/lisp/textmodes/reftex-vars.el b/lisp/textmodes/reftex-vars.el index 4c875a35b3e..187c98af21f 100644 --- a/lisp/textmodes/reftex-vars.el +++ b/lisp/textmodes/reftex-vars.el @@ -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.") diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el index 8c349a2e20a..c2270323843 100644 --- a/lisp/textmodes/reftex.el +++ b/lisp/textmodes/reftex.el @@ -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\\)[]}]"))