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