Mercurial > hg > xemacs-beta
comparison lisp/auctex/tex-info.el @ 100:4be1180a9e89 r20-1b2
Import from CVS: tag r20-1b2
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:15:11 +0200 |
parents | 4103f0995bd7 |
children | 441bb1e64a06 |
comparison
equal
deleted
inserted
replaced
99:2d83cbd90d8d | 100:4be1180a9e89 |
---|---|
1 ;;; tex-info.el - Support for editing TeXinfo source. | |
2 ;; | |
3 ;; Maintainer: Per Abrahamsen <auc-tex@sunsite.auc.dk> | |
4 ;; Version: 9.7i | |
5 | |
6 ;; Copyright (C) 1993, 1994, 1997 Per Abrahamsen | |
7 ;; | |
8 ;; This program is free software; you can redistribute it and/or modify | |
9 ;; it under the terms of the GNU General Public License as published by | |
10 ;; the Free Software Foundation; either version 2, or (at your option) | |
11 ;; any later version. | |
12 ;; | |
13 ;; This program is distributed in the hope that it will be useful, | |
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 ;; GNU General Public License for more details. | |
17 ;; | |
18 ;; You should have received a copy of the GNU General Public License | |
19 ;; along with this program; if not, write to the Free Software | |
20 ;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
21 | |
22 ;;; Code: | |
23 | |
24 (require 'tex) | |
25 (condition-case nil ;Lucid is not providing. | |
26 (require 'texinfo) | |
27 (error)) | |
28 | |
29 ;;; Environments: | |
30 | |
31 (defvar TeXinfo-environment-list | |
32 '(("cartouche") | |
33 ("defcv") | |
34 ("deffn") ("defivar") ("defmac") | |
35 ("defmethod") ("defop") ("defopt") ("defspec") ("deftp") | |
36 ("deftypefn") ("deftypefun") ("deftypevar") ("deftypevr") | |
37 ("defun") ("defvar") ("defvr") ("description") ("display") | |
38 ("enumerate") ("example") ("ifset") ("ifclear") ("flushleft") | |
39 ("flushright") ("format") ("ftable") ("iftex") ("itemize") | |
40 ("lisp") ("quotation") ("smallexample") ("smalllisp") ("table") | |
41 ("tex") ("titlepage") ("vtable")) | |
42 "Alist of TeXinfo environments.") | |
43 | |
44 (defconst texinfo-environment-regexp | |
45 ;; Overwrite version from `texinfo.el'. | |
46 (concat "^@\\(" | |
47 (mapconcat 'car TeXinfo-environment-list "\\|") | |
48 "\\|end\\)") | |
49 "Regexp for environment-like TeXinfo list commands. | |
50 Subexpression 1 is what goes into the corresponding `@end' statement.") | |
51 | |
52 (defun TeXinfo-insert-environment (env) | |
53 "Insert TeXinfo environment ENV. | |
54 When called interactively, prompt for an environment." | |
55 (interactive (list (completing-read "Environment: " | |
56 TeXinfo-environment-list))) | |
57 (insert "@" env "\n\n@end " env "\n") | |
58 (if (null (cdr-safe (assoc "defcv" TeXinfo-environment-list))) | |
59 (forward-line -2) | |
60 ;; apply arguments | |
61 )) | |
62 | |
63 ;;; Keymap: | |
64 | |
65 (defvar TeXinfo-mode-map nil | |
66 "Keymap for TeXinfo mode.") | |
67 | |
68 (if TeXinfo-mode-map | |
69 () | |
70 (setq TeXinfo-mode-map (make-sparse-keymap)) | |
71 | |
72 ;; From texinfo.el | |
73 | |
74 ;; bindings for updating nodes and menus | |
75 (define-key TeXinfo-mode-map "\C-c\C-um" 'texinfo-master-menu) | |
76 (define-key TeXinfo-mode-map "\C-c\C-u\C-m" 'texinfo-make-menu) | |
77 (define-key TeXinfo-mode-map "\C-c\C-u\C-n" 'texinfo-update-node) | |
78 (define-key TeXinfo-mode-map "\C-c\C-u\C-e" 'texinfo-every-node-update) | |
79 (define-key TeXinfo-mode-map "\C-c\C-u\C-a" 'texinfo-all-menus-update) | |
80 | |
81 ;; From TeX-mode | |
82 | |
83 ;; Standard | |
84 (define-key TeXinfo-mode-map "\177" 'backward-delete-char-untabify) | |
85 (define-key TeXinfo-mode-map "\C-c}" 'up-list) | |
86 (define-key TeXinfo-mode-map "\C-c#" 'TeX-normal-mode) | |
87 (define-key TeXinfo-mode-map "\C-c\C-n" 'TeX-normal-mode) | |
88 (define-key TeXinfo-mode-map "\C-c?" 'describe-mode) | |
89 | |
90 ;; From tex.el | |
91 (define-key TeXinfo-mode-map "\C-c{" 'TeX-insert-braces) | |
92 (define-key TeXinfo-mode-map "\C-c\C-f" 'TeX-font) | |
93 (define-key TeXinfo-mode-map "\C-c\C-m" 'TeX-insert-macro) | |
94 (define-key TeXinfo-mode-map "\e\t" 'TeX-complete-symbol) | |
95 | |
96 (define-key TeXinfo-mode-map "\C-c;" 'TeX-comment-region) | |
97 (define-key TeXinfo-mode-map "\C-c%" 'TeX-comment-paragraph) | |
98 (define-key TeXinfo-mode-map "\C-c'" 'TeX-comment-paragraph) ;*** Old way | |
99 (define-key TeXinfo-mode-map "\C-c:" 'TeX-un-comment-region) ;*** Old way | |
100 (define-key TeXinfo-mode-map "\C-c\"" 'TeX-un-comment) ;*** Old way | |
101 | |
102 ;; From tex-buf.el | |
103 (define-key TeXinfo-mode-map "\C-c\C-c" 'TeX-command-master) | |
104 (define-key TeXinfo-mode-map "\C-c\C-k" 'TeX-kill-job) | |
105 (define-key TeXinfo-mode-map "\C-c\C-l" 'TeX-recenter-output-buffer) | |
106 (define-key TeXinfo-mode-map "\C-c^" 'TeX-home-buffer) | |
107 (define-key TeXinfo-mode-map "\C-c`" 'TeX-next-error) | |
108 (define-key TeXinfo-mode-map "\C-c\C-w" 'TeX-toggle-debug-boxes) | |
109 | |
110 ;; From tex.cpl.el | |
111 | |
112 ;; Simulating LaTeX-mode | |
113 | |
114 (define-key TeXinfo-mode-map "\C-c\C-e" 'TeXinfo-insert-environment) | |
115 (define-key TeXinfo-mode-map "\C-c\n" 'texinfo-insert-@item) | |
116 (define-key TeXinfo-mode-map "\C-c\C-s" 'texinfo-insert-@node) | |
117 (define-key TeXinfo-mode-map "\C-c]" 'texinfo-insert-@end)) | |
118 | |
119 (easy-menu-define TeXinfo-mode-menu | |
120 TeXinfo-mode-map | |
121 "Menu used in TeXinfo mode." | |
122 (list "TeXinfo" | |
123 ["Environment..." TeXinfo-insert-environment t] | |
124 ["Node..." texinfo-insert-@node t] | |
125 ["Macro..." TeX-insert-macro t] | |
126 ["Complete" TeX-complete-symbol t] | |
127 ["Item" texinfo-insert-@item t] | |
128 (list "Insert Font" | |
129 ["Emphasize" (TeX-font nil ?\C-e) :keys "C-c C-f C-e"] | |
130 ["Bold" (TeX-font nil ?\C-b) :keys "C-c C-f C-b"] | |
131 ["Typewriter" (TeX-font nil ?\C-t) :keys "C-c C-f C-t"] | |
132 ["Small Caps" (TeX-font nil ?\C-c) :keys "C-c C-f C-c"] | |
133 ["Italic" (TeX-font nil ?\C-i) :keys "C-c C-f C-i"] | |
134 ["Sample" (TeX-font nil ?\C-s) :keys "C-c C-f C-s"] | |
135 ["Roman" (TeX-font nil ?\C-r) :keys "C-c C-f C-r"]) | |
136 (list "Change Font" | |
137 ["Emphasize" (TeX-font t ?\C-e) :keys "C-u C-c C-f C-e"] | |
138 ["Bold" (TeX-font t ?\C-b) :keys "C-u C-c C-f C-b"] | |
139 ["Typewriter" (TeX-font t ?\C-t) :keys "C-u C-c C-f C-t"] | |
140 ["Small Caps" (TeX-font t ?\C-c) :keys "C-u C-c C-f C-c"] | |
141 ["Italic" (TeX-font t ?\C-i) :keys "C-u C-c C-f C-i"] | |
142 ["Sample" (TeX-font t ?\C-s) :keys "C-u C-c C-f C-s"] | |
143 ["Roman" (TeX-font t ?\C-r) :keys "C-u C-c C-f C-r"]) | |
144 "-" | |
145 ["Save Document" TeX-save-document t] | |
146 ["Next Error" TeX-next-error t] | |
147 (list "TeX Output" | |
148 ["Kill Job" TeX-kill-job t] | |
149 ["Debug Bad Boxes" TeX-toggle-debug-boxes | |
150 :style toggle :selected TeX-debug-bad-boxes ] | |
151 ["Switch to original file" TeX-home-buffer t] | |
152 ["Recenter Output Buffer" TeX-recenter-output-buffer t]) | |
153 "--" | |
154 ["Create Master Menu" texinfo-master-menu t] | |
155 ["Create Menu" texinfo-make-menu t] | |
156 ["Update Node" texinfo-update-node t] | |
157 ["Update Every Node" texinfo-every-node-update t] | |
158 ["Update All Menus" texinfo-all-menus-update t] | |
159 ["Uncomment Region" TeX-un-comment-region t] | |
160 ["Comment Region" TeX-comment-region t] | |
161 ["Switch to Master file" TeX-home-buffer t] | |
162 ["Submit bug report" TeX-submit-bug-report t] | |
163 ["Reset Buffer" TeX-normal-mode t] | |
164 ["Reset AUC TeX" (TeX-normal-mode t) :keys "C-u C-c C-n"])) | |
165 | |
166 (easy-menu-define TeXinfo-command-menu | |
167 TeXinfo-mode-map | |
168 "Menu used in TeXinfo mode for external commands." | |
169 (append '("Command") | |
170 (mapcar 'TeX-command-menu-entry TeX-command-list))) | |
171 | |
172 (defvar TeXinfo-font-list | |
173 '((?\C-b "@b{" "}") | |
174 (?\C-c "@sc{" "}") | |
175 (?\C-e "@emph{" "}") | |
176 (?\C-i "@i{" "}") | |
177 (?\C-r "@r{" "}") | |
178 (?\C-s "@samp{" "}") | |
179 (?\C-t "@t{" "}") | |
180 (?s "@strong{" "}") | |
181 (?\C-f "@file{" "}") | |
182 (?\C-d "@dfn{" "}") | |
183 (?\C-v "@var{" "}") | |
184 (?k "@key{" "}") | |
185 (?\C-k "@kbd{" "}") | |
186 (?c "@code{" "}") | |
187 (?C "@cite{" "}")) | |
188 "Font commands used in TeXinfo mode. See `TeX-font-list'.") | |
189 | |
190 ;;; Mode: | |
191 | |
192 ;;; Do not ;;;###autoload because of conflict with standard tex-mode.el. | |
193 (defun texinfo-mode () | |
194 "Major mode for editing files of input for TeXinfo. | |
195 | |
196 Special commands: | |
197 \\{TeXinfo-mode-map} | |
198 | |
199 Entering TeXinfo mode calls the value of text-mode-hook, | |
200 then the value of TeX-mode-hook, and then the value of | |
201 TeXinfo-mode-hook." | |
202 (interactive) | |
203 ;; Mostly stolen from texinfo.el | |
204 (setq mode-name "TeXinfo") | |
205 (setq major-mode 'texinfo-mode) | |
206 (use-local-map TeXinfo-mode-map) | |
207 (set-syntax-table texinfo-mode-syntax-table) | |
208 (make-local-variable 'page-delimiter) | |
209 (setq page-delimiter | |
210 (concat | |
211 "^@node [ \t]*[Tt]op\\|^@\\(" | |
212 texinfo-chapter-level-regexp | |
213 "\\)")) | |
214 (make-local-variable 'require-final-newline) | |
215 (setq require-final-newline t) | |
216 (make-local-variable 'indent-tabs-mode) | |
217 (setq indent-tabs-mode nil) | |
218 (make-local-variable 'paragraph-separate) | |
219 (setq paragraph-separate | |
220 (concat "\b\\|^@[a-zA-Z]*[ \n]\\|" paragraph-separate)) | |
221 (make-local-variable 'paragraph-start) | |
222 (setq paragraph-start | |
223 (concat "\b\\|^@[a-zA-Z]*[ \n]\\|" paragraph-start)) | |
224 (make-local-variable 'fill-column) | |
225 (setq fill-column 72) | |
226 (make-local-variable 'comment-start) | |
227 (setq comment-start "@c ") | |
228 (make-local-variable 'comment-start-skip) | |
229 (setq comment-start-skip "@c +\\|@comment +") | |
230 (make-local-variable 'words-include-escapes) | |
231 (setq words-include-escapes t) | |
232 (if (not (boundp 'texinfo-imenu-generic-expression)) | |
233 ;; This was introduced in 19.30. | |
234 () | |
235 (make-local-variable 'imenu-generic-expression) | |
236 (setq imenu-generic-expression texinfo-imenu-generic-expression)) | |
237 (make-local-variable 'font-lock-defaults) | |
238 (setq font-lock-defaults '(texinfo-font-lock-keywords t)) | |
239 (if (not (boundp 'texinfo-section-list)) | |
240 ;; This was included in 19.31. | |
241 () | |
242 (make-local-variable 'outline-regexp) | |
243 (setq outline-regexp | |
244 (concat "@\\(" | |
245 (mapconcat 'car texinfo-section-list "\\>\\|") | |
246 "\\>\\)")) | |
247 (make-local-variable 'outline-level) | |
248 (setq outline-level 'texinfo-outline-level)) | |
249 | |
250 ;; Mostly AUC TeX stuff | |
251 (easy-menu-add TeXinfo-command-menu TeXinfo-mode-map) | |
252 (easy-menu-add TeXinfo-mode-menu TeXinfo-mode-map) | |
253 (make-local-variable 'TeX-command-current) | |
254 (setq TeX-command-current 'TeX-command-master) | |
255 | |
256 (setq TeX-default-extension "texi") | |
257 (make-local-variable 'TeX-esc) | |
258 (setq TeX-esc "@") | |
259 | |
260 (make-local-variable 'TeX-auto-regexp-list) | |
261 (setq TeX-auto-regexp-list 'TeX-auto-empty-regexp-list) | |
262 (make-local-variable 'TeX-auto-update) | |
263 (setq TeX-auto-update t) | |
264 | |
265 (setq TeX-command-default "TeX") | |
266 (setq TeX-header-end "%**end") | |
267 (setq TeX-trailer-start (regexp-quote (concat TeX-esc "bye"))) | |
268 | |
269 (make-local-variable 'TeX-complete-list) | |
270 (setq TeX-complete-list | |
271 (list (list "@\\([a-zA-Z]*\\)" 1 'TeX-symbol-list nil) | |
272 (list "" TeX-complete-word))) | |
273 | |
274 (make-local-variable 'TeX-font-list) | |
275 (setq TeX-font-list TeXinfo-font-list) | |
276 | |
277 (TeX-add-symbols | |
278 '("appendix" "Title") | |
279 '("appendixsec" "Title") | |
280 '("appendixsection" "Title") | |
281 '("appendixsubsec" "Title") | |
282 '("appendixsubsubsec" "Title") | |
283 '("asis") | |
284 '("author" "Author") | |
285 '("b" "Text") | |
286 '("bullet") | |
287 '("bye") | |
288 '("c" "Comment") | |
289 '("center" "Line-of-text") | |
290 '("chapheading" "Title") | |
291 '("chapter" "Title") | |
292 '("cindex" "Entry") | |
293 '("cite" "Reference") | |
294 '("clear" "Flag") | |
295 '("code" "Sample-code") | |
296 '("comment" "Comment") | |
297 '("contents") | |
298 '("copyright") | |
299 '("defcodeindex" "Index-name") | |
300 '("defindex" "Index-name") | |
301 '("dfn" "Term") | |
302 '("dmn" "Dimension") | |
303 '("dots") | |
304 '("emph" "Text") | |
305 '("equiv") | |
306 '("error") | |
307 '("evenfooting" TeXinfo-lrc-argument-hook) | |
308 '("evenheading" TeXinfo-lrc-argument-hook) | |
309 '("everyfooting" TeXinfo-lrc-argument-hook) | |
310 '("everyheading" TeXinfo-lrc-argument-hook) | |
311 '("exdent" "Line-of-text") | |
312 '("expansion") | |
313 '("file" "Filename") | |
314 '("finalout") | |
315 '("findex" "Entry") | |
316 '("footnote" "Text-of-footnote") | |
317 '("footnotestyle" "Style") | |
318 '("group") | |
319 '("heading" "Title") | |
320 '("headings" "On-off-single-double") | |
321 '("i" "Text") | |
322 '("ignore") | |
323 '("include" "Filename") | |
324 '("inforef" "Node-name" "Info-file-name") | |
325 '("item") | |
326 '("itemx") | |
327 '("kbd" "Keyboard-characters") | |
328 '("key" "Key-name") | |
329 '("kindex" "Entry") | |
330 '("majorheading" "Title") | |
331 '("menu") | |
332 '("minus") | |
333 '("need" "N") | |
334 '("node" "Name" "Next" "Previous" "Up") | |
335 '("noindent") | |
336 '("oddfooting" TeXinfo-lrc-argument-hook) | |
337 '("oddheading" TeXinfo-lrc-argument-hook) | |
338 '("page") | |
339 '("paragraphindent" "Indent") | |
340 '("pindex" "Entry") | |
341 '("point") | |
342 '("print") | |
343 '("printindex" "Index-name") | |
344 '("pxref" "Node-name") | |
345 '("r" "Text") | |
346 '("ref" "Node-name") | |
347 '("refill") | |
348 '("result") | |
349 '("samp" "Text") | |
350 '("sc" "Text") | |
351 '("section" "Title") | |
352 '("set" "Flag") | |
353 '("setchapternewpage" "On-off-odd") | |
354 '("setfilename" "Info-file-name") | |
355 '("settitle" "Title") | |
356 '("shortcontents") | |
357 '("smallbook") | |
358 '("sp" "N") | |
359 '("strong" "Text") | |
360 '("subheading" "Title") | |
361 '("subsection" "Title") | |
362 '("subsubheading" "Title") | |
363 '("subsubsection" "Title") | |
364 '("subtitle" "Title") | |
365 '("summarycontents") | |
366 '("syncodeindex" "From-index" "Into-index") | |
367 '("synindex" "From-index" "Into-index") | |
368 '("t" "Text") | |
369 '("TeX") | |
370 '("thischapter") | |
371 '("thischaptername") | |
372 '("thisfile") | |
373 '("thispage") | |
374 '("tindex" "Entry") | |
375 '("title" "Title") | |
376 '("titlefont" "Text") | |
377 '("titlepage") | |
378 '("today") | |
379 '("top" "Title") | |
380 '("unnumbered" "Title") | |
381 '("unnumberedsec" "Title") | |
382 '("unnumberedsubsec" "Title") | |
383 '("unnumberedsubsubsec" "Title") | |
384 '("value" "Flag") | |
385 '("var" "Metasyntactic-variable") | |
386 '("vindex" "Entry") | |
387 '("vskip" "Amount") | |
388 '("w" "Text")) | |
389 | |
390 (run-hooks 'text-mode-hook 'TeXinfo-mode-hook)) | |
391 | |
392 (provide 'tex-info) | |
393 | |
394 ;;; tex-info.el ends here |