Initial Commit
[packages] / xemacs-packages / auctex / style / comment.el
1 ;;; comment.el --- AUCTeX style for `comment.sty'
2
3 ;; Copyright (C) 2007 Free Software Foundation, Inc.
4
5 ;; Author: Ralf Angeli <angeli@caeruleus.net>
6 ;; Maintainer: auctex-devel@gnu.org
7 ;; Created: 2007-03-18
8 ;; Keywords: tex
9
10 ;; This file is part of AUCTeX.
11
12 ;; AUCTeX is free software; you can redistribute it and/or modify it
13 ;; under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 3, or (at your option)
15 ;; any later version.
16
17 ;; AUCTeX is distributed in the hope that it will be useful, but
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20 ;; General Public License for more details.
21
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with AUCTeX; see the file COPYING.  If not, write to the Free
24 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
25 ;; 02111-1307, USA.
26
27 ;;; Commentary:
28
29 ;; This file adds support for `comment.sty'.
30
31 ;;; Code:
32
33 (TeX-add-style-hook
34  "comment"
35  (lambda ()
36    ;; New symbols
37    (TeX-add-symbols
38     '("includecomment" "Name")
39     '("excludecomment" "Name")
40     '("specialcomment" "Name" "Before commands" "After commands")
41     '("processcomment" "Name" "Each-line commands"
42       "Before commands" "After commands"))
43    ;; New environments
44    (mapc 'LaTeX-add-environments LaTeX-comment-env-list)
45    ;; Fontification
46    (when (and (featurep 'font-latex)
47               (eq TeX-install-font-lock 'font-latex-setup))
48      ;; For syntactic fontification.
49      (add-to-list 'font-latex-syntactic-keywords-extra
50                   ;; \begin is supposed to start at the beginning of a line.
51                   `(,(format "^\\\\begin *{\\(?:%s\\)}.*\\(\n\\)"
52                              (regexp-opt LaTeX-comment-env-list))
53                     (1 "<" t)))
54      (add-to-list 'font-latex-syntactic-keywords-extra
55                   ;; \end is supposed to start at the beginning of a line.
56                   `(,(format "^\\(\\\\\\)end *{\\(?:%s\\)}"
57                              (regexp-opt LaTeX-comment-env-list))
58                     (1 ">" t)))
59      (font-latex-set-syntactic-keywords)
60      (font-latex-add-keywords '(("includecomment" "{")
61                                 ("excludecomment" "{")
62                                 ("specialcomment" "{{{")
63                                 ("processcomment" "{{{{"))
64                               'variable)
65      ;; Tell font-lock about the update.
66      (setq font-lock-set-defaults nil)
67      (font-lock-set-defaults)))
68  LaTeX-dialect)
69
70 ;;; comment.el ends here