aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1997-05-24 21:18:25 +0000
committerRichard M. Stallman1997-05-24 21:18:25 +0000
commit5ccb13ff32d38b09fa48bdca13e0433ec5ba3221 (patch)
tree23a4e148ac5071e2bd2fd414a0feede7531b474a
parentc988a68aadd54ca3406414353264f30967c55056 (diff)
downloademacs-5ccb13ff32d38b09fa48bdca13e0433ec5ba3221.tar.gz
emacs-5ccb13ff32d38b09fa48bdca13e0433ec5ba3221.zip
(texinfo-version): New function and variable.
(texinfo-update-node): New autoload call. (texinfo-every-node-update): Likewise. (texinfo-sequential-node-update): Likewise. (texinfo-mode-map): New binding for C-c ]. (texinfo-environment-regexp): Use concat, for clarity. (texinfo-insert-@end): Fix paren error.
-rw-r--r--lisp/textmodes/texinfo.el270
1 files changed, 190 insertions, 80 deletions
diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el
index 1a62fbc9fa0..9e1099f4b88 100644
--- a/lisp/textmodes/texinfo.el
+++ b/lisp/textmodes/texinfo.el
@@ -1,10 +1,12 @@
1;;; texinfo.el --- major mode for editing Texinfo files 1;;; texinfo.el --- major mode for editing Texinfo files
2 2
3;; Copyright (C) 1985, 1988, 1989, 1990, 1991, 1992, 1993, 1997 3;; Copyright (C) 1985, '88, '89, '90, '91,
4;; Free Software Foundation, Inc. 4;; '92, '93, '96, '97 Free Software Foundation, Inc.
5 5
6;; Author: Robert J. Chassell 6;; Author: Robert J. Chassell
7;; Maintainer: FSF 7;; Date: [Set date below for texinfo-version]
8;; Maintainer: bug-texinfo@prep.ai.mit.edu
9;; Keywords: maint, tex, docs
8 10
9;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
10 12
@@ -23,44 +25,107 @@
23;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 25;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24;; Boston, MA 02111-1307, USA. 26;; Boston, MA 02111-1307, USA.
25 27
28;;; Code:
29
26(defgroup texinfo nil 30(defgroup texinfo nil
27 "Texinfo Mode" 31 "Texinfo Mode"
28 :group 'docs) 32 :group 'docs)
29 33
34(defvar texinfo-version "2.37 of 24 May 1997")
35
36(defun texinfo-version (&optional here)
37 "Show the version of texinfo.el in the minibuffer.
38If optional argument HERE is non-nil, insert info at point."
39 (interactive "P")
40 (let ((version-string
41 (format "Version of \`texinfo.el\': %s" texinfo-version)))
42 (if here
43 (insert version-string)
44 (if (interactive-p)
45 (message "%s" version-string)
46 version-string))))
47
30 48
31;;; Autoloads: 49;;; Autoloads:
32 50
33(autoload 'makeinfo-region 51(autoload 'makeinfo-region
34 "makeinfo" 52 "makeinfo"
35 "Make Info file from region of current Texinfo file, and switch to it. 53 "Make Info file from region of current Texinfo file, and switch to it.
36 54
37This command does not offer the `next-error' feature since it would 55This command does not offer the `next-error' feature since it would
38apply to a temporary file, not the original; use the `makeinfo-buffer' 56apply to a temporary file, not the original; use the `makeinfo-buffer'
39command to gain use of `next-error'." 57command to gain use of `next-error'."
40 t nil) 58 t nil)
41 59
42(autoload 'makeinfo-buffer 60(autoload 'makeinfo-buffer
43 "makeinfo" 61 "makeinfo"
44 "Make Info file from current buffer. 62 "Make Info file from current buffer.
45 63
46Use the \\[next-error] command to move to the next error 64Use the \\[next-error] command to move to the next error
47\(if there are errors\)." 65\(if there are errors\)."
48 t nil) 66 t nil)
49 67
50(autoload 'kill-compilation 68(autoload 'kill-compilation
51 "compile" 69 "compile"
52 "Kill the process made by the \\[compile] command." 70 "Kill the process made by the \\[compile] command."
53 t nil) 71 t nil)
54 72
55(autoload 'makeinfo-recenter-compilation-buffer 73(autoload 'makeinfo-recenter-compilation-buffer
56 "makeinfo" 74 "makeinfo"
57 "Redisplay `*compilation*' buffer so most recent output can be seen. 75 "Redisplay `*compilation*' buffer so most recent output can be seen.
58The last line of the buffer is displayed on 76The last line of the buffer is displayed on
59line LINE of the window, or centered if LINE is nil." 77line LINE of the window, or centered if LINE is nil."
60 t nil) 78 t nil)
79
80(autoload 'texinfo-update-node
81 "texnfo-upd"
82 "Without any prefix argument, update the node in which point is located.
83Non-nil argument (prefix, if interactive) means update the nodes in the
84marked region.
85
86The functions for creating or updating nodes and menus, and their
87keybindings, are:
88
89 texinfo-update-node (&optional region-p) \\[texinfo-update-node]
90 texinfo-every-node-update () \\[texinfo-every-node-update]
91 texinfo-sequential-node-update (&optional region-p)
92
93 texinfo-make-menu (&optional region-p) \\[texinfo-make-menu]
94 texinfo-all-menus-update () \\[texinfo-all-menus-update]
95 texinfo-master-menu ()
96
97 texinfo-indent-menu-description (column &optional region-p)
98
99The `texinfo-column-for-description' variable specifies the column to
100which menu descriptions are indented. Its default value is 32."
101 t nil)
102
103(autoload 'texinfo-every-node-update
104 "texnfo-upd"
105 "Update every node in a Texinfo file."
106 t nil)
107
108(autoload 'texinfo-sequential-node-update
109 "texnfo-upd"
110 "Update one node (or many) in a Texinfo file with sequential pointers.
111
112This function causes the `Next' or `Previous' pointer to point to the
113immediately preceding or following node, even if it is at a higher or
114lower hierarchical level in the document. Continually pressing `n' or
115`p' takes you straight through the file.
116
117Without any prefix argument, update the node in which point is located.
118Non-nil argument (prefix, if interactive) means update the nodes in the
119marked region.
120
121This command makes it awkward to navigate among sections and
122subsections; it should be used only for those documents that are meant
123to be read like a novel rather than a reference, and for which the
124Info `g*' command is inadequate."
125 t nil)
61 126
62(autoload 'texinfo-make-menu 127(autoload 'texinfo-make-menu
63 "texnfo-upd" 128 "texnfo-upd"
64 "Without any prefix argument, make or update a menu. 129 "Without any prefix argument, make or update a menu.
65Make the menu for the section enclosing the node found following point. 130Make the menu for the section enclosing the node found following point.
66 131
@@ -71,19 +136,19 @@ Whenever a menu exists, and is being updated, the descriptions that
71are associated with node names in the pre-existing menu are 136are associated with node names in the pre-existing menu are
72incorporated into the new menu. Otherwise, the nodes' section titles 137incorporated into the new menu. Otherwise, the nodes' section titles
73are inserted as descriptions." 138are inserted as descriptions."
74 t nil) 139 t nil)
75 140
76(autoload 'texinfo-all-menus-update 141(autoload 'texinfo-all-menus-update
77 "texnfo-upd" 142 "texnfo-upd"
78 "Update every regular menu in a Texinfo file. 143 "Update every regular menu in a Texinfo file.
79Remove pre-existing master menu, if there is one. 144Remove pre-existing master menu, if there is one.
80 145
81If called with a non-nil argument, this function first updates all the 146If called with a non-nil argument, this function first updates all the
82nodes in the buffer before updating the menus." 147nodes in the buffer before updating the menus."
83 t nil) 148 t nil)
84 149
85(autoload 'texinfo-master-menu 150(autoload 'texinfo-master-menu
86 "texnfo-upd" 151 "texnfo-upd"
87 "Make a master menu for a whole Texinfo file. 152 "Make a master menu for a whole Texinfo file.
88Non-nil argument (prefix, if interactive) means first update all 153Non-nil argument (prefix, if interactive) means first update all
89existing nodes and menus. Remove pre-existing master menu, if there is one. 154existing nodes and menus. Remove pre-existing master menu, if there is one.
@@ -115,38 +180,38 @@ recommendation in the Texinfo Manual:
115 180
116Each of the menus in the detailed node listing is introduced by the 181Each of the menus in the detailed node listing is introduced by the
117title of the section containing the menu." 182title of the section containing the menu."
118 t nil) 183 t nil)
119 184
120(autoload 'texinfo-indent-menu-description 185(autoload 'texinfo-indent-menu-description
121 "texnfo-upd" 186 "texnfo-upd"
122 "Indent every description in menu following point to COLUMN. 187 "Indent every description in menu following point to COLUMN.
123Non-nil argument (prefix, if interactive) means indent every 188Non-nil argument (prefix, if interactive) means indent every
124description in every menu in the region. Does not indent second and 189description in every menu in the region. Does not indent second and
125subsequent lines of a multi-line description." 190subsequent lines of a multi-line description."
126 t nil) 191 t nil)
127 192
128(autoload 'texinfo-insert-node-lines 193(autoload 'texinfo-insert-node-lines
129 "texnfo-upd" 194 "texnfo-upd"
130 "Insert missing `@node' lines in region of Texinfo file. 195 "Insert missing `@node' lines in region of Texinfo file.
131Non-nil argument (prefix, if interactive) means also to insert the 196Non-nil argument (prefix, if interactive) means also to insert the
132section titles as node names; and also to insert the section titles as 197section titles as node names; and also to insert the section titles as
133node names in pre-existing @node lines that lack names." 198node names in pre-existing @node lines that lack names."
134 t nil) 199 t nil)
135 200
136(autoload 'texinfo-start-menu-description 201(autoload 'texinfo-start-menu-description
137 "texnfo-upd" 202 "texnfo-upd"
138 "In this menu entry, insert the node's section title as a description. 203 "In this menu entry, insert the node's section title as a description.
139Position point at beginning of description ready for editing. 204Position point at beginning of description ready for editing.
140Do not insert a title if the line contains an existing description. 205Do not insert a title if the line contains an existing description.
141 206
142You will need to edit the inserted text since a useful description 207You will need to edit the inserted text since a useful description
143complements the node name rather than repeats it as a title does." 208complements the node name rather than repeats it as a title does."
144 t nil) 209 t nil)
145 210
146(autoload 'texinfo-multiple-files-update 211(autoload 'texinfo-multiple-files-update
147 "texnfo-upd" 212 "texnfo-upd"
148 "Update first node pointers in each file included in OUTER-FILE; 213 "Update first node pointers in each file included in OUTER-FILE;
149create or update main menu in the outer file that refers to such nodes. 214create or update main menu in the outer file that refers to such nodes.
150This does not create or update menus or pointers within the included files. 215This does not create or update menus or pointers within the included files.
151 216
152With optional MAKE-MASTER-MENU argument (prefix arg, if interactive), 217With optional MAKE-MASTER-MENU argument (prefix arg, if interactive),
@@ -160,7 +225,7 @@ a master menu in OUTER-FILE.
160 225
161The command also updates the `Top' level node pointers of OUTER-FILE. 226The command also updates the `Top' level node pointers of OUTER-FILE.
162 227
163Notes: 228Notes:
164 229
165 * this command does NOT save any files--you must save the 230 * this command does NOT save any files--you must save the
166 outer file and any modified, included files. 231 outer file and any modified, included files.
@@ -172,13 +237,13 @@ Notes:
172Requirements: 237Requirements:
173 238
174 * each of the included files must contain exactly one highest 239 * each of the included files must contain exactly one highest
175 hierarchical level node, 240 hierarchical level node,
176 * this highest node must be the first node in the included file, 241 * this highest node must be the first node in the included file,
177 * each highest hierarchical level node must be of the same type. 242 * each highest hierarchical level node must be of the same type.
178 243
179Thus, normally, each included file contains one, and only one, 244Thus, normally, each included file contains one, and only one,
180chapter." 245chapter."
181 t nil) 246 t nil)
182 247
183 248
184;;; Code: 249;;; Code:
@@ -214,11 +279,11 @@ chapter."
214(defvar texinfo-font-lock-keywords 279(defvar texinfo-font-lock-keywords
215 '(;; All but the first 2 had an OVERRIDE of t. 280 '(;; All but the first 2 had an OVERRIDE of t.
216 ;; It didn't seem to be any better, and it's slower--simon. 281 ;; It didn't seem to be any better, and it's slower--simon.
217 ("^\\(@c\\|@comment\\)\\>.*" . font-lock-comment-face) ;comments 282 ("^\\(@c\\|@comment\\)\\>.*" . font-lock-comment-face) ;comments
218 ;; Robert J. Chassell <bob@gnu.ai.mit.edu> says remove this line. 283 ;; Robert J. Chassell <bob@gnu.ai.mit.edu> says remove this line.
219 ;("\\$\\([^$]*\\)\\$" 1 font-lock-string-face t) 284 ;;("\\$\\([^$]*\\)\\$" 1 font-lock-string-face t)
220 ("@\\([a-zA-Z]+\\|[^ \t\n]\\)" 1 font-lock-keyword-face) ;commands 285 ("@\\([a-zA-Z]+\\|[^ \t\n]\\)" 1 font-lock-keyword-face) ;commands
221 ("^\\*\\(.*\\)[\t ]*$" 1 font-lock-function-name-face t) ;menu items 286 ("^\\*\\(.*\\)[\t ]*$" 1 font-lock-function-name-face t) ;menu items
222 ("@\\(emph\\|strong\\|b\\|i\\){\\([^}]+\\)" 2 font-lock-comment-face) 287 ("@\\(emph\\|strong\\|b\\|i\\){\\([^}]+\\)" 2 font-lock-comment-face)
223 ("@\\(file\\|kbd\\|key\\|url\\|email\\){\\([^}]+\\)" 2 font-lock-string-face) 288 ("@\\(file\\|kbd\\|key\\|url\\|email\\){\\([^}]+\\)" 2 font-lock-string-face)
224 ("@\\(samp\\|code\\|var\\|math\\){\\([^}]+\\)" 289 ("@\\(samp\\|code\\|var\\|math\\){\\([^}]+\\)"
@@ -253,14 +318,15 @@ chapter."
253 ;; Calculate level of current texinfo outline heading. 318 ;; Calculate level of current texinfo outline heading.
254 (save-excursion 319 (save-excursion
255 (if (bobp) 320 (if (bobp)
256 0 321 0
257 (forward-char 1) 322 (forward-char 1)
258 (let* ((word (buffer-substring-no-properties 323 (let* ((word (buffer-substring-no-properties
259 (point) (progn (forward-word 1) (point)))) 324 (point) (progn (forward-word 1) (point))))
260 (entry (assoc word texinfo-section-list))) 325 (entry (assoc word texinfo-section-list)))
261 (if entry 326 (if entry
262 (nth 1 entry) 327 (nth 1 entry)
263 5))))) 328 5)))))
329
264 330
265;;; Keybindings 331;;; Keybindings
266(defvar texinfo-mode-map nil) 332(defvar texinfo-mode-map nil)
@@ -281,7 +347,7 @@ chapter."
281 (define-key keymap "\C-c\C-t\C-r" 'texinfo-tex-region) 347 (define-key keymap "\C-c\C-t\C-r" 'texinfo-tex-region)
282 (define-key keymap "\C-c\C-t\C-b" 'texinfo-tex-buffer)) 348 (define-key keymap "\C-c\C-t\C-b" 'texinfo-tex-buffer))
283 349
284;; Mode documentation displays commands in reverse order 350;; Mode documentation displays commands in reverse order
285;; from how they are listed in the texinfo-mode-map. 351;; from how they are listed in the texinfo-mode-map.
286 352
287(if texinfo-mode-map 353(if texinfo-mode-map
@@ -293,12 +359,12 @@ chapter."
293 359
294 ;; bindings for `makeinfo.el' 360 ;; bindings for `makeinfo.el'
295 (define-key texinfo-mode-map "\C-c\C-m\C-k" 'kill-compilation) 361 (define-key texinfo-mode-map "\C-c\C-m\C-k" 'kill-compilation)
296 (define-key texinfo-mode-map "\C-c\C-m\C-l" 362 (define-key texinfo-mode-map "\C-c\C-m\C-l"
297 'makeinfo-recenter-compilation-buffer) 363 'makeinfo-recenter-compilation-buffer)
298 (define-key texinfo-mode-map "\C-c\C-m\C-r" 'makeinfo-region) 364 (define-key texinfo-mode-map "\C-c\C-m\C-r" 'makeinfo-region)
299 (define-key texinfo-mode-map "\C-c\C-m\C-b" 'makeinfo-buffer) 365 (define-key texinfo-mode-map "\C-c\C-m\C-b" 'makeinfo-buffer)
300 366
301 ; Bindings for texinfmt.el. 367 ;; bindings for `texinfmt.el'
302 (define-key texinfo-mode-map "\C-c\C-e\C-r" 'texinfo-format-region) 368 (define-key texinfo-mode-map "\C-c\C-e\C-r" 'texinfo-format-region)
303 (define-key texinfo-mode-map "\C-c\C-e\C-b" 'texinfo-format-buffer) 369 (define-key texinfo-mode-map "\C-c\C-e\C-b" 'texinfo-format-buffer)
304 370
@@ -313,8 +379,9 @@ chapter."
313 379
314 (define-key texinfo-mode-map "\C-c\C-s" 'texinfo-show-structure) 380 (define-key texinfo-mode-map "\C-c\C-s" 'texinfo-show-structure)
315 381
316 (define-key texinfo-mode-map "\C-c}" 'up-list) 382 (define-key texinfo-mode-map "\C-c}" 'up-list)
317 (define-key texinfo-mode-map "\C-c{" 'texinfo-insert-braces) 383 (define-key texinfo-mode-map "\C-c]" 'up-list)
384 (define-key texinfo-mode-map "\C-c{" 'texinfo-insert-braces)
318 385
319 ;; bindings for inserting strings 386 ;; bindings for inserting strings
320 387
@@ -336,7 +403,7 @@ chapter."
336 403
337;;; Texinfo mode 404;;; Texinfo mode
338 405
339(defvar texinfo-chapter-level-regexp 406(defvar texinfo-chapter-level-regexp
340 "chapter\\|unnumbered \\|appendix \\|majorheading\\|chapheading" 407 "chapter\\|unnumbered \\|appendix \\|majorheading\\|chapheading"
341 "Regular expression matching Texinfo chapter-level headings. 408 "Regular expression matching Texinfo chapter-level headings.
342This does not match `@node' and does not match the `@top' command.") 409This does not match `@node' and does not match the `@top' command.")
@@ -383,7 +450,7 @@ Here are the functions:
383 450
384 texinfo-update-node \\[texinfo-update-node] 451 texinfo-update-node \\[texinfo-update-node]
385 texinfo-every-node-update \\[texinfo-every-node-update] 452 texinfo-every-node-update \\[texinfo-every-node-update]
386 texinfo-sequential-node-update 453 texinfo-sequential-node-update
387 454
388 texinfo-make-menu \\[texinfo-make-menu] 455 texinfo-make-menu \\[texinfo-make-menu]
389 texinfo-all-menus-update \\[texinfo-all-menus-update] 456 texinfo-all-menus-update \\[texinfo-all-menus-update]
@@ -392,7 +459,7 @@ Here are the functions:
392 texinfo-indent-menu-description (column &optional region-p) 459 texinfo-indent-menu-description (column &optional region-p)
393 460
394The `texinfo-column-for-description' variable specifies the column to 461The `texinfo-column-for-description' variable specifies the column to
395which menu descriptions are indented. 462which menu descriptions are indented.
396 463
397Passed an argument (a prefix argument, if interactive), the 464Passed an argument (a prefix argument, if interactive), the
398`texinfo-update-node' and `texinfo-make-menu' functions do their jobs 465`texinfo-update-node' and `texinfo-make-menu' functions do their jobs
@@ -415,17 +482,18 @@ value of texinfo-mode-hook."
415 (use-local-map texinfo-mode-map) 482 (use-local-map texinfo-mode-map)
416 (set-syntax-table texinfo-mode-syntax-table) 483 (set-syntax-table texinfo-mode-syntax-table)
417 (make-local-variable 'page-delimiter) 484 (make-local-variable 'page-delimiter)
418 (setq page-delimiter 485 (setq page-delimiter
419 (concat 486 (concat
420 "^@node [ \t]*[Tt]op\\|^@\\(" 487 "^@node [ \t]*[Tt]op\\|^@\\("
421 texinfo-chapter-level-regexp 488 texinfo-chapter-level-regexp
422 "\\)")) 489 "\\)"))
423 (make-local-variable 'require-final-newline) 490 (make-local-variable 'require-final-newline)
424 (setq require-final-newline t) 491 (setq require-final-newline t)
425 (make-local-variable 'indent-tabs-mode) 492 (make-local-variable 'indent-tabs-mode)
426 (setq indent-tabs-mode nil) 493 (setq indent-tabs-mode nil)
427 (make-local-variable 'paragraph-separate) 494 (make-local-variable 'paragraph-separate)
428 (setq paragraph-separate (concat "\b\\|@[a-zA-Z]*[ \n]\\|" paragraph-separate)) 495 (setq paragraph-separate
496 (concat "\b\\|@[a-zA-Z]*[ \n]\\|" paragraph-separate))
429 (make-local-variable 'paragraph-start) 497 (make-local-variable 'paragraph-start)
430 (setq paragraph-start (concat "\b\\|@[a-zA-Z]*[ \n]\\|" paragraph-start)) 498 (setq paragraph-start (concat "\b\\|@[a-zA-Z]*[ \n]\\|" paragraph-start))
431 (make-local-variable 'fill-column) 499 (make-local-variable 'fill-column)
@@ -441,10 +509,10 @@ value of texinfo-mode-hook."
441 (make-local-variable 'font-lock-defaults) 509 (make-local-variable 'font-lock-defaults)
442 (setq font-lock-defaults '(texinfo-font-lock-keywords t)) 510 (setq font-lock-defaults '(texinfo-font-lock-keywords t))
443 (make-local-variable 'outline-regexp) 511 (make-local-variable 'outline-regexp)
444 (setq outline-regexp 512 (setq outline-regexp
445 (concat "@\\(" 513 (concat "@\\("
446 (mapconcat 'car texinfo-section-list "\\>\\|") 514 (mapconcat 'car texinfo-section-list "\\>\\|")
447 "\\>\\)")) 515 "\\>\\)"))
448 (make-local-variable 'outline-level) 516 (make-local-variable 'outline-level)
449 (setq outline-level 'texinfo-outline-level) 517 (setq outline-level 'texinfo-outline-level)
450 (make-local-variable 'tex-start-of-header) 518 (make-local-variable 'tex-start-of-header)
@@ -460,14 +528,40 @@ value of texinfo-mode-hook."
460 528
461;;; Insert string commands 529;;; Insert string commands
462 530
531;; Keep as concatinated lists for ease of maintenance
463(defconst texinfo-environment-regexp 532(defconst texinfo-environment-regexp
464 "^[ \t]*@\\(f?table\\|enumerate\\|itemize\ 533 (concat
465\\|ifhtml\\|ifinfo\\|iftex\\|ifset\\|ifclear\ 534 "^@"
466\\|example\\|quotation\\|lisp\\|smallexample\\|smalllisp\\|display\\|format\ 535 "\\("
467\\|flushleft\\|flushright\\|ignore\\|group\\|tex\\|html\\|cartouche\\|menu\ 536 "cartouche\\|"
468\\|titlepage\\|end\\|def[a-z]*[a-wyz]\\>\\)" 537 "display\\|"
469 "Regexp for environment-like Texinfo list commands. 538 "end\\|"
470Subexpression 1 is what goes into the corresponding `@end' statement.") 539 "enumerate\\|"
540 "example\\|"
541 "f?table\\|"
542 "flushleft\\|"
543 "flushright\\|"
544 "format\\|"
545 "group\\|"
546 "ifhtml\\|"
547 "ifinfo\\|"
548 "iftex\\|"
549 "ignore\\|"
550 "itemize\\|"
551 "lisp\\|"
552 "macro\\|"
553 "multitable\\|"
554 "quotation\\|"
555 "smallexample\\|"
556 "smalllisp\\|"
557 "tex"
558 "\\)")
559 "Regexp for environment-like TexInfo list commands.
560 Subexpression 1 is what goes into the corresponding `@end' statement.")
561
562;; The following texinfo-insert-@end command not only inserts a SPC
563;; after the @end, but tries to find out what belongs there. It is
564;; not very smart: it does not understand nested lists.
471 565
472(defun texinfo-insert-@end () 566(defun texinfo-insert-@end ()
473 "Insert the matching `@end' for the last Texinfo command that needs one." 567 "Insert the matching `@end' for the last Texinfo command that needs one."
@@ -475,15 +569,15 @@ Subexpression 1 is what goes into the corresponding `@end' statement.")
475 (let ((depth 1) string) 569 (let ((depth 1) string)
476 (save-excursion 570 (save-excursion
477 (while (and (> depth 0) 571 (while (and (> depth 0)
478 (re-search-backward texinfo-environment-regexp nil t) 572 (re-search-backward texinfo-environment-regexp nil t))
479 (if (looking-at "@end") 573 (if (looking-at "@end")
480 (setq depth (1+ depth)) 574 (setq depth (1+ depth))
481 (setq depth (1- depth))))) 575 (setq depth (1- depth))))
482 (looking-at texinfo-environment-regexp) 576 (looking-at texinfo-environment-regexp)
483 (if (zerop depth) 577 (if (zerop depth)
484 (setq string 578 (setq string
485 (buffer-substring (match-beginning 1) 579 (buffer-substring (match-beginning 1)
486 (match-end 1))))) 580 (match-end 1)))))
487 (insert "@end ") 581 (insert "@end ")
488 (if string (insert string "\n")))) 582 (if string (insert string "\n"))))
489 583
@@ -496,7 +590,7 @@ Subexpression 1 is what goes into the corresponding `@end' statement.")
496 590
497;; These commands use texinfo-insert-@-with-arg 591;; These commands use texinfo-insert-@-with-arg
498(defun texinfo-insert-@-with-arg (string &optional arg) 592(defun texinfo-insert-@-with-arg (string &optional arg)
499 (if arg 593 (if arg
500 (progn 594 (progn
501 (setq arg (prefix-numeric-value arg)) 595 (setq arg (prefix-numeric-value arg))
502 (if (< arg 0) 596 (if (< arg 0)
@@ -594,13 +688,13 @@ The default is not to surround any existing words with the braces."
594 688
595;;; Texinfo file structure 689;;; Texinfo file structure
596 690
597;; These are defined in tenfo-upd.el. 691;; These are defined in texnfo-upd.el. defvars here avoid warnings.
598(defvar texinfo-section-types-regexp) 692(defvar texinfo-section-types-regexp)
599(defvar texinfo-section-level-regexp) 693(defvar texinfo-section-level-regexp)
600(defvar texinfo-subsection-level-regexp) 694(defvar texinfo-subsection-level-regexp)
601(defvar texinfo-subsubsection-level-regexp) 695(defvar texinfo-subsubsection-level-regexp)
602 696
603(defun texinfo-show-structure (&optional nodes-too) 697(defun texinfo-show-structure (&optional nodes-too)
604 "Show the structure of a Texinfo file. 698 "Show the structure of a Texinfo file.
605List the lines in the file that begin with the @-sign commands for 699List the lines in the file that begin with the @-sign commands for
606@chapter, @section, and the like. 700@chapter, @section, and the like.
@@ -611,12 +705,12 @@ with @-sign commands for @chapter, @section, and the like, and list
611 705
612Lines with structuring commands beginning in them are displayed in 706Lines with structuring commands beginning in them are displayed in
613another buffer named `*Occur*'. In that buffer, you can move point to 707another buffer named `*Occur*'. In that buffer, you can move point to
614one of those lines and then use \\<occur-mode-map>\\[occur-mode-goto-occurrence], 708one of those lines and then use \\<occur-mode-map>\\[occur-mode-goto-occurrence],
615to jump to the corresponding spot in the Texinfo source file." 709to jump to the corresponding spot in the Texinfo source file."
616 710
617 (interactive "P") 711 (interactive "P")
618 (require 'texnfo-upd) 712 (require 'texnfo-upd)
619 (save-excursion 713 (save-excursion
620 (goto-char (point-min)) 714 (goto-char (point-min))
621 (if nodes-too 715 (if nodes-too
622 (occur (concat "\\(^@node\\)\\|" texinfo-section-types-regexp)) 716 (occur (concat "\\(^@node\\)\\|" texinfo-section-types-regexp))
@@ -647,14 +741,14 @@ to jump to the corresponding spot in the Texinfo source file."
647 ;; ((looking-at "@appendixsec ") 9) 741 ;; ((looking-at "@appendixsec ") 9)
648 ;; ((looking-at "@heading ") 9) 742 ;; ((looking-at "@heading ") 9)
649 743
650 ((looking-at 744 ((looking-at
651 (concat "@\\(" texinfo-subsection-level-regexp "\\)")) 13) 745 (concat "@\\(" texinfo-subsection-level-regexp "\\)")) 13)
652 ;; ((looking-at "@subsection ") 13) 746 ;; ((looking-at "@subsection ") 13)
653 ;; ((looking-at "@unnumberedsubsec ") 13) 747 ;; ((looking-at "@unnumberedsubsec ") 13)
654 ;; ((looking-at "@appendixsubsec ") 13) 748 ;; ((looking-at "@appendixsubsec ") 13)
655 ;; ((looking-at "@subheading ") 13) 749 ;; ((looking-at "@subheading ") 13)
656 750
657 ((looking-at 751 ((looking-at
658 (concat "@\\(" texinfo-subsubsection-level-regexp "\\)")) 17) 752 (concat "@\\(" texinfo-subsubsection-level-regexp "\\)")) 17)
659 ;; ((looking-at "@subsubsection ") 17) 753 ;; ((looking-at "@subsubsection ") 17)
660 ;; ((looking-at "@unnumberedsubsubsec ") 17) 754 ;; ((looking-at "@unnumberedsubsubsec ") 17)
@@ -724,6 +818,10 @@ This runs the shell command defined by `texinfo-texindex-command'."
724 (interactive) 818 (interactive)
725 (require 'tex-mode) 819 (require 'tex-mode)
726 (tex-send-command texinfo-texindex-command (concat tex-zap-file ".??")) 820 (tex-send-command texinfo-texindex-command (concat tex-zap-file ".??"))
821 ;; alternatively
822 ;; (send-string "tex-shell"
823 ;; (concat texinfo-texindex-command
824 ;; " " tex-zap-file ".??" "\n"))
727 (tex-recenter-output-buffer nil)) 825 (tex-recenter-output-buffer nil))
728 826
729(defun texinfo-tex-print () 827(defun texinfo-tex-print ()
@@ -746,17 +844,29 @@ This runs the shell command defined by `tex-dvi-view-command'."
746 (if (not (get-process "tex-shell")) 844 (if (not (get-process "tex-shell"))
747 (error "No TeX shell running")) 845 (error "No TeX shell running"))
748 (tex-send-command "x")) 846 (tex-send-command "x"))
847;; alternatively:
848;; save-excursion
849;; (set-buffer (get-buffer "*tex-shell*"))
850;; (goto-char (point-max))
851;; (insert "x")
852;; (comint-send-input)
749 853
750(defun texinfo-delete-from-print-queue (job-number) 854(defun texinfo-delete-from-print-queue (job-number)
751 "Delete job from the line printer spooling queue. 855 "Delete job from the line printer spooling queue.
752You are prompted for the job number (use a number shown by a previous 856You are prompted for the job number (use a number shown by a previous
753\\[texinfo-show-print-queue] command)." 857\\[tex-show-print-queue] command)."
754 (interactive "nPrinter job number for deletion: ") 858 (interactive "nPrinter job number for deletion: ")
755 (require 'tex-mode) 859 (require 'tex-mode)
756 (if (tex-shell-running) 860 (if (tex-shell-running)
757 (tex-kill-job) 861 (tex-kill-job)
758 (tex-start-shell)) 862 (tex-start-shell))
759 (tex-send-command texinfo-delete-from-print-queue-command job-number) 863 (tex-send-command texinfo-delete-from-print-queue-command job-number)
864 ;; alternatively
865 ;; (send-string "tex-shell"
866 ;; (concat
867 ;; texinfo-delete-from-print-queue-command
868 ;; " "
869 ;; job-number"\n"))
760 (tex-recenter-output-buffer nil)) 870 (tex-recenter-output-buffer nil))
761 871
762(provide 'texinfo) 872(provide 'texinfo)