Index: auctex.texi =================================================================== RCS file: /sources/auctex/auctex/doc/auctex.texi,v retrieving revision 1.314 diff -u -u -r1.314 auctex.texi --- auctex.texi 4 Dec 2012 08:01:34 -0000 1.314 +++ auctex.texi 13 Jan 2013 20:51:06 -0000 @@ -12,7 +12,7 @@ (version @value{VERSION} from @value{UPDATED}), a sophisticated TeX environment for Emacs. -Copyright @copyright{} 1992-1995, 2001, 2002, 2004-2012 +Copyright @copyright{} 1992-1995, 2001, 2002, 2004-2013 Free Software Foundation, Inc. @quotation @@ -3812,6 +3812,7 @@ @cindex Adding macros @cindex Macros, adding @cindex Defining macros in style hooks address@hidden Adding completion for arguments in macros The most common thing to define in a style hook is new symbols (@TeX{} macros). Most likely along with a description of the arguments to the @@ -3999,6 +4000,67 @@ hooks have been processed, set the value of @code{exit-mark}. It will point nowhere, until the argument hook sets it. address@hidden TeX-complete-list +List of regular expressions matching @TeX{} macro definitions. +Subexpressions will be completed. address@hidden defvar + +The list has the following format ((REGEXP MATCH TABLE END) @dots{}), that +is, each entry is a list with four elements. + +REGEXP . Regular expression matching the macro we want to provide +argument completion for. + +MATCH . A number in the subexpression to try completion for. + +TABLE . The list with symbols to offer completion from. See below for a +list of tables that @AUCTeX provides by default. + +END . Text to insert after successful completion. Most often, this is +just a curly bracket. + +The following example is taken from @file{varioref.el} address@hidden +;; Install completion for labels +(setq TeX-complete-list + (append + '(("\\\\[Vv]ref{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-label-list "}") + ("\\\\vref\\*?{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-label-list "}") + ("\\\\Ref{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-label-list "}") + ("\\\\vref\\*{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-label-list "}") + ("\\\\fullref{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-label-list "}") + ("\\\\vpageref\\*?\\(\\[[^]]*\\]\\)*{\\([^{}\n\r\\%,]*\\)" + 2 LaTeX-label-list "}")) + TeX-complete-list) address@hidden lisp + +By default, @AUCTeX defines the following lists that can be used for +completion. + address@hidden @code + address@hidden LaTeX-label-list +List of labels. + address@hidden LaTeX-bibitem-list +List of bibliography entries. + address@hidden LaTeX-environment-list +List of names for environments defined in style files, and in the +document. + address@hidden LaTeX-symbol-list +List of names for commands defined in the document, and in the style +files. + address@hidden LaTeX-style-list +List of styles available for documentclass. + address@hidden LaTeX-auto-index-entry +Index entries in the document. + address@hidden vtable + @node Adding Environments @subsection Adding Support for Environments @cindex Adding environments @@ -4033,6 +4095,17 @@ @code{LaTeX-add-environments}. The fact that an argument is optional can be indicated by wrapping the prompt string in a vector. address@hidden LaTeX-after-insert-env-hooks nil +List of functions to run after having inserting an environment. Each +function in the hook has the form (ENV BEGIN END) + +ENV . Name of the environment just inserted + +BEGIN . The buffer position right before @samp{\begin{env}} starts. + +END . Position right before @samp{\end{env}}. address@hidden defvar + For example, if you have defined a @code{loop} environment with the three arguments @var{from}, @var{to}, and @var{step}, you can add support for them in a style file. @@ -4137,6 +4210,17 @@ @end lisp @end ftable +For lists, @AUCTeX has the @code{LaTeX-item-list} which associates an +environment name with a function that is called when the list is +inserted to insert the first item, and when new items are added. The +following example is taken from @file{latex.el}. The function address@hidden just inserts a new @code{bibitem}. + address@hidden +(setq LaTeX-item-list '(("description" . LaTeX-item-argument) + ("thebibliography" . LaTeX-item-bib))) address@hidden lisp + @node Adding Other @subsection Adding Other Information @cindex Adding bibliographies @@ -4247,7 +4331,7 @@ @defvar TeX-auto-regexp-list List of regular expressions matching @TeX{} macro definitions. -The list has the following format ((REGEXP MATCH TABLE) @dots{}), that +The list has the following format ((REEXP MATCH TABLE) @dots{}), that is, each entry is a list with three elements. REGEXP. Regular expression matching the macro we want to parse.