]> code.delx.au - gnu-emacs-elpa/blob - auctex-11.86/style/doc.el
3c7022013b95ef31b459ed8bf3103e2e714d54d6
[gnu-emacs-elpa] / auctex-11.86 / style / doc.el
1 ;;; doc.el --- AUCTeX style for `doc.sty'
2
3 ;; Copyright (C) 2004, 2008 Free Software Foundation, Inc.
4
5 ;; Author: Frank Küster <frank@kuesterei.ch>
6 ;; Maintainer: auctex-devel@gnu.org
7 ;; Keywords: tex
8
9 ;; This file is part of AUCTeX.
10
11 ;; AUCTeX is free software; you can redistribute it and/or modify it
12 ;; under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 3, or (at your option)
14 ;; any later version.
15
16 ;; AUCTeX is distributed in the hope that it will be useful, but
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ;; General Public License for more details.
20
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with AUCTeX; see the file COPYING. If not, write to the Free
23 ;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
24 ;; 02110-1301, USA.
25
26 ;;; Commentary:
27
28 ;; This file adds support for `doc.sty'.
29
30 ;;; Code:
31
32 (defun LaTeX-env-no-comment (environment)
33 "Insert ENVIRONMENT and make sure there is no commented empty line inside."
34 (LaTeX-insert-environment environment)
35 (unless (TeX-active-mark)
36 (when (save-excursion
37 (beginning-of-line)
38 (looking-at (concat "[ \t]+$\\|[ \t]*"
39 TeX-comment-start-regexp "+[ \t]*$")))
40 (delete-region (line-beginning-position) (line-end-position))
41 (indent-according-to-mode))))
42
43 (defun LaTeX-doc-after-insert-macrocode (env start end)
44 "Make sure the macrocode environment is properly formatted after insertion."
45 (when (TeX-member env '("macrocode" "macrocode*") 'string-equal)
46 (save-excursion
47 (goto-char end)
48 (skip-chars-backward " \t")
49 (when (bolp)
50 (insert "%")
51 (indent-according-to-mode))
52 (goto-char start)
53 (skip-chars-backward " \t")
54 (when (bolp)
55 (insert "%")
56 (indent-according-to-mode)))))
57
58 (TeX-add-style-hook
59 "doc"
60 (function
61 (lambda ()
62 (add-to-list (make-local-variable 'LaTeX-indent-environment-list)
63 '("macrocode" current-indentation))
64 (add-to-list 'LaTeX-indent-environment-list
65 '("macrocode*" current-indentation))
66 (add-hook 'LaTeX-after-insert-env-hooks 'LaTeX-doc-after-insert-macrocode
67 nil t)
68 (LaTeX-add-environments
69 "theglossary"
70 '("macrocode" LaTeX-env-no-comment)
71 '("macrocode*" LaTeX-env-no-comment)
72 '("macro" "Macro"))
73 (TeX-add-symbols
74 "EnableCrossrefs"
75 "DisableCrossrefs"
76 "DoNotIndex"
77 "DontCheckModules"
78 "CheckModules"
79 "Module"
80 '("DescribeMacro" "Macro")
81 '("DescribeEnv" "Environment")
82 "verbatim"
83 "verb"
84 "parg"
85 "oarg"
86 "marg"
87 "meta"
88 "cmd"
89 "makelabel"
90 "MacroFont"
91 "MacroFont"
92 "AltMacroFont"
93 "AltMacroFont"
94 "PrintMacroName"
95 "PrintDescribeMacro"
96 "PrintDescribeEnv"
97 "PrintEnvName"
98 "MakePrivateLetters"
99 "actualchar"
100 "quotechar"
101 "levelchar"
102 "encapchar"
103 "verbatimchar"
104 "SpecialIndex"
105 "SpecialMainIndex"
106 "SpecialMainEnvIndex"
107 "SpecialUsageIndex"
108 "SpecialEnvIndex"
109 "SortIndex"
110 "LeftBraceIndex"
111 "RightBraceIndex"
112 "PercentIndex"
113 "OldMakeindex"
114 "PercentIndex"
115 "IndexPrologue"
116 "IndexParms"
117 "subitem"
118 "subsubitem"
119 "indexspace"
120 "efill"
121 "pfill"
122 "PrintIndex"
123 '("changes" "version" "date (YYYY/MM/DD)")
124 "generalname"
125 "RecordChanges"
126 "GlossaryPrologue"
127 "GlossaryParms"
128 "PrintChanges"
129 "AlsoImplementation"
130 "StopEventually"
131 "OnlyDescription"
132 "Finale"
133 "IndexInput"
134 "maketitle"
135 "MakeShortVerb"
136 "DeleteShortVerb"
137 "MakeShortverb"
138 "DeleteShortverb"
139 "CheckSum"
140 "CharacterTable"
141 "CharTableChanges"
142 "CodelineNumbered"
143 "CodelineIndex"
144 "PageIndex"
145 "theCodelineNo"
146 "theCodelineNo"
147 "DocstyleParms"
148 "MakePercentIgnore"
149 "MakePercentComment"
150 "DocInput"
151 "DocInclude"
152 "GetFileInfo"
153 "filename"
154 "fileinfo"))))
155
156 ;; Local Variables:
157 ;; coding: iso-8859-1
158 ;; End: