On 2013-02-13 20:34, Tassilo Horn wrote:
> I've committed fancynum.el.

Thank you :-)

> But there are some nitpicks wrt. fancyhdr.el.  Please fix those and send
> an improved patch.
> 
> - `fancyhdr-fancy-positions' is used only in one position, so no need to
>   have a defvar for it.  Also, if the variable was needed, it should
>   have a name matching the conventions, e.g.,
>   `LaTeX-fancyhdr-fancy-positions'.

Removed, and put inside the function with a suitable comment similar to
the one for the variable.

> - Now that the parser supports pagestyles, you should add the fancy and
>   fancyplain pagestyles provided by fancyhdr.  See
>   `LaTeX-add-pagestyles'.

Yep, plainly forgot :-( Thanks for reminding me.

> - `TeX-arg-fancyhdr-position': The first line of the docstring should be
>   one complete sentence.  I suggest "Promt for a fancyhdr position."
>   You should also document all arguments.  Have a look at the other
>   TeX-arg-* functions.

Documented as requested.

As requested, a patch for Makefile.in is also provided.

2013-02-14  Mads Jensen  <[email protected]>

        * Makefile.in (STYLESRC): Activate new style fancyhdr.el.

        * style/fancyhdr.el: New style.
-- 
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
Index: Makefile.in
===================================================================
RCS file: /sources/auctex/auctex/Makefile.in,v
retrieving revision 1.182
diff -u -u -r1.182 Makefile.in
--- Makefile.in	13 Feb 2013 19:59:18 -0000	1.182
+++ Makefile.in	13 Feb 2013 23:12:40 -0000
@@ -129,7 +129,7 @@
 	   style/multirow.el  style/imakeidx.el  style/afterpage.el \
 	   style/longtable.el style/lipsum.el    style/kantlipsum.el \
 	   style/memoir.el    style/placeins.el  style/nameref.el \
-	   style/fancynum.el  style/filecontents.el
+	   style/fancynum.el  style/fancyhdr.el	 style/filecontents.el
 STYLEELC = $(STYLESRC:.el=.elc)
 
 CLEANFILES = $(AUCELC) $(STYLEELC) $(MULEELC)

;;; fancyhdr.el --- AUCTeX style for `fancyhdr.sty'

;; Copyright (C) 2012, 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 `fancyhdr.sty', version 3.2

;;; Code:

(TeX-add-style-hook
 "fancyhdr"
 (lambda ()
   (TeX-add-symbols
    '("lhead" t)
    '("lfoot" t)
    '("chead" t)
    '("cfoot" t)
    '("rhead" t)
    '("rfoot" t)
    '("nouppercase" t)
    '("MakeUppercase" t)
    '("fancyhead" [ TeX-arg-fancyhdr-position ] t)
    '("fancyfoot" [ TeX-arg-fancyhdr-position ] t)
    '("fancyheadoffset"
      [ (TeX-arg-fancyhdr-position
         "Position" ("LO" "LE" "L" "RE" "RO" "R" "0")) ] t)
    '("fancyfootoffset"
      [ (TeX-arg-fancyhdr-position
         "Position" ("LO" "LE" "L" "RE" "RO" "R" "O")) ] t)
    '("fancyhfoffset"
      [ (TeX-arg-fancyhdr-position "Position" ("E" "O" "L" "R")) ] t)
    '("fancypagestyle" TeX-arg-pagestyle t)

    "headrulewidth" "footrulewidth" "plainfootrulewidth"
    "plainheadrulewidth" "leftmark" "rightmark"
    ;; the manual does not mention any subsubsectionmark (!)
    "chaptermark" "sectionmark" "subsectionmark" "paragraphmark"
    "subparagraphmark" "footrule" "headrule")

   ;; `fancyhdr.sty' supplies these two pagestyles
   (LaTeX-add-pagestyles "fancy" "fancyplain")

   ;; Fontification
   (when (and (featurep 'font-latex)
	      (eq TeX-install-font-lock 'font-latex-setup))
     (font-latex-add-keywords '(("fancyhead" "[{")
                                ("fancyfoot" "[{")
                                ("lhead" "{")
                                ("lfoot" "{")
                                ("chead" "{")
                                ("cfoot" "{")
                                ("rhead" "{")
                                ("rfoot" "{")
                                ("fancyheadoffset" "[{")
                                ("fancyfootoffset" "[{")
                                ("fancypagestyle" "{{")) 'function)
     (font-latex-add-keywords '(("headrulewidth" "")
                                ("footrulewidth" "")
                                ("plainheadrulewidth" "")
                                ("plainfootrulewidth" "")) 'variable)
     ;; Tell font-lock about the update.
     (setq font-lock-set-defaults nil)
     (font-lock-set-defaults))))

;; Because there can be many positions, `TeX-completing-read-multiple' is used
;; instead of just `completing-read', and a `collection' argument is provided as
;; the list of positions differs between the macros
(defun TeX-arg-fancyhdr-position (optional &optional prompt collection)
  "Prompt for a fancyhdr position with completion.
If non-nil, PROMPT is used as the prompt.  If non-nil, COLLECTION
is used as the completion list for the position."
  (let* ((positions (if (not collection)
                        ;; Standard positions with no restrictions.  Lower-case
                        ;; versions, and reverse versions (e.g., OC) are left
                        ;; out for simplicity.
                        '("LO" "LE" "L" "CO" "CE" "C" "RE" "RO" "R")
                      collection))
        (arguments
         (mapconcat 'identity
                    (TeX-completing-read-multiple
                     (TeX-argument-prompt optional prompt "Position")
                     (mapcar 'list positions)) ",")))
    (TeX-argument-insert arguments optional)))

(defvar LaTeX-fancyhdr-package-options nil
  "Package options for fancyhdr.")

;;; fancyhdr.el ends here

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
auctex-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/auctex-devel

Reply via email to