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