annotate lisp/textmodes/texinfo.el @ 670:bff41708644e

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Tue, 02 Jun 1992 02:33:00 +0000
parents fec3f9a1e3e5
children 4f28bd14272c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
657
fec3f9a1e3e5 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
1 ;;;; texinfo.el ---- major mode for editing Texinfo files.
139
8e1e4ca81016 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 128
diff changeset
2
8e1e4ca81016 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 128
diff changeset
3 ;;;; Version 2.00 14 Dec 1990
8e1e4ca81016 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 128
diff changeset
4
8e1e4ca81016 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 128
diff changeset
5 ;; Copyright (C) 1985, 1988, 1989, 1990 Free Software Foundation, Inc.
69
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
6
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
7 ;; This file is part of GNU Emacs.
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
8
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
10 ;; it under the terms of the GNU General Public License as published by
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
11 ;; the Free Software Foundation; either version 1, or (at your option)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
12 ;; any later version.
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
13
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
14 ;; GNU Emacs is distributed in the hope that it will be useful,
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
17 ;; GNU General Public License for more details.
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
18
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
20 ;; along with GNU Emacs; see the file COPYING. If not, write to
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
21 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
22
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
23 (require 'texnfo-upd)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
24 (require 'tex-mode)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
25 (defvar texinfo-mode-syntax-table nil)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
26
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
27 (if texinfo-mode-syntax-table
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
28 nil
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
29 (setq texinfo-mode-syntax-table (make-syntax-table))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
30 (modify-syntax-entry ?\" " " texinfo-mode-syntax-table)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
31 (modify-syntax-entry ?\\ " " texinfo-mode-syntax-table)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
32 (modify-syntax-entry ?@ "\\" texinfo-mode-syntax-table)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
33 (modify-syntax-entry ?\^q "\\" texinfo-mode-syntax-table)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
34 (modify-syntax-entry ?\[ "(]" texinfo-mode-syntax-table)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
35 (modify-syntax-entry ?\] ")[" texinfo-mode-syntax-table)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
36 (modify-syntax-entry ?{ "(}" texinfo-mode-syntax-table)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
37 (modify-syntax-entry ?} "){" texinfo-mode-syntax-table)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
38 (modify-syntax-entry ?\' "w" texinfo-mode-syntax-table))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
39
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
40 (defvar texinfo-mode-map nil)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
41
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
42 ;; Mode documentation displays commands in reverse order
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
43 ;; from how they are listed in the texinfo-mode-map.
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
44 (if texinfo-mode-map
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
45 nil
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
46 (setq texinfo-mode-map (make-sparse-keymap))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
47
113
9827cb0af717 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 76
diff changeset
48 (define-key texinfo-mode-map "\C-c\C-t\C-k" 'tex-kill-job)
9827cb0af717 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 76
diff changeset
49 (define-key texinfo-mode-map "\C-c\C-t\C-l" 'tex-recenter-output-buffer)
9827cb0af717 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 76
diff changeset
50 (define-key texinfo-mode-map "\C-c\C-t\C-q" 'tex-show-print-queue)
9827cb0af717 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 76
diff changeset
51 (define-key texinfo-mode-map "\C-c\C-t\C-p" 'texinfo-tex-print)
9827cb0af717 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 76
diff changeset
52 (define-key texinfo-mode-map "\C-c\C-t\C-i" 'texinfo-texindex)
9827cb0af717 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 76
diff changeset
53 (define-key texinfo-mode-map "\C-c\C-t\C-t" 'texinfo-tex-buffer)
9827cb0af717 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 76
diff changeset
54 (define-key texinfo-mode-map "\C-c\C-t\C-r" 'texinfo-tex-region)
69
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
55
113
9827cb0af717 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 76
diff changeset
56 (define-key texinfo-mode-map "\C-c\C-i\C-r" 'texinfo-format-region)
9827cb0af717 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 76
diff changeset
57 (define-key texinfo-mode-map "\C-c\C-i\C-b" 'texinfo-format-buffer)
69
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
58
113
9827cb0af717 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 76
diff changeset
59 (define-key texinfo-mode-map "\C-c\C-u\C-m" 'texinfo-make-menu)
9827cb0af717 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 76
diff changeset
60 (define-key texinfo-mode-map "\C-c\C-u\C-n" 'texinfo-update-node)
9827cb0af717 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 76
diff changeset
61 (define-key texinfo-mode-map "\C-c\C-u\C-e" 'texinfo-every-node-update)
9827cb0af717 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 76
diff changeset
62 (define-key texinfo-mode-map "\C-c\C-u\C-a" 'texinfo-all-menus-update)
69
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
63
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
64 (define-key texinfo-mode-map "\C-c\C-s" 'texinfo-show-structure)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
65
76
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
66 (define-key texinfo-mode-map "\"" 'tex-insert-quote)
69
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
67 (define-key texinfo-mode-map "\e}" 'up-list)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
68 (define-key texinfo-mode-map "\e{" 'texinfo-insert-braces)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
69
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
70 (define-key texinfo-mode-map "\C-c\C-cv" 'texinfo-insert-@var)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
71 (define-key texinfo-mode-map "\C-c\C-cs" 'texinfo-insert-@samp)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
72 (define-key texinfo-mode-map "\C-c\C-co" 'texinfo-insert-@noindent)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
73 (define-key texinfo-mode-map "\C-c\C-cn" 'texinfo-insert-@node)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
74 (define-key texinfo-mode-map "\C-c\C-ck" 'texinfo-insert-@kbd)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
75 (define-key texinfo-mode-map "\C-c\C-ci" 'texinfo-insert-@item)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
76 (define-key texinfo-mode-map "\C-c\C-cx" 'texinfo-insert-@example)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
77 (define-key texinfo-mode-map "\C-c\C-ce" 'texinfo-insert-@end-example)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
78 (define-key texinfo-mode-map "\C-c\C-cd" 'texinfo-insert-@dfn)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
79 (define-key texinfo-mode-map "\C-c\C-cc" 'texinfo-insert-@code))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
80
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
81 (defun texinfo-insert-@var ()
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
82 "Insert the string @var in a texinfo buffer."
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
83 (interactive)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
84 (insert "@var{}")
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
85 (backward-char))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
86
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
87 (defun texinfo-insert-@samp ()
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
88 "Insert the string @samp in a texinfo buffer."
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
89 (interactive)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
90 (insert "@samp{}")
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
91 (backward-char))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
92
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
93 (defun texinfo-insert-@noindent ()
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
94 "Insert the string @noindent in a texinfo buffer."
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
95 (interactive)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
96 (insert "@noindent\n"))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
97
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
98 (defun texinfo-insert-@node ()
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
99 "Insert the string @node in a texinfo buffer,
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
100 along with a comment indicating the arguments to @node."
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
101 (interactive)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
102 (insert "@node \n@comment node-name, next, previous, up")
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
103 (forward-line -1)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
104 (forward-char 6))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
105
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
106 (defun texinfo-insert-@kbd ()
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
107 "Insert the string @kbd in a texinfo buffer."
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
108 (interactive)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
109 (insert "@kbd{}")
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
110 (backward-char))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
111
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
112 (defun texinfo-insert-@item ()
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
113 "Insert the string @item in a texinfo buffer."
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
114 (interactive)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
115 (insert "@item")
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
116 (newline))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
117
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
118 (defun texinfo-insert-@example ()
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
119 "Insert the string @example in a texinfo buffer."
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
120 (interactive)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
121 (insert "@example\n"))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
122
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
123 (defun texinfo-insert-@end-example ()
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
124 "Insert the string @end example in a texinfo buffer."
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
125 (interactive)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
126 (insert "@end example\n"))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
127
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
128 (defun texinfo-insert-@dfn ()
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
129 "Insert the string @dfn in a texinfo buffer."
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
130 (interactive)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
131 (insert "@dfn{}")
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
132 (backward-char))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
133
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
134 (defun texinfo-insert-@code ()
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
135 "Insert the string @code in a texinfo buffer."
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
136 (interactive)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
137 (insert "@code{}")
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
138 (backward-char))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
139
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
140 (defun texinfo-insert-braces ()
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
141 "Make a pair of braces and be poised to type inside of them.
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
142 Use \\[up-list] to move forward out of the braces."
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
143 (interactive)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
144 (insert "{}")
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
145 (backward-char))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
146
258
1e0bc00dca7a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 139
diff changeset
147 ;;;###autoload
69
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
148 (defun texinfo-mode ()
76
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
149 "Major mode for editing Texinfo files.
69
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
150
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
151 It has these extra commands:
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
152 \\{texinfo-mode-map}
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
153
76
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
154 These are files that are used as input for TeX to make printed manuals
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
155 and also to be turned into Info files by \\[texinfo-format-buffer] or
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
156 `makeinfo'. These files must be written in a very restricted and
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
157 modified version of TeX input format.
69
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
158
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
159 Editing commands are like text-mode except that the syntax table is
76
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
160 set up so expression commands skip Texinfo bracket groups. To see
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
161 what the Info version of a region of the Texinfo file will look like,
69
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
162 use \\[texinfo-format-region]. This command runs Info on the current region
76
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
163 of the Texinfo file and formats it properly.
69
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
164
76
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
165 You can show the structure of a Texinfo file with \\[texinfo-show-structure].
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
166 This command shows the structure of a Texinfo file by listing the
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
167 lines with the @-sign commands for @chapter, @section, and the like.
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
168 These lines are displayed in another window called the *Occur* window.
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
169 In that window, you can position the cursor over one of the lines and
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
170 use \\[occur-mode-goto-occurrence], to jump to the corresponding spot
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
171 in the Texinfo file.
69
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
172
76
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
173 In addition, Texinfo mode provides commands that insert various
69
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
174 frequently used @-sign commands into the buffer. You can use these
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
175 commands to save keystrokes. And you can insert balanced braces with
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
176 \\[texinfo-insert-braces] and later use the command \\[up-list] to
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
177 move forward past the closing brace.
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
178
76
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
179 Also, Texinfo mode provides functions for automatically creating or
69
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
180 updating menus and node pointers. These functions
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
181
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
182 * insert the `Next', `Previous' and `Up' pointers of a node,
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
183 * insert or update the menu for a section, and
76
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
184 * create a master menu for a Texinfo source file.
69
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
185
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
186 Here are the functions:
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
187
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
188 texinfo-update-node \\[texinfo-update-node]
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
189 texinfo-every-node-update \\[texinfo-every-node-update]
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
190 texinfo-sequential-node-update
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
191
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
192 texinfo-make-menu \\[texinfo-make-menu]
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
193 texinfo-all-menus-update \\[texinfo-all-menus-update]
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
194 texinfo-master-menu
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
195
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
196 texinfo-indent-menu-description (column &optional region-p)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
197
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
198 The `texinfo-column-for-description' variable specifies the column to
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
199 which menu descriptions are indented.
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
200
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
201 Passed an argument (a prefix argument, if interactive), the
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
202 `texinfo-update-node' and `texinfo-make-menu' functions do their jobs
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
203 in the region.
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
204
76
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
205 To use the updating commands, you must structure your Texinfo file
69
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
206 hierarchically, such that each `@node' line, with the exception of the
76
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
207 Top node, is accompanied by some kind of section line, such as an
69
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
208 `@chapter' or `@section' line.
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
209
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
210 If the file has a `top' node, it must be called `top' or `Top' and
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
211 be the first node in the file.
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
212
76
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
213 Entering Texinfo mode calls the value of text-mode-hook, and then the
69
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
214 value of texinfo-mode-hook."
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
215 (interactive)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
216 (text-mode)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
217 (setq mode-name "texinfo")
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
218 (setq major-mode 'texinfo-mode)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
219 (use-local-map texinfo-mode-map)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
220 (set-syntax-table texinfo-mode-syntax-table)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
221 (make-local-variable 'require-final-newline)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
222 (setq require-final-newline t)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
223 (make-local-variable 'paragraph-separate)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
224 (setq paragraph-separate (concat "^\b\\|^@[a-zA-Z]*[ \n]\\|" paragraph-separate))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
225 (make-local-variable 'paragraph-start)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
226 (setq paragraph-start (concat "^\b\\|^@[a-zA-Z]*[ \n]\\|" paragraph-start))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
227 (make-local-variable 'fill-column)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
228 (setq fill-column 72)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
229 (make-local-variable 'comment-start)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
230 (setq comment-start "@c ")
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
231 (make-local-variable 'comment-start-skip)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
232 (setq comment-start-skip "@c +")
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
233 (make-local-variable 'words-include-escapes)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
234 (setq words-include-escapes t)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
235 (make-local-variable 'tex-start-of-header)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
236 (setq tex-start-of-header "%**start of header")
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
237 (make-local-variable 'tex-end-of-header)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
238 (setq tex-end-of-header "%**end of header")
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
239 (make-local-variable 'tex-trailer)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
240 (setq tex-trailer "@bye\n")
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
241 (run-hooks 'text-mode-hook 'texinfo-mode-hook))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
242
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
243
76
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
244 ;;; Texinfo file structure
69
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
245
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
246 ; The following is defined in `texnfo-upd.el'
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
247 ; (defvar texinfo-section-types-regexp
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
248 ; "^@\\(chapter \\|sect\\|sub\\|unnum\\|major\\|heading \\|appendix\\)"
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
249 ; "Regexp matching chapter, section, other headings (but not the top node).")
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
250
76
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
251 (defun texinfo-show-structure (&optional nodes-too)
69
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
252 "Show the structure of a Texinfo file.
76
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
253 List the lines in the file that begin with the @-sign commands for
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
254 @chapter, @section, and the like.
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
255
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
256 With optional argument (prefix if interactive), list both the lines
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
257 with @-sign commands for @chapter, @section, and the like, and list
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
258 @node lines.
69
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
259
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
260 Lines with structuring commands beginning in them are displayed in
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
261 another window called the *Occur* window. In that window, you can
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
262 position the cursor over one of the lines and use
76
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
263 \\[occur-mode-goto-occurrence],
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
264 to jump to the corresponding spot in the Texinfo file."
69
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
265
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
266 (interactive "P")
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
267 (save-excursion
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
268 (goto-char (point-min))
76
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
269 (if nodes-too
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
270 (occur (concat "\\(^@node\\)\\|" texinfo-section-types-regexp))
a983e9bbadc1 *** empty log message ***
Robert J. Chassell <bob@rattlesnake.com>
parents: 69
diff changeset
271 (occur texinfo-section-types-regexp)))
69
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
272 (pop-to-buffer "*Occur*")
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
273 (goto-char (point-min))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
274 (flush-lines "-----"))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
275
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
276
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
277 ;;; texinfo mode tex and hardcopy printing commands.
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
278
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
279 ;; These commands are for running tex on a region of a texinfo file in
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
280 ;; GNU Emacs, or on the whole buffer, and for printing the resulting
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
281 ;; .dvi file. The three commands are:
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
282
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
283 ; texinfo-tex-region to run tex on the current region.
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
284 ; texinfo-tex-buffer to run tex on the current buffer.
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
285 ; texinfo-tex-print to print the .dvi file made by tex
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
286
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
287 ;;; Other useful functions
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
288
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
289 ; These functions are provided by `tex-mode.el' but are bound to keys
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
290 ; in texinfo mode.
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
291
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
292 ; tex-kill-job to kill the currently running tex job
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
293 ; tex-recenter-output-buffer to redisplay tex job output buffer
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
294 ; tex-show-print-queue to show the print queue
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
295
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
296 ; Various variables are provided by `tex-mode.el'
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
297
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
298 ; tex mode variable Default Value
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
299
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
300 ; tex-dvi-print-command "lpr -d"
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
301 ; tex-directory "/tmp/"
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
302 ; tex-show-queue-command "lpq"
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
303 ; tex-shell-cd-command "cd"
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
304 ; tex-zap-file nil (created as needed)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
305
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
306
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
307 ;;; The tex and print function definitions:
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
308
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
309 (defvar texinfo-tex-command "tex"
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
310 "*Command used by texinfo-tex-region to run tex on a region.")
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
311
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
312 (defvar texinfo-texindex-command "texindex"
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
313 "*Command used by texinfo-texindex to sort unsorted index files.")
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
314
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
315 (defun texinfo-tex-region (beg end)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
316 "Run tex on the current region. A temporary file (tex-zap-file) is
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
317 written in directory tex-directory, and tex is run in that directory.
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
318 The first line of the file is copied to the temporary file; and
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
319 if the buffer has a header, it is written to the temporary file before
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
320 the region itself. The buffer's header is all lines between the
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
321 strings defined by tex-start-of-header and tex-end-of-header
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
322 inclusive. The header must start in the first 100 lines. The value
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
323 of tex-trailer is appended to the temporary file after the region."
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
324 (interactive "r")
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
325 (if (get-buffer "*tex-shell*")
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
326 (tex-kill-job)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
327 (tex-start-shell))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
328 (or tex-zap-file (setq tex-zap-file (make-temp-name "#tz")))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
329 (let ((tex-out-file (concat tex-zap-file ".tex"))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
330 (temp-buffer (get-buffer-create " tex-Output-Buffer"))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
331 (zap-directory
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
332 (file-name-as-directory (expand-file-name tex-directory))))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
333 (save-excursion
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
334 (save-restriction
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
335 (widen)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
336 (goto-char (point-min))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
337 (forward-line 100)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
338 (let ((search-end (point))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
339 (hbeg (point-min)) (hend (point-min))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
340 (default-directory zap-directory))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
341 (goto-char (point-min))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
342
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
343 ;; Copy first line, the `\input texinfo' line, to temp file
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
344 (write-region (point)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
345 (save-excursion (end-of-line) (point))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
346 tex-out-file nil nil)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
347
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
348 ;; Don't copy first line twice if region includes it.
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
349 (forward-line 1)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
350 (if (< beg (point)) (setq beg (point)))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
351
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
352 ;; Initialize the temp file with either the header or nothing
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
353 (if (search-forward tex-start-of-header search-end t)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
354 (progn
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
355 (beginning-of-line)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
356 (setq hbeg (point)) ; Mark beginning of header.
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
357 (if (search-forward tex-end-of-header nil t)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
358 (progn (beginning-of-line)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
359 (setq hend (point))) ; Mark end of header.
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
360 (setq hbeg (point-min))))) ; Else no header.
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
361
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
362 ;; Copy header to temp file.
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
363 (write-region (min hbeg beg) hend tex-out-file t nil)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
364
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
365 ;; Copy region to temp file.
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
366 (write-region (max beg hend) end tex-out-file t nil))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
367
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
368 ;; This is a kludge to insert the tex-trailer into the tex-out-file.
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
369 ;; We have to create a special buffer in which to insert
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
370 ;; the tex-trailer first because there is no function with
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
371 ;; which to append a literal string directly to a file.
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
372 (let ((local-tex-trailer tex-trailer))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
373 (set-buffer temp-buffer)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
374 (erase-buffer)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
375 ;; make sure trailer isn't hidden by a comment
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
376 (insert-string "\n")
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
377 (if local-tex-trailer (insert-string local-tex-trailer))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
378 (set-buffer-directory temp-buffer zap-directory)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
379 (write-region (point-min) (point-max) tex-out-file t nil))))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
380
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
381 (set-buffer-directory "*tex-shell*" zap-directory)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
382 (send-string "tex-shell" (concat tex-shell-cd-command " "
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
383 zap-directory "\n"))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
384 (send-string "tex-shell" (concat texinfo-tex-command " "
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
385 tex-out-file "\n")))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
386 (tex-recenter-output-buffer 0))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
387
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
388 (defun texinfo-tex-buffer ()
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
389 "Run tex on current buffer.
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
390 See \\[texinfo-tex-region] for more information."
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
391 (interactive)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
392 (texinfo-tex-region (point-min) (point-max)))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
393
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
394 (defun texinfo-texindex ()
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
395 "Run texindex on unsorted index files.
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
396 The index files are made by \\[texinfo-tex-region] or \\[texinfo-tex-buffer].
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
397 Runs the shell command defined by texinfo-texindex-command."
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
398 (interactive)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
399 (send-string "tex-shell"
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
400 (concat texinfo-texindex-command
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
401 " " tex-zap-file ".??" "\n"))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
402 (tex-recenter-output-buffer nil))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
403
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
404 (defun texinfo-tex-print ()
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
405 "Print .dvi file made by \\[texinfo-tex-region] or \\[texinfo-tex-buffer].
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
406 Runs the shell command defined by tex-dvi-print-command."
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
407 (interactive)
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
408 (send-string "tex-shell"
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
409 (concat tex-dvi-print-command
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
410 " " tex-zap-file ".dvi" "\n"))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
411 (tex-recenter-output-buffer nil))
0355ba998550 Initial revision
Robert J. Chassell <bob@rattlesnake.com>
parents:
diff changeset
412
584
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 258
diff changeset
413 (provide 'texinfo)
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 258
diff changeset
414
657
fec3f9a1e3e5 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
415 ;;; texinfo.el ends here