Mercurial > emacs
comparison lisp/textmodes/texinfo.el @ 76:a983e9bbadc1
*** empty log message ***
author | Robert J. Chassell <bob@rattlesnake.com> |
---|---|
date | Fri, 27 Jul 1990 16:01:02 +0000 |
parents | 0355ba998550 |
children | 9827cb0af717 |
comparison
equal
deleted
inserted
replaced
75:a13ef7914930 | 76:a983e9bbadc1 |
---|---|
59 (define-key texinfo-mode-map "\C-c\C-ue" 'texinfo-every-node-update) | 59 (define-key texinfo-mode-map "\C-c\C-ue" 'texinfo-every-node-update) |
60 (define-key texinfo-mode-map "\C-c\C-ua" 'texinfo-all-menus-update) | 60 (define-key texinfo-mode-map "\C-c\C-ua" 'texinfo-all-menus-update) |
61 | 61 |
62 (define-key texinfo-mode-map "\C-c\C-s" 'texinfo-show-structure) | 62 (define-key texinfo-mode-map "\C-c\C-s" 'texinfo-show-structure) |
63 | 63 |
64 (define-key texinfo-mode-map "\"" 'tex-insert-quote) | |
64 (define-key texinfo-mode-map "\e}" 'up-list) | 65 (define-key texinfo-mode-map "\e}" 'up-list) |
65 (define-key texinfo-mode-map "\e{" 'texinfo-insert-braces) | 66 (define-key texinfo-mode-map "\e{" 'texinfo-insert-braces) |
66 | 67 |
67 (define-key texinfo-mode-map "\C-c\C-cv" 'texinfo-insert-@var) | 68 (define-key texinfo-mode-map "\C-c\C-cv" 'texinfo-insert-@var) |
68 (define-key texinfo-mode-map "\C-c\C-cs" 'texinfo-insert-@samp) | 69 (define-key texinfo-mode-map "\C-c\C-cs" 'texinfo-insert-@samp) |
140 (interactive) | 141 (interactive) |
141 (insert "{}") | 142 (insert "{}") |
142 (backward-char)) | 143 (backward-char)) |
143 | 144 |
144 (defun texinfo-mode () | 145 (defun texinfo-mode () |
145 "Major mode for editing texinfo files. | 146 "Major mode for editing Texinfo files. |
146 | 147 |
147 It has these extra commands: | 148 It has these extra commands: |
148 \\{texinfo-mode-map} | 149 \\{texinfo-mode-map} |
149 | 150 |
150 These are files that are used as input for tex to make printed manuals | 151 These are files that are used as input for TeX to make printed manuals |
151 and also to be turned into Info files by \\[texinfo-format-buffer]. | 152 and also to be turned into Info files by \\[texinfo-format-buffer] or |
152 These files must be written in a very restricted and modified version | 153 `makeinfo'. These files must be written in a very restricted and |
153 of tex input format. | 154 modified version of TeX input format. |
154 | 155 |
155 Editing commands are like text-mode except that the syntax table is | 156 Editing commands are like text-mode except that the syntax table is |
156 set up so expression commands skip texinfo bracket groups. To see | 157 set up so expression commands skip Texinfo bracket groups. To see |
157 what the Info version of a region of the texinfo file will look like, | 158 what the Info version of a region of the Texinfo file will look like, |
158 use \\[texinfo-format-region]. This command runs Info on the current region | 159 use \\[texinfo-format-region]. This command runs Info on the current region |
159 of the texinfo file and formats it properly. | 160 of the Texinfo file and formats it properly. |
160 | 161 |
161 You can show the structure of a texinfo file with \\[texinfo-show-structure]. | 162 You can show the structure of a Texinfo file with \\[texinfo-show-structure]. |
162 This command shows the structure of a texinfo file by listing the | 163 This command shows the structure of a Texinfo file by listing the |
163 lines with the @-sign commands for @node, @chapter, @section and the | 164 lines with the @-sign commands for @chapter, @section, and the like. |
164 like. These lines are displayed in another window called the *Occur* | 165 These lines are displayed in another window called the *Occur* window. |
165 window. In that window, you can position the cursor over one of the | 166 In that window, you can position the cursor over one of the lines and |
166 lines and use \\[occur-mode-goto-occurrence], to jump to the | 167 use \\[occur-mode-goto-occurrence], to jump to the corresponding spot |
167 corresponding spot in the texinfo file. | 168 in the Texinfo file. |
168 | 169 |
169 In addition, texinfo mode provides commands that insert various | 170 In addition, Texinfo mode provides commands that insert various |
170 frequently used @-sign commands into the buffer. You can use these | 171 frequently used @-sign commands into the buffer. You can use these |
171 commands to save keystrokes. And you can insert balanced braces with | 172 commands to save keystrokes. And you can insert balanced braces with |
172 \\[texinfo-insert-braces] and later use the command \\[up-list] to | 173 \\[texinfo-insert-braces] and later use the command \\[up-list] to |
173 move forward past the closing brace. | 174 move forward past the closing brace. |
174 | 175 |
175 Also, texinfo mode provides functions for automatically creating or | 176 Also, Texinfo mode provides functions for automatically creating or |
176 updating menus and node pointers. These functions | 177 updating menus and node pointers. These functions |
177 | 178 |
178 * insert the `Next', `Previous' and `Up' pointers of a node, | 179 * insert the `Next', `Previous' and `Up' pointers of a node, |
179 * insert or update the menu for a section, and | 180 * insert or update the menu for a section, and |
180 * create a master menu for a texinfo source file. | 181 * create a master menu for a Texinfo source file. |
181 | 182 |
182 Here are the functions: | 183 Here are the functions: |
183 | 184 |
184 texinfo-update-node \\[texinfo-update-node] | 185 texinfo-update-node \\[texinfo-update-node] |
185 texinfo-every-node-update \\[texinfo-every-node-update] | 186 texinfo-every-node-update \\[texinfo-every-node-update] |
196 | 197 |
197 Passed an argument (a prefix argument, if interactive), the | 198 Passed an argument (a prefix argument, if interactive), the |
198 `texinfo-update-node' and `texinfo-make-menu' functions do their jobs | 199 `texinfo-update-node' and `texinfo-make-menu' functions do their jobs |
199 in the region. | 200 in the region. |
200 | 201 |
201 To use the updating commands, you must structure your texinfo file | 202 To use the updating commands, you must structure your Texinfo file |
202 hierarchically, such that each `@node' line, with the exception of the | 203 hierarchically, such that each `@node' line, with the exception of the |
203 top node, is accompanied by some kind of section line, such as an | 204 Top node, is accompanied by some kind of section line, such as an |
204 `@chapter' or `@section' line. | 205 `@chapter' or `@section' line. |
205 | 206 |
206 If the file has a `top' node, it must be called `top' or `Top' and | 207 If the file has a `top' node, it must be called `top' or `Top' and |
207 be the first node in the file. | 208 be the first node in the file. |
208 | 209 |
209 Entering texinfo mode calls the value of text-mode-hook, and then the | 210 Entering Texinfo mode calls the value of text-mode-hook, and then the |
210 value of texinfo-mode-hook." | 211 value of texinfo-mode-hook." |
211 (interactive) | 212 (interactive) |
212 (text-mode) | 213 (text-mode) |
213 (setq mode-name "texinfo") | 214 (setq mode-name "texinfo") |
214 (setq major-mode 'texinfo-mode) | 215 (setq major-mode 'texinfo-mode) |
235 (make-local-variable 'tex-trailer) | 236 (make-local-variable 'tex-trailer) |
236 (setq tex-trailer "@bye\n") | 237 (setq tex-trailer "@bye\n") |
237 (run-hooks 'text-mode-hook 'texinfo-mode-hook)) | 238 (run-hooks 'text-mode-hook 'texinfo-mode-hook)) |
238 | 239 |
239 | 240 |
240 (defvar texinfo-heading-pattern | 241 ;;; Texinfo file structure |
241 "^@\\(chapter\\|unnum\\|appendix\\|sect\\|sub\\|heading\\|major\\|node\\)" | |
242 "Regexp matching @node and chapter, section, and other headings.") | |
243 | 242 |
244 ; The following is defined in `texnfo-upd.el' | 243 ; The following is defined in `texnfo-upd.el' |
245 ; (defvar texinfo-section-types-regexp | 244 ; (defvar texinfo-section-types-regexp |
246 ; "^@\\(chapter \\|sect\\|sub\\|unnum\\|major\\|heading \\|appendix\\)" | 245 ; "^@\\(chapter \\|sect\\|sub\\|unnum\\|major\\|heading \\|appendix\\)" |
247 ; "Regexp matching chapter, section, other headings (but not the top node).") | 246 ; "Regexp matching chapter, section, other headings (but not the top node).") |
248 | 247 |
249 (defun texinfo-show-structure (&optional sections-only) | 248 (defun texinfo-show-structure (&optional nodes-too) |
250 "Show the structure of a Texinfo file. | 249 "Show the structure of a Texinfo file. |
251 With optional argument (prefix if interactive), list lines with @-sign | 250 List the lines in the file that begin with the @-sign commands for |
252 commands for @chapter, @section and the like. With no argument, list | 251 @chapter, @section, and the like. |
253 both the lines with @-sign commands for @chapter, @section and the | 252 |
254 like and list @node lines. | 253 With optional argument (prefix if interactive), list both the lines |
254 with @-sign commands for @chapter, @section, and the like, and list | |
255 @node lines. | |
255 | 256 |
256 Lines with structuring commands beginning in them are displayed in | 257 Lines with structuring commands beginning in them are displayed in |
257 another window called the *Occur* window. In that window, you can | 258 another window called the *Occur* window. In that window, you can |
258 position the cursor over one of the lines and use | 259 position the cursor over one of the lines and use |
259 \\[occur-mode-goto-occurrence], to jump to the corresponding spot in | 260 \\[occur-mode-goto-occurrence], |
260 the texinfo file." | 261 to jump to the corresponding spot in the Texinfo file." |
261 | 262 |
262 (interactive "P") | 263 (interactive "P") |
263 (save-excursion | 264 (save-excursion |
264 (goto-char (point-min)) | 265 (goto-char (point-min)) |
265 (if sections-only | 266 (if nodes-too |
266 (occur texinfo-section-types-regexp) | 267 (occur (concat "\\(^@node\\)\\|" texinfo-section-types-regexp)) |
267 (occur texinfo-heading-pattern))) | 268 (occur texinfo-section-types-regexp))) |
268 (pop-to-buffer "*Occur*") | 269 (pop-to-buffer "*Occur*") |
269 (goto-char (point-min)) | 270 (goto-char (point-min)) |
270 (flush-lines "-----")) | 271 (flush-lines "-----")) |
271 | 272 |
272 | 273 |