Hi all,
I wrote a patch for `latex.el' against current CVS version to add "LaTeX
pagestyle" as a type for the parser. Pagestyles defined in LaTeX packages and
classes will be automatically recognized and added to `LaTeX-pagestyle-list'
variable. I checked that it works with `article.cls', `book.cls' and 'report.
cls' classes and `fancyhdr' package. I also patched `imakeidx.el' in order to
use the new function `LaTeX-pagestyle-list'.
This is the ChangeLog entry:
2013-01-10 Mosè Giordano <[email protected]>
* latex.el: Update copyright range.
(LaTeX-auto-pagestyle-regexp-list): New variable.
(LaTeX-auto-regexp-list): Use `LaTeX-auto-pagestyle-regexp-list'.
("pagestyle"): New type for the parser.
(LaTeX-pagestyle-list): Remove.
(TeX-arg-pagestyle): Use `LaTeX-pagestyle-list' function for
completing.
(LaTeX-common-initialization): Initialize pagestyles.
* style/imakeidx.el: Use `LaTeX-pagestyle-list' function to set
`firstpagestyle' option values.
Bye,
Mosè Giordanodiff --git a/imakeidx.el b/imakeidx.el
index 566300b..5c0eb41 100644
--- a/imakeidx.el
+++ b/imakeidx.el
@@ -1,6 +1,6 @@
;;; imakeidx.el --- AUCTeX style for `imakeidx.sty'.
-;; Copyright (C) 2012 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2013 Free Software Foundation, Inc.
;; Maintainer: [email protected]
;; Author: Mosè Giordano <[email protected]>
@@ -53,12 +53,9 @@
;; available only if `fancyhdr' is not loaded. The following code
;; works only if `imakeidx' is loaded before `fancyhdr'
(unless (member "fancyhdr" TeX-active-styles)
- ;; `firstpagestyle' key takes as value one of the available
- ;; pagestyles. `LaTeX-pagestyle-list' is a list of lists of
- ;; strings, we need a list of strings
(setq LaTeX-imakeidx-indexsetup-options
(append LaTeX-imakeidx-indexsetup-options
- `(("firstpagestyle" ,(mapcar #'car LaTeX-pagestyle-list)))
+ `(("firstpagestyle" ,(LaTeX-pagestyle-list)))
'(("headers")))))
(TeX-add-style-hook "imakeidx"
--- latex.el-old 2013-01-10 15:20:21.000000000 +0100
+++ latex.el 2013-01-10 15:22:41.000000000 +0100
@@ -1,6 +1,6 @@
;;; latex.el --- Support for LaTeX documents.
-;; Copyright (C) 1991, 1993-1997, 1999, 2000, 2003-2012
+;; Copyright (C) 1991, 1993-1997, 1999, 2000, 2003-2013
;; Free Software Foundation, Inc.
;; Maintainer: [email protected]
@@ -1202,6 +1202,10 @@
1 TeX-auto-symbol))
"List of regular expressions matching macros in LaTeX classes and packages.")
+(defvar LaTeX-auto-pagestyle-regexp-list
+ '(("\\\\ps@\\([A-Za-z]+\\)" 1 LaTeX-auto-pagestyle))
+ "List of regular expression matching LaTeX pagestyle only.")
+
(defvar LaTeX-auto-regexp-list
(append
(let ((token TeX-token-char))
@@ -1235,7 +1239,8 @@
LaTeX-auto-class-regexp-list
LaTeX-auto-label-regexp-list
LaTeX-auto-index-regexp-list
- LaTeX-auto-minimal-regexp-list)
+ LaTeX-auto-minimal-regexp-list
+ LaTeX-auto-pagestyle-regexp-list)
"List of regular expression matching common LaTeX macro definitions.")
(defun LaTeX-split-bibs (match)
@@ -1243,7 +1248,7 @@
Split the string at commas and remove Biber file extensions."
(let ((bibs (TeX-split-string " *, *" (TeX-match-buffer match))))
(dolist (bib bibs)
- (LaTeX-add-bibliographies (replace-regexp-in-string
+ (LaTeX-add-bibliographies (replace-regexp-in-string
(concat "\\(?:\\."
(mapconcat 'regexp-quote
TeX-Biber-file-extensions
@@ -1422,6 +1427,7 @@
(TeX-auto-add-type "environment" "LaTeX")
(TeX-auto-add-type "bibliography" "LaTeX" "bibliographies")
(TeX-auto-add-type "index-entry" "LaTeX" "index-entries")
+(TeX-auto-add-type "pagestyle" "LaTeX")
(fset 'LaTeX-add-bibliographies-auto
(symbol-function 'LaTeX-add-bibliographies))
@@ -1912,13 +1918,6 @@
nil t)
optional))
-(defcustom LaTeX-pagestyle-list
- '(("plain") ("empty") ("headings") ("myheadings"))
- "A list of available pagestyles."
- :group 'LaTeX
- :type '(repeat (list (string))))
-(make-variable-buffer-local 'LaTeX-pagestyle-list)
-
(defun TeX-arg-pagestyle (optional &optional prompt)
"Prompt for a LaTeX pagestyle with completion.
If OPTIONAL is non-nil, insert the resulting value as an optional
@@ -1926,7 +1925,7 @@
string."
(TeX-argument-insert
(completing-read (TeX-argument-prompt optional prompt "Pagestyle")
- LaTeX-pagestyle-list)
+ (LaTeX-pagestyle-list))
optional))
(defcustom LaTeX-default-verb-delimiter ?|
@@ -5262,6 +5261,9 @@
'("thebibliography" LaTeX-env-bib)
'("theindex" LaTeX-env-item))
+ ;; `latex.ltx' defines `plain' and `empty' pagestyles
+ (LaTeX-add-pagestyles "plain" "empty")
+
(TeX-add-symbols
'("addtocounter" TeX-arg-counter "Value")
'("alph" TeX-arg-counter)
_______________________________________________
auctex-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/auctex-devel