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