Hi, I have made some new style files for some packages, including cleveref and enumerate. It's enjoyable to code them, and a nice way to learn some emacs lisp :-) I previously sent memoir.el some weeks ago, but think it was overlooked, so I'm resubmitting it.
Since I missed mentioning of `LaTeX-after-insert-env-hooks' and
`TeX-complete-list', I have two paragraphs that describe this to
auctex.texi. I also included a brief example of LaTeX-item-list. I
tried to copy and paste from similar paragraphs to get the writing style
as the rest of the manual. Could somebody please have a look at it, and
possibly rewrite it to fit the style of the rest of manual? I think I
added the things to the logical places. Thank you.
I get an error about char-or-string-p when running enumerate.el, and I'm
not sure why. I wanted to experiment a bit with
LaTeX-after-insert-env-hooks, and am well aware that adding an optional
argument in a new definition would override the previous definition. I
didn't find emacs's debug information particular helpful.
Some style files were updated with new commands/symbols, and some new
regexes for the `TeX-complete-list'. This goes for listings.el (I sent
a patch without a changelog entry a couple of weeks ago) and varioref.el
which has the new commands from after 1999, including regexes for the
completion, plus a few new options.
The TODO file mentioned that it would be nice to have completion for
counters; as `TeX-arg-counter' includes a definition argument, it was
quite simple to fix this. However, it required a new variable which
style files for document classes can append to, e.g., book has part and
chapter which are not included in article. I'm in doubt whether LaTeX
has any native savebox/sbox defined (other than @tempa and @tempb which
are internal). Since there is also a definition argument, it shouldn't
be difficult to append this at some point.
ChangeLog entries are attached in changelog.txt for all new work. The
ChangeLog file has mixed 2013-01-11 and 2013-01-10, as Mose Giordano has
two entries under 2013-01-10 in two different places.
Please keep me in CC.
--
Med Venlig Hilsen / Kind Regards,
Mads Jensen
Rubinsteinsvej 31,st.th
DK-2450 Kbh. SV
Denmark
+45 6168 8518
My brain is my second favorite organ.
-- Woody Allen
;;; enumerate.el --- AUCTeX style for `enumerate.sty' ;; Copyright (C) 2013 Free Software Foundation, Inc. ;; Author: Mads Jensen <[email protected]> ;; Maintainer: [email protected] ;; Keywords: tex ;; This file is part of AUCTeX. ;; AUCTeX is free software; you can redistribute it and/or modify it ;; under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 3, or (at your option) ;; any later version. ;; AUCTeX is distributed in the hope that it will be useful, but ;; WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;; General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with AUCTeX; see the file COPYING. If not, write to the Free ;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ;; 02110-1301, USA. ;;; Commentary: ;; This file adds support for `enumerate.sty' ;;; Code: (TeX-add-style-hook "enumerate" (lambda () ;; enumerate just offers the oppertunity to modify how the ;; enumeration in the enumerate environment takes place (add-hook 'LaTeX-after-insert-env-hooks 'LaTeX-enumerate-after-insert-env-hook))) (defun LaTeX-enumerate-after-insert-env-hook (env start end) "Hook to insert the formatting string for the enumerate environment" (when (string-equal env "enumerate") (let ((fmt (read-string (TeX-argument-prompt t "Formatting string for the environment" nil)))) (when (not (zerop (string-width fmt))) (TeX-argument-insert fmt t))))) (defvar LaTeX-enumerate-package-options nil "Package options for enumerate.") ;; enumerate.el ends here
865a866,869
> (defvar LaTeX-pstricks-package-options
> '("97" "plain" "DIA" "vtex" "distiller" "noxcolor")
> "Package options for pstricks.")
>
Index: listings.el =================================================================== RCS file: /sources/auctex/auctex/style/listings.el,v retrieving revision 1.14 diff -u -u -r1.14 listings.el --- listings.el 13 Apr 2009 16:54:55 -0000 1.14 +++ listings.el 13 Jan 2013 09:40:15 -0000 @@ -1,6 +1,6 @@ ;;; listings.el --- AUCTeX style for `listings.sty' -;; Copyright (C) 2004, 2005, 2009 Free Software Foundation, Inc. +;; Copyright (C) 2004, 2005, 2009, 2013 Free Software Foundation, Inc. ;; Author: Ralf Angeli <[email protected]> ;; Maintainer: [email protected] @@ -33,8 +33,7 @@ ;;; Code: ;; The following are options taken from chapter 4 of the listings -;; manual (2006/05/08 Version 1.3c). Experimental options described -;; in chapter 5 are not included. +;; manual (2007/02/22 Version 1.4). (defvar LaTeX-listings-key-val-options '(;; Space and placement ("float" ("t" "b" "p" "h")) ; Support [*] as an optional prefix and that @@ -102,6 +101,7 @@ ("caption") ; Insert braces? ("label") ("nolol" ("true" "false")) + ("numberbychapter" ("true" "false")) ("captionpos" ("t" "b")) ; Can be a subset of tb. ("abovecaptionskip") ("belowcaptionskip") @@ -141,8 +141,9 @@ ("deleteindex") ("indexstyle") ;; Column alignment - ("columns" ("fixed" "flexible" "fullflexible")) ; Also supports an optional - ; argument with {c,l,r}. + ("columns" ("fixed" "flexible" "fullflexible" "spaceflexible")) ; + ; Also supports an optional + ; argument with {c,l,r}. ("flexiblecolumns" ("true" "false")) ("keepspaces" ("true" "false")) ("basewidth") @@ -185,7 +186,35 @@ ("morekeywordcomment") ("deletekeywordcomment") ("keywordcommentsemicolon") - ("podcomment" ("true" "false"))) + ("podcomment" ("true" "false")) + ;; The following are all options from chapter 5, which are + ;; experimental + ;; Export of identifiers + ("procnamekeys") + ("moreprocnamekeys") + ("deleteprocnamekeys") + ("procnamestyle") + ("indexprocnames" ("true" "false")) + ;; Hyperlink references + ("hyperref") + ("morehyperref") + ("deletehyperref") + ("hyperanchor") + ("hyperlink") + ;; Literate programming + ("literate") ;; three arguments: replace,replacement text,length + ;; LGrind definitions + ("lgrindef") + ;; Arbitrary linerange markers + ("rangebeginprefix") + ("rangebeginsuffix") + ("rangeendprefix") + ("rangeendsuffix") + ("rangeprefix") + ("rangesuffix") + ("includerangemarker" ("true" "false")) + ;; Multicolumn Listing + ("multicolumn")) "Key=value options for listings macros and environments.") (TeX-add-style-hook @@ -202,7 +231,15 @@ "lstlistoflistings" '("lstnewenvironment" "Name" ["Number or arguments"] ["Default argument"] "Starting code" "Ending code") - '("lstset" (TeX-arg-key-val LaTeX-listings-key-val-options))) + '("lstset" (TeX-arg-key-val LaTeX-listings-key-val-options)) + '("lstloadlanguages" t) + ;; 4.17 Short Inline Listing Commands + '("lstMakeShortInline" [ "Options" ] "Character") + '("lstDeleteShortLine" "Character") + + "lstgrinddeffile" "lstaspectfiles" "lstlanguagefiles" + "lstlistingname" "lstlistlistingname") + ;; New environments (LaTeX-add-environments '("lstlisting" LaTeX-env-args @@ -237,7 +274,10 @@ (font-lock-set-defaults)))) (defvar LaTeX-listings-package-options '("draft" "final" "savemem" - "noaspects") + "noaspects" + ;; procnames is mentioned in + ;; Section 5.2 + "procnames") "Package options for the listings package.") ;;; listings.el ends here
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 13:21:18 -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
+@cindex 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,65 @@
hooks have been processed, set the value of @code{exit-mark}. It will
point nowhere, until the argument hook sets it.
+@defvar TeX-complete-list
+List of regular expressions matching @TeX{} macro definitions.
+Subexpressions will be completed.
+@end 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 or list of numbers to try completion for, in that
+order.
+
+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.
+
+@c update this example with the new regular expressions
+The following example is taken from @file{varioref.el}
+@lisp
+;; Install completion for labels
+(setq TeX-complete-list
+ (append
+ '(("\\\\vref{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-label-list "}")
+ ("\\\\vpageref\\(\\[[^]]*\\]\\)*{\\([^{}\n\r\\%,]*\\)"
+ 2 LaTeX-label-list "}")
+ TeX-complete-list))
+@end lisp
+
+By default, @AUCTeX defines the following lists that can be used for
+completion.
+
+@vtable @code
+
+@item LaTeX-label-list
+List of labels.
+
+@item LaTeX-bibitem-list
+List of bibliography entries.
+
+@item LaTeX-environment-list
+List of names for environments defined in style files, and in the
+document.
+
+@item LaTeX-symbol-list
+List of names for commands defined in the document, and in the style
+files.
+
+@item LaTeX-style-list
+List of styles available for documentclass.
+
+@item LaTeX-auto-index-entry
+Index entries in the document.
+
+@end vtable
+
@node Adding Environments
@subsection Adding Support for Environments
@cindex Adding environments
@@ -4033,6 +4093,17 @@
@code{LaTeX-add-environments}. The fact that an argument is optional
can be indicated by wrapping the prompt string in a vector.
+@defvar 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}}.
+@end 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 +4208,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
+@code{LaTeX-item-bib} just inserts a new @code{bibitem}.
+
+@lisp
+(setq LaTeX-item-list '(("description" . LaTeX-item-argument)
+ ("thebibliography" . LaTeX-item-bib)))
+@end lisp
+
@node Adding Other
@subsection Adding Other Information
@cindex Adding bibliographies
@@ -4247,7 +4329,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.
Index: varioref.el =================================================================== RCS file: /sources/auctex/auctex/style/varioref.el,v retrieving revision 1.5 diff -u -u -r1.5 varioref.el --- varioref.el 3 Feb 2008 14:53:28 -0000 1.5 +++ varioref.el 13 Jan 2013 20:34:23 -0000 @@ -1,8 +1,9 @@ ;;; varioref.el --- AUCTeX style file with support for varioref.sty -;; Copyright (C) 1999 Free Software Foundation, Inc. +;; Copyright (C) 1999, 2013 Free Software Foundation, Inc. ;; Author: Carsten Dominik <[email protected]> +;; Mads Jensen <[email protected]> ;; Maintainer: [email protected] ;; This file is part of AUCTeX. @@ -26,38 +27,52 @@ (TeX-add-style-hook "varioref" (lambda () - + (TeX-add-symbols ;; The macros with label arguments '("vref" TeX-arg-label) - '("vpageref" [ "Same page text" ] [ "different page text" ] TeX-arg-label) + '("Vref" TeX-arg-label) + '("vrefrange" [ "Same page text" ] TeX-arg-label TeX-arg-label) + '("vrefrange*" [ "Same page text" ] TeX-arg-label TeX-arg-label) + '("vref*" TeX-arg-label) + '("Vref" TeX-arg-label) + '("Ref" TeX-arg-label) + '("vpageref" [ "Same page text" ] [ "Different page text" ] TeX-arg-label) + '("vpageref*" [ "Same page text" ] [ "Different page text" ] + TeX-arg-label) '("fullref" TeX-arg-label) + '("labelformat" TeX-arg-counter t) + + '("vpagerefrange" [ "Same page text" ] TeX-arg-label TeX-arg-label) + '("vpagerefrange*" [ "Same page text" ] TeX-arg-label TeX-arg-label) ;; And the other macros used for customization "reftextbefore" "reftextfacebefore" - "reftextafter" "reftextfaceafter" - "reftextfaraway" "vreftextvario" "vrefwarning") + "reftextafter" "reftextfaceafter" "reftexlabelrange" + "reftextfaraway" "vreftextvario" "vrefwarning" + "vpagerefnum" "vrefshowerrors") - ;; Install completion for labels + ;; Install completion for labels. Only offer completion for + ;; commands that take only one reference as an argument (setq TeX-complete-list (append - '(("\\\\vref{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-label-list "}") - ("\\\\vpageref\\(\\[[^]]*\\]\\)*{\\([^{}\n\r\\%,]*\\)" + '(("\\\\[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)))) -(defvar LaTeX-varioref-package-options '("draft" "final" "afrikaans" - "american" "austrian" "naustrian" - "brazil" "breton" "catalan" "croatian" - "czech" "danish" "dutch" "english" - "esperanto" "finnish" "french" - "galician" "german" "ngerman" "greek" - "italian" "magyar" "norsk" "nynorsk" - "polish" "portuges" "romanian" - "russian" "slovak" "slovene" - "spanish" "swedish" "turkish" - "francais" "germanb") +(defvar LaTeX-varioref-package-options + '("draft" "final" "afrikaans" "american" "austrian" "naustrian" "basque" + "brazil" "breton" "bahasam" "catalan" "croatian" "czech" "danish" + "dutch" "english" "esperanto" "finnish" "french" "galician" "german" + "icelandic" "ngerman" "greek" "italian" "magyar" "norsk" "nynorsk" + "polish" "portuges" "romanian" "russian" "slovak" "slovene" + "spanish" "swedish" "turkish" "ukrainian" "francais" "germanb") "Package options for the varioref package.") ;;; varioref.el ends here
2013-01-13 Mads Jensen <[email protected]> * style/enumerate.el: New file. * doc/auctex.texi: Documented LaTeX-item-list, TeX-complete-list, and LaTeX-after-insert-env-hooks. * style/listings.el (LaTeX-listings-key-val-options): Updated to newer version of listings. Added experimental options. * style/pstricks.el (LaTeX-pstricks-package-options): New variable.
signature.asc
Description: OpenPGP digital signature
_______________________________________________ auctex-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/auctex-devel
