diff options
| author | Richard M. Stallman | 1997-08-04 01:11:01 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1997-08-04 01:11:01 +0000 |
| commit | d1f9f44105913bb30fc2174579c270d677e6d27e (patch) | |
| tree | 39fe9b124cdda8623f47c3c9796ba430eb66d304 | |
| parent | 07f458c1df89b8580e3528cc76a535a85e1f7b9e (diff) | |
| download | emacs-d1f9f44105913bb30fc2174579c270d677e6d27e.tar.gz emacs-d1f9f44105913bb30fc2174579c270d677e6d27e.zip | |
Delete whitespace.
| -rw-r--r-- | lisp/textmodes/texnfo-upd.el | 372 |
1 files changed, 186 insertions, 186 deletions
diff --git a/lisp/textmodes/texnfo-upd.el b/lisp/textmodes/texnfo-upd.el index 516c1a6130b..90599d31f29 100644 --- a/lisp/textmodes/texnfo-upd.el +++ b/lisp/textmodes/texnfo-upd.el | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Robert J. Chassell | 5 | ;; Author: Robert J. Chassell |
| 6 | ;; Maintainer: bug-texinfo@prep.ai.mit.edu | 6 | ;; Maintainer: bug-texinfo@prep.ai.mit.edu |
| 7 | ;; Keywords: maint, tex, docs | 7 | ;; Keywords: maint, tex, docs |
| 8 | 8 | ||
| @@ -33,28 +33,28 @@ | |||
| 33 | 33 | ||
| 34 | ;; * insert missing `@node' lines, | 34 | ;; * insert missing `@node' lines, |
| 35 | ;; * insert the `Next', `Previous' and `Up' pointers of a node, | 35 | ;; * insert the `Next', `Previous' and `Up' pointers of a node, |
| 36 | ;; * insert or update the menu for a section, | 36 | ;; * insert or update the menu for a section, |
| 37 | ;; * create a master menu for a Texinfo source file. | 37 | ;; * create a master menu for a Texinfo source file. |
| 38 | ;; | 38 | ;; |
| 39 | ;; With a prefix argument, the `texinfo-update-node' and | 39 | ;; With a prefix argument, the `texinfo-update-node' and |
| 40 | ;; `texinfo-make-menu' functions do their jobs in the region. | 40 | ;; `texinfo-make-menu' functions do their jobs in the region. |
| 41 | ;; | 41 | ;; |
| 42 | ;; In brief, the functions for creating or updating nodes and menus, are: | 42 | ;; In brief, the functions for creating or updating nodes and menus, are: |
| 43 | ;; | 43 | ;; |
| 44 | ;; texinfo-update-node (&optional beginning end) | 44 | ;; texinfo-update-node (&optional beginning end) |
| 45 | ;; texinfo-every-node-update () | 45 | ;; texinfo-every-node-update () |
| 46 | ;; texinfo-sequential-node-update (&optional region-p) | 46 | ;; texinfo-sequential-node-update (&optional region-p) |
| 47 | ;; | 47 | ;; |
| 48 | ;; texinfo-make-menu (&optional beginning end) | 48 | ;; texinfo-make-menu (&optional beginning end) |
| 49 | ;; texinfo-all-menus-update () | 49 | ;; texinfo-all-menus-update () |
| 50 | ;; texinfo-master-menu () | 50 | ;; texinfo-master-menu () |
| 51 | ;; | 51 | ;; |
| 52 | ;; texinfo-insert-node-lines (&optional title-p) | 52 | ;; texinfo-insert-node-lines (&optional title-p) |
| 53 | ;; | 53 | ;; |
| 54 | ;; texinfo-indent-menu-description (column &optional region-p) | 54 | ;; texinfo-indent-menu-description (column &optional region-p) |
| 55 | 55 | ||
| 56 | ;; The `texinfo-column-for-description' variable specifies the column to | 56 | ;; The `texinfo-column-for-description' variable specifies the column to |
| 57 | ;; which menu descriptions are indented. | 57 | ;; which menu descriptions are indented. |
| 58 | 58 | ||
| 59 | ;; Texinfo file structure | 59 | ;; Texinfo file structure |
| 60 | ;; ---------------------- | 60 | ;; ---------------------- |
| @@ -137,16 +137,16 @@ | |||
| 137 | ;; The `texinfo-insert-node-lines' function inserts `@node' before the | 137 | ;; The `texinfo-insert-node-lines' function inserts `@node' before the |
| 138 | ;; `@chapter', `@section', and such like lines of a region in a Texinfo | 138 | ;; `@chapter', `@section', and such like lines of a region in a Texinfo |
| 139 | ;; file where the `@node' lines are missing. | 139 | ;; file where the `@node' lines are missing. |
| 140 | ;; | 140 | ;; |
| 141 | ;; With a non-nil argument (prefix, if interactive), the function not | 141 | ;; With a non-nil argument (prefix, if interactive), the function not |
| 142 | ;; only inserts `@node' lines but also inserts the chapter or section | 142 | ;; only inserts `@node' lines but also inserts the chapter or section |
| 143 | ;; titles as the names of the corresponding nodes; and inserts titles | 143 | ;; titles as the names of the corresponding nodes; and inserts titles |
| 144 | ;; as node names in pre-existing `@node' lines that lack names. | 144 | ;; as node names in pre-existing `@node' lines that lack names. |
| 145 | ;; | 145 | ;; |
| 146 | ;; Since node names should be more concise than section or chapter | 146 | ;; Since node names should be more concise than section or chapter |
| 147 | ;; titles, node names so inserted will need to be edited manually. | 147 | ;; titles, node names so inserted will need to be edited manually. |
| 148 | 148 | ||
| 149 | 149 | ||
| 150 | ;;; Code: | 150 | ;;; Code: |
| 151 | 151 | ||
| 152 | (defvar texinfo-master-menu-header | 152 | (defvar texinfo-master-menu-header |
| @@ -165,7 +165,7 @@ Whenever a menu exists, and is being updated, the descriptions that | |||
| 165 | are associated with node names in the pre-existing menu are | 165 | are associated with node names in the pre-existing menu are |
| 166 | incorporated into the new menu. Otherwise, the nodes' section titles | 166 | incorporated into the new menu. Otherwise, the nodes' section titles |
| 167 | are inserted as descriptions." | 167 | are inserted as descriptions." |
| 168 | 168 | ||
| 169 | (interactive | 169 | (interactive |
| 170 | (if prefix-arg | 170 | (if prefix-arg |
| 171 | (list (point) (mark)))) | 171 | (list (point) (mark)))) |
| @@ -182,11 +182,11 @@ are inserted as descriptions." | |||
| 182 | (region-end (max beginning end))) | 182 | (region-end (max beginning end))) |
| 183 | (save-restriction | 183 | (save-restriction |
| 184 | (widen) | 184 | (widen) |
| 185 | 185 | ||
| 186 | (while (texinfo-find-lower-level-node level region-end) | 186 | (while (texinfo-find-lower-level-node level region-end) |
| 187 | (setq level (texinfo-hierarchic-level)) ; new, lower level | 187 | (setq level (texinfo-hierarchic-level)) ; new, lower level |
| 188 | (texinfo-make-one-menu level)) | 188 | (texinfo-make-one-menu level)) |
| 189 | 189 | ||
| 190 | (while (and (< (point) region-end) | 190 | (while (and (< (point) region-end) |
| 191 | (texinfo-find-higher-level-node level region-end)) | 191 | (texinfo-find-higher-level-node level region-end)) |
| 192 | (setq level (texinfo-hierarchic-level)) | 192 | (setq level (texinfo-hierarchic-level)) |
| @@ -197,7 +197,7 @@ are inserted as descriptions." | |||
| 197 | 197 | ||
| 198 | (defun texinfo-make-one-menu (level) | 198 | (defun texinfo-make-one-menu (level) |
| 199 | "Make a menu of all the appropriate nodes in this section. | 199 | "Make a menu of all the appropriate nodes in this section. |
| 200 | `Appropriate nodes' are those associated with sections that are | 200 | `Appropriate nodes' are those associated with sections that are |
| 201 | at the level specified by LEVEL. Point is left at the end of menu." | 201 | at the level specified by LEVEL. Point is left at the end of menu." |
| 202 | (let* | 202 | (let* |
| 203 | ((case-fold-search t) | 203 | ((case-fold-search t) |
| @@ -238,7 +238,7 @@ nodes in the buffer before updating the menus." | |||
| 238 | (progn | 238 | (progn |
| 239 | ;; Check if @detailmenu kludge is used; | 239 | ;; Check if @detailmenu kludge is used; |
| 240 | ;; if so, leave point before @detailmenu. | 240 | ;; if so, leave point before @detailmenu. |
| 241 | (search-backward "\n@detailmenu" | 241 | (search-backward "\n@detailmenu" |
| 242 | (save-excursion (forward-line -3) (point)) | 242 | (save-excursion (forward-line -3) (point)) |
| 243 | t) | 243 | t) |
| 244 | ;; Remove detailed master menu listing | 244 | ;; Remove detailed master menu listing |
| @@ -250,28 +250,28 @@ nodes in the buffer before updating the menus." | |||
| 250 | (beginning-of-line) (forward-char -1) | 250 | (beginning-of-line) (forward-char -1) |
| 251 | (point)))) | 251 | (point)))) |
| 252 | (delete-region (point) end-of-detailed-menu-descriptions))))) | 252 | (delete-region (point) end-of-detailed-menu-descriptions))))) |
| 253 | 253 | ||
| 254 | (if update-all-nodes-p | 254 | (if update-all-nodes-p |
| 255 | (progn | 255 | (progn |
| 256 | (message "Updating all nodes in %s ... " (buffer-name)) | 256 | (message "Updating all nodes in %s ... " (buffer-name)) |
| 257 | (sleep-for 2) | 257 | (sleep-for 2) |
| 258 | (texinfo-update-node (point-min) (point-max)))) | 258 | (texinfo-update-node (point-min) (point-max)))) |
| 259 | 259 | ||
| 260 | (message "Updating all menus in %s ... " (buffer-name)) | 260 | (message "Updating all menus in %s ... " (buffer-name)) |
| 261 | (sleep-for 2) | 261 | (sleep-for 2) |
| 262 | (texinfo-make-menu (point-max) (point-min)) | 262 | (texinfo-make-menu (point-max) (point-min)) |
| 263 | 263 | ||
| 264 | (if master-menu-p | 264 | (if master-menu-p |
| 265 | (progn | 265 | (progn |
| 266 | (message "Updating the master menu in %s... " (buffer-name)) | 266 | (message "Updating the master menu in %s... " (buffer-name)) |
| 267 | (sleep-for 2) | 267 | (sleep-for 2) |
| 268 | (texinfo-master-menu nil)))) | 268 | (texinfo-master-menu nil)))) |
| 269 | 269 | ||
| 270 | (message "Done...updated all the menus. You may save the buffer."))) | 270 | (message "Done...updated all the menus. You may save the buffer."))) |
| 271 | 271 | ||
| 272 | (defun texinfo-find-lower-level-node (level region-end) | 272 | (defun texinfo-find-lower-level-node (level region-end) |
| 273 | "Search forward from point for node at any level lower than LEVEL. | 273 | "Search forward from point for node at any level lower than LEVEL. |
| 274 | Search is limited to the end of the marked region, REGION-END, | 274 | Search is limited to the end of the marked region, REGION-END, |
| 275 | and to the end of the menu region for the level. | 275 | and to the end of the menu region for the level. |
| 276 | 276 | ||
| 277 | Return t if the node is found, else nil. Leave point at the beginning | 277 | Return t if the node is found, else nil. Leave point at the beginning |
| @@ -288,7 +288,7 @@ of the node if one is found; else do not move point." | |||
| 288 | ;; the next higher level node marks the end of this | 288 | ;; the next higher level node marks the end of this |
| 289 | ;; section, and no lower level node will be found beyond | 289 | ;; section, and no lower level node will be found beyond |
| 290 | ;; this position even if region-end is farther off | 290 | ;; this position even if region-end is farther off |
| 291 | (texinfo-update-menu-region-end level) | 291 | (texinfo-update-menu-region-end level) |
| 292 | t)) | 292 | t)) |
| 293 | (goto-char (match-beginning 1))))) | 293 | (goto-char (match-beginning 1))))) |
| 294 | 294 | ||
| @@ -321,7 +321,7 @@ of the node if one is found; else do not move point." | |||
| 321 | "Make a list of node names and their descriptions. | 321 | "Make a list of node names and their descriptions. |
| 322 | Point is left at the end of the menu region, but the menu is not inserted. | 322 | Point is left at the end of the menu region, but the menu is not inserted. |
| 323 | 323 | ||
| 324 | First argument is position from which to start making menu list; | 324 | First argument is position from which to start making menu list; |
| 325 | second argument is end of region in which to try to locate entries; | 325 | second argument is end of region in which to try to locate entries; |
| 326 | third argument is the level of the nodes that are the entries. | 326 | third argument is the level of the nodes that are the entries. |
| 327 | 327 | ||
| @@ -331,8 +331,8 @@ element consists only of the node name." | |||
| 331 | (goto-char beginning) | 331 | (goto-char beginning) |
| 332 | (let (new-menu-list) | 332 | (let (new-menu-list) |
| 333 | (while (texinfo-menu-locate-entry-p level end) | 333 | (while (texinfo-menu-locate-entry-p level end) |
| 334 | (setq new-menu-list | 334 | (setq new-menu-list |
| 335 | (cons (cons | 335 | (cons (cons |
| 336 | (texinfo-copy-node-name) | 336 | (texinfo-copy-node-name) |
| 337 | (prog1 "" (forward-line 1))) | 337 | (prog1 "" (forward-line 1))) |
| 338 | ;; Use following to insert section titles automatically. | 338 | ;; Use following to insert section titles automatically. |
| @@ -371,7 +371,7 @@ Start with point at the beginning of the node line; copy the text | |||
| 371 | after the node command up to the first comma on the line, if any, and | 371 | after the node command up to the first comma on the line, if any, and |
| 372 | return the text as a string. Leaves point at the beginning of the | 372 | return the text as a string. Leaves point at the beginning of the |
| 373 | line. If there is no node name, returns an empty string." | 373 | line. If there is no node name, returns an empty string." |
| 374 | 374 | ||
| 375 | (save-excursion | 375 | (save-excursion |
| 376 | (buffer-substring | 376 | (buffer-substring |
| 377 | (progn (forward-word 1) ; skip over node command | 377 | (progn (forward-word 1) ; skip over node command |
| @@ -396,7 +396,7 @@ must have been done by `texinfo-menu-locate-entry-p'." | |||
| 396 | ;; instead of using `match-beginning'; such a variation would be | 396 | ;; instead of using `match-beginning'; such a variation would be |
| 397 | ;; more general, but would waste information already collected | 397 | ;; more general, but would waste information already collected |
| 398 | 398 | ||
| 399 | (goto-char (match-beginning 7)) ; match section name | 399 | (goto-char (match-beginning 7)) ; match section name |
| 400 | 400 | ||
| 401 | (buffer-substring | 401 | (buffer-substring |
| 402 | (progn (forward-word 1) ; skip over section type | 402 | (progn (forward-word 1) ; skip over section type |
| @@ -435,17 +435,17 @@ For this function, the new menu is a list made up of lists of dotted | |||
| 435 | pairs in which the first element of the pair is the node name and the | 435 | pairs in which the first element of the pair is the node name and the |
| 436 | second element the description. The new menu is changed destructively. | 436 | second element the description. The new menu is changed destructively. |
| 437 | The old menu is the menu as it appears in the Texinfo file." | 437 | The old menu is the menu as it appears in the Texinfo file." |
| 438 | 438 | ||
| 439 | (let ((new-menu-list-pointer new-menu-list) | 439 | (let ((new-menu-list-pointer new-menu-list) |
| 440 | (end-of-menu (texinfo-menu-end))) | 440 | (end-of-menu (texinfo-menu-end))) |
| 441 | (while new-menu-list | 441 | (while new-menu-list |
| 442 | (save-excursion ; keep point at beginning of menu | 442 | (save-excursion ; keep point at beginning of menu |
| 443 | (if (re-search-forward | 443 | (if (re-search-forward |
| 444 | ;; Existing nodes can have the form | 444 | ;; Existing nodes can have the form |
| 445 | ;; * NODE NAME:: DESCRIPTION | 445 | ;; * NODE NAME:: DESCRIPTION |
| 446 | ;; or | 446 | ;; or |
| 447 | ;; * MENU ITEM: NODE NAME. DESCRIPTION. | 447 | ;; * MENU ITEM: NODE NAME. DESCRIPTION. |
| 448 | ;; | 448 | ;; |
| 449 | ;; Recognize both when looking for the description. | 449 | ;; Recognize both when looking for the description. |
| 450 | (concat "\\* \\(" ; so only menu entries are found | 450 | (concat "\\* \\(" ; so only menu entries are found |
| 451 | (regexp-quote (car (car new-menu-list))) "::" | 451 | (regexp-quote (car (car new-menu-list))) "::" |
| @@ -454,10 +454,10 @@ The old menu is the menu as it appears in the Texinfo file." | |||
| 454 | "\\)" | 454 | "\\)" |
| 455 | ) ; so only complete entries are found | 455 | ) ; so only complete entries are found |
| 456 | end-of-menu | 456 | end-of-menu |
| 457 | t) | 457 | t) |
| 458 | (setcdr (car new-menu-list) | 458 | (setcdr (car new-menu-list) |
| 459 | (texinfo-menu-copy-old-description end-of-menu)))) | 459 | (texinfo-menu-copy-old-description end-of-menu)))) |
| 460 | (setq new-menu-list (cdr new-menu-list))) | 460 | (setq new-menu-list (cdr new-menu-list))) |
| 461 | (setq new-menu-list new-menu-list-pointer))) | 461 | (setq new-menu-list new-menu-list-pointer))) |
| 462 | 462 | ||
| 463 | (defun texinfo-incorporate-menu-entry-names (new-menu-list) | 463 | (defun texinfo-incorporate-menu-entry-names (new-menu-list) |
| @@ -478,17 +478,17 @@ name and the cdr is the node name. | |||
| 478 | 478 | ||
| 479 | NEW-MENU-LIST is changed destructively. The old menu is the menu as it | 479 | NEW-MENU-LIST is changed destructively. The old menu is the menu as it |
| 480 | appears in the texinfo file." | 480 | appears in the texinfo file." |
| 481 | 481 | ||
| 482 | (let ((new-menu-list-pointer new-menu-list) | 482 | (let ((new-menu-list-pointer new-menu-list) |
| 483 | (end-of-menu (texinfo-menu-end))) | 483 | (end-of-menu (texinfo-menu-end))) |
| 484 | (while new-menu-list | 484 | (while new-menu-list |
| 485 | (save-excursion ; keep point at beginning of menu | 485 | (save-excursion ; keep point at beginning of menu |
| 486 | (if (re-search-forward | 486 | (if (re-search-forward |
| 487 | ;; Existing nodes can have the form | 487 | ;; Existing nodes can have the form |
| 488 | ;; * NODE NAME:: DESCRIPTION | 488 | ;; * NODE NAME:: DESCRIPTION |
| 489 | ;; or | 489 | ;; or |
| 490 | ;; * MENU ITEM: NODE NAME. DESCRIPTION. | 490 | ;; * MENU ITEM: NODE NAME. DESCRIPTION. |
| 491 | ;; | 491 | ;; |
| 492 | ;; We're interested in the second case. | 492 | ;; We're interested in the second case. |
| 493 | (concat "\\* " ; so only menu entries are found | 493 | (concat "\\* " ; so only menu entries are found |
| 494 | "\\(.*\\): " (car (car new-menu-list)) "[.,\t\n]") | 494 | "\\(.*\\): " (car (car new-menu-list)) "[.,\t\n]") |
| @@ -509,8 +509,8 @@ Single argument, END-OF-MENU, is position limiting search." | |||
| 509 | ;; don't copy a carriage return at line beginning with asterisk! | 509 | ;; don't copy a carriage return at line beginning with asterisk! |
| 510 | ;; do copy a description that begins with an `@'! | 510 | ;; do copy a description that begins with an `@'! |
| 511 | ;; !! Known bug: does not copy descriptions starting with ^|\{?* etc. | 511 | ;; !! Known bug: does not copy descriptions starting with ^|\{?* etc. |
| 512 | (if (and (looking-at "\\(\\w+\\|@\\)") | 512 | (if (and (looking-at "\\(\\w+\\|@\\)") |
| 513 | (not (looking-at "\\(^\\* \\|^@end menu\\)"))) | 513 | (not (looking-at "\\(^\\* \\|^@end menu\\)"))) |
| 514 | (buffer-substring | 514 | (buffer-substring |
| 515 | (point) | 515 | (point) |
| 516 | (save-excursion | 516 | (save-excursion |
| @@ -554,7 +554,7 @@ texinfo-column-for-description. | |||
| 554 | 554 | ||
| 555 | MENU-LIST has form: | 555 | MENU-LIST has form: |
| 556 | 556 | ||
| 557 | \(\(\"node-name1\" . \"description\"\) | 557 | \(\(\"node-name1\" . \"description\"\) |
| 558 | \(\"node-name2\" . \"description\"\) ... \) | 558 | \(\"node-name2\" . \"description\"\) ... \) |
| 559 | 559 | ||
| 560 | However, the description field might be nil. | 560 | However, the description field might be nil. |
| @@ -562,54 +562,54 @@ However, the description field might be nil. | |||
| 562 | Also, the node-name field might itself be a dotted pair (call it P) of | 562 | Also, the node-name field might itself be a dotted pair (call it P) of |
| 563 | strings instead of just a string. In that case, the car of P | 563 | strings instead of just a string. In that case, the car of P |
| 564 | is the menu entry name, and the cdr of P is the node name." | 564 | is the menu entry name, and the cdr of P is the node name." |
| 565 | 565 | ||
| 566 | (insert "@menu\n") | 566 | (insert "@menu\n") |
| 567 | (while menu-list | 567 | (while menu-list |
| 568 | ;; Every menu entry starts with a star and a space. | 568 | ;; Every menu entry starts with a star and a space. |
| 569 | (insert "* ") | 569 | (insert "* ") |
| 570 | 570 | ||
| 571 | ;; Insert the node name (and menu entry name, if present). | 571 | ;; Insert the node name (and menu entry name, if present). |
| 572 | (let ((node-part (car (car menu-list)))) | 572 | (let ((node-part (car (car menu-list)))) |
| 573 | (if (stringp node-part) | 573 | (if (stringp node-part) |
| 574 | ;; "Double colon" entry line; menu entry and node name are the same, | 574 | ;; "Double colon" entry line; menu entry and node name are the same, |
| 575 | (insert (format "%s::" node-part)) | 575 | (insert (format "%s::" node-part)) |
| 576 | ;; "Single colon" entry line; menu entry and node name are different. | 576 | ;; "Single colon" entry line; menu entry and node name are different. |
| 577 | (insert (format "%s: %s." (car node-part) (cdr node-part))))) | 577 | (insert (format "%s: %s." (car node-part) (cdr node-part))))) |
| 578 | 578 | ||
| 579 | ;; Insert the description, if present. | 579 | ;; Insert the description, if present. |
| 580 | (if (cdr (car menu-list)) | 580 | (if (cdr (car menu-list)) |
| 581 | (progn | 581 | (progn |
| 582 | ;; Move to right place. | 582 | ;; Move to right place. |
| 583 | (indent-to texinfo-column-for-description 2) | 583 | (indent-to texinfo-column-for-description 2) |
| 584 | ;; Insert description. | 584 | ;; Insert description. |
| 585 | (insert (format "%s" (cdr (car menu-list)))))) | 585 | (insert (format "%s" (cdr (car menu-list)))))) |
| 586 | 586 | ||
| 587 | (insert "\n") ; end this menu entry | 587 | (insert "\n") ; end this menu entry |
| 588 | (setq menu-list (cdr menu-list))) | 588 | (setq menu-list (cdr menu-list))) |
| 589 | (insert "@end menu") | 589 | (insert "@end menu") |
| 590 | (message | 590 | (message |
| 591 | "Updated \"%s\" level menu following node: %s ... " level node-name)) | 591 | "Updated \"%s\" level menu following node: %s ... " level node-name)) |
| 592 | 592 | ||
| 593 | 593 | ||
| 594 | ;;; Starting menu descriptions by inserting titles | 594 | ;;; Starting menu descriptions by inserting titles |
| 595 | 595 | ||
| 596 | (defun texinfo-start-menu-description () | 596 | (defun texinfo-start-menu-description () |
| 597 | "In this menu entry, insert the node's section title as a description. | 597 | "In this menu entry, insert the node's section title as a description. |
| 598 | Position point at beginning of description ready for editing. | 598 | Position point at beginning of description ready for editing. |
| 599 | Do not insert a title if the line contains an existing description. | 599 | Do not insert a title if the line contains an existing description. |
| 600 | 600 | ||
| 601 | You will need to edit the inserted text since a useful description | 601 | You will need to edit the inserted text since a useful description |
| 602 | complements the node name rather than repeats it as a title does." | 602 | complements the node name rather than repeats it as a title does." |
| 603 | 603 | ||
| 604 | (interactive) | 604 | (interactive) |
| 605 | (let (beginning end node-name title) | 605 | (let (beginning end node-name title) |
| 606 | (save-excursion | 606 | (save-excursion |
| 607 | (beginning-of-line) | 607 | (beginning-of-line) |
| 608 | (if (search-forward "* " (save-excursion (end-of-line) (point)) t) | 608 | (if (search-forward "* " (save-excursion (end-of-line) (point)) t) |
| 609 | (progn (skip-chars-forward " \t") | 609 | (progn (skip-chars-forward " \t") |
| 610 | (setq beginning (point))) | 610 | (setq beginning (point))) |
| 611 | (error "This is not a line in a menu!")) | 611 | (error "This is not a line in a menu!")) |
| 612 | 612 | ||
| 613 | (cond | 613 | (cond |
| 614 | ;; "Double colon" entry line; menu entry and node name are the same, | 614 | ;; "Double colon" entry line; menu entry and node name are the same, |
| 615 | ((search-forward "::" (save-excursion (end-of-line) (point)) t) | 615 | ((search-forward "::" (save-excursion (end-of-line) (point)) t) |
| @@ -617,12 +617,12 @@ complements the node name rather than repeats it as a title does." | |||
| 617 | (error "Descriptive text already exists.")) | 617 | (error "Descriptive text already exists.")) |
| 618 | (skip-chars-backward ": \t") | 618 | (skip-chars-backward ": \t") |
| 619 | (setq node-name (buffer-substring beginning (point)))) | 619 | (setq node-name (buffer-substring beginning (point)))) |
| 620 | 620 | ||
| 621 | ;; "Single colon" entry line; menu entry and node name are different. | 621 | ;; "Single colon" entry line; menu entry and node name are different. |
| 622 | ((search-forward ":" (save-excursion (end-of-line) (point)) t) | 622 | ((search-forward ":" (save-excursion (end-of-line) (point)) t) |
| 623 | (skip-chars-forward " \t") | 623 | (skip-chars-forward " \t") |
| 624 | (setq beginning (point)) | 624 | (setq beginning (point)) |
| 625 | ;; Menu entry line ends in a period, comma, or tab. | 625 | ;; Menu entry line ends in a period, comma, or tab. |
| 626 | (if (re-search-forward "[.,\t]" | 626 | (if (re-search-forward "[.,\t]" |
| 627 | (save-excursion (forward-line 1) (point)) t) | 627 | (save-excursion (forward-line 1) (point)) t) |
| 628 | (progn | 628 | (progn |
| @@ -641,7 +641,7 @@ complements the node name rather than repeats it as a title does." | |||
| 641 | (t (error "No node name on this line."))) | 641 | (t (error "No node name on this line."))) |
| 642 | ;; Search for node that matches node name, and copy the section title. | 642 | ;; Search for node that matches node name, and copy the section title. |
| 643 | (if (re-search-forward | 643 | (if (re-search-forward |
| 644 | (concat | 644 | (concat |
| 645 | "^@node[ \t]+" | 645 | "^@node[ \t]+" |
| 646 | node-name | 646 | node-name |
| 647 | ".*\n" ; match node line | 647 | ".*\n" ; match node line |
| @@ -655,9 +655,9 @@ complements the node name rather than repeats it as a title does." | |||
| 655 | (setq title | 655 | (setq title |
| 656 | (buffer-substring | 656 | (buffer-substring |
| 657 | ;; skip over section type | 657 | ;; skip over section type |
| 658 | (progn (forward-word 1) | 658 | (progn (forward-word 1) |
| 659 | ;; and over spaces | 659 | ;; and over spaces |
| 660 | (skip-chars-forward " \t") | 660 | (skip-chars-forward " \t") |
| 661 | (point)) | 661 | (point)) |
| 662 | (progn (end-of-line) | 662 | (progn (end-of-line) |
| 663 | (skip-chars-backward " \t") | 663 | (skip-chars-backward " \t") |
| @@ -678,11 +678,11 @@ complements the node name rather than repeats it as a title does." | |||
| 678 | ;; are useful primarily for indenting a single menu specially. | 678 | ;; are useful primarily for indenting a single menu specially. |
| 679 | 679 | ||
| 680 | (defun texinfo-indent-menu-description (column &optional region-p) | 680 | (defun texinfo-indent-menu-description (column &optional region-p) |
| 681 | "Indent every description in menu following point to COLUMN. | 681 | "Indent every description in menu following point to COLUMN. |
| 682 | Non-nil argument (prefix, if interactive) means indent every | 682 | Non-nil argument (prefix, if interactive) means indent every |
| 683 | description in every menu in the region. Does not indent second and | 683 | description in every menu in the region. Does not indent second and |
| 684 | subsequent lines of a multi-line description." | 684 | subsequent lines of a multi-line description." |
| 685 | 685 | ||
| 686 | (interactive | 686 | (interactive |
| 687 | "nIndent menu descriptions to (column number): \nP") | 687 | "nIndent menu descriptions to (column number): \nP") |
| 688 | (save-excursion | 688 | (save-excursion |
| @@ -715,8 +715,8 @@ second and subsequent lines of a multi-line description." | |||
| 715 | (beginning-of-line) | 715 | (beginning-of-line) |
| 716 | (point))) | 716 | (point))) |
| 717 | 717 | ||
| 718 | (if (re-search-forward "\\* \\(.*::\\|.*: [^.,\t\n]+[.,\t]\\)" | 718 | (if (re-search-forward "\\* \\(.*::\\|.*: [^.,\t\n]+[.,\t]\\)" |
| 719 | (texinfo-menu-end) | 719 | (texinfo-menu-end) |
| 720 | t) | 720 | t) |
| 721 | (progn | 721 | (progn |
| 722 | (let ((beginning-white-space (point))) | 722 | (let ((beginning-white-space (point))) |
| @@ -727,7 +727,7 @@ second and subsequent lines of a multi-line description." | |||
| 727 | (delete-region beginning-white-space (point)) | 727 | (delete-region beginning-white-space (point)) |
| 728 | (indent-to-column to-column-number)))))) | 728 | (indent-to-column to-column-number)))))) |
| 729 | ;; position point at beginning of next line | 729 | ;; position point at beginning of next line |
| 730 | (forward-line 1) | 730 | (forward-line 1) |
| 731 | (setq beginning-of-next-line (point))))) | 731 | (setq beginning-of-next-line (point))))) |
| 732 | 732 | ||
| 733 | 733 | ||
| @@ -765,17 +765,17 @@ recommendation in the Texinfo Manual: | |||
| 765 | 765 | ||
| 766 | Each of the menus in the detailed node listing is introduced by the | 766 | Each of the menus in the detailed node listing is introduced by the |
| 767 | title of the section containing the menu." | 767 | title of the section containing the menu." |
| 768 | 768 | ||
| 769 | (interactive "P") | 769 | (interactive "P") |
| 770 | (let ((case-fold-search t)) | 770 | (let ((case-fold-search t)) |
| 771 | (widen) | 771 | (widen) |
| 772 | (goto-char (point-min)) | 772 | (goto-char (point-min)) |
| 773 | 773 | ||
| 774 | ;; Move point to location after `top'. | 774 | ;; Move point to location after `top'. |
| 775 | (if (not (re-search-forward "^@node [ \t]*top[ \t]*\\(,\\|$\\)" nil t)) | 775 | (if (not (re-search-forward "^@node [ \t]*top[ \t]*\\(,\\|$\\)" nil t)) |
| 776 | (error "This buffer needs a Top node!")) | 776 | (error "This buffer needs a Top node!")) |
| 777 | 777 | ||
| 778 | (let ((first-chapter | 778 | (let ((first-chapter |
| 779 | (save-excursion | 779 | (save-excursion |
| 780 | (or (re-search-forward "^@node" nil t) | 780 | (or (re-search-forward "^@node" nil t) |
| 781 | (error "Too few nodes for a master menu!")) | 781 | (error "Too few nodes for a master menu!")) |
| @@ -784,7 +784,7 @@ title of the section containing the menu." | |||
| 784 | (progn | 784 | (progn |
| 785 | ;; Check if @detailmenu kludge is used; | 785 | ;; Check if @detailmenu kludge is used; |
| 786 | ;; if so, leave point before @detailmenu. | 786 | ;; if so, leave point before @detailmenu. |
| 787 | (search-backward "\n@detailmenu" | 787 | (search-backward "\n@detailmenu" |
| 788 | (save-excursion (forward-line -3) (point)) | 788 | (save-excursion (forward-line -3) (point)) |
| 789 | t) | 789 | t) |
| 790 | ;; Remove detailed master menu listing | 790 | ;; Remove detailed master menu listing |
| @@ -795,36 +795,36 @@ title of the section containing the menu." | |||
| 795 | (beginning-of-line) (forward-char -1) | 795 | (beginning-of-line) (forward-char -1) |
| 796 | (point)))) | 796 | (point)))) |
| 797 | (delete-region (point) end-of-detailed-menu-descriptions))))) | 797 | (delete-region (point) end-of-detailed-menu-descriptions))))) |
| 798 | 798 | ||
| 799 | (if update-all-nodes-menus-p | 799 | (if update-all-nodes-menus-p |
| 800 | (progn | 800 | (progn |
| 801 | (message "Making a master menu in %s ...first updating all nodes... " | 801 | (message "Making a master menu in %s ...first updating all nodes... " |
| 802 | (buffer-name)) | 802 | (buffer-name)) |
| 803 | (sleep-for 2) | 803 | (sleep-for 2) |
| 804 | (texinfo-update-node (point-min) (point-max)) | 804 | (texinfo-update-node (point-min) (point-max)) |
| 805 | 805 | ||
| 806 | (message "Updating all menus in %s ... " (buffer-name)) | 806 | (message "Updating all menus in %s ... " (buffer-name)) |
| 807 | (sleep-for 2) | 807 | (sleep-for 2) |
| 808 | (texinfo-make-menu (point-min) (point-max)))) | 808 | (texinfo-make-menu (point-min) (point-max)))) |
| 809 | 809 | ||
| 810 | (message "Now making the master menu in %s... " (buffer-name)) | 810 | (message "Now making the master menu in %s... " (buffer-name)) |
| 811 | (sleep-for 2) | 811 | (sleep-for 2) |
| 812 | (goto-char (point-min)) | 812 | (goto-char (point-min)) |
| 813 | (texinfo-insert-master-menu-list | 813 | (texinfo-insert-master-menu-list |
| 814 | (texinfo-master-menu-list)) | 814 | (texinfo-master-menu-list)) |
| 815 | 815 | ||
| 816 | ;; Remove extra newlines that texinfo-insert-master-menu-list | 816 | ;; Remove extra newlines that texinfo-insert-master-menu-list |
| 817 | ;; may have inserted. | 817 | ;; may have inserted. |
| 818 | 818 | ||
| 819 | (save-excursion | 819 | (save-excursion |
| 820 | (goto-char (point-min)) | 820 | (goto-char (point-min)) |
| 821 | 821 | ||
| 822 | (if (search-forward texinfo-master-menu-header nil t) | 822 | (if (search-forward texinfo-master-menu-header nil t) |
| 823 | (progn | 823 | (progn |
| 824 | (goto-char (match-beginning 0)) | 824 | (goto-char (match-beginning 0)) |
| 825 | ;; Check if @detailmenu kludge is used; | 825 | ;; Check if @detailmenu kludge is used; |
| 826 | ;; if so, leave point before @detailmenu. | 826 | ;; if so, leave point before @detailmenu. |
| 827 | (search-backward "\n@detailmenu" | 827 | (search-backward "\n@detailmenu" |
| 828 | (save-excursion (forward-line -3) (point)) | 828 | (save-excursion (forward-line -3) (point)) |
| 829 | t) | 829 | t) |
| 830 | (insert "\n") | 830 | (insert "\n") |
| @@ -834,11 +834,11 @@ title of the section containing the menu." | |||
| 834 | (re-search-forward "^@menu") | 834 | (re-search-forward "^@menu") |
| 835 | (forward-line -1) | 835 | (forward-line -1) |
| 836 | (delete-blank-lines) | 836 | (delete-blank-lines) |
| 837 | 837 | ||
| 838 | (re-search-forward "^@end menu") | 838 | (re-search-forward "^@end menu") |
| 839 | (forward-line 1) | 839 | (forward-line 1) |
| 840 | (delete-blank-lines)) | 840 | (delete-blank-lines)) |
| 841 | 841 | ||
| 842 | (message | 842 | (message |
| 843 | "Done...completed making master menu. You may save the buffer."))) | 843 | "Done...completed making master menu. You may save the buffer."))) |
| 844 | 844 | ||
| @@ -858,7 +858,7 @@ However, there does not need to be a title field." | |||
| 858 | 858 | ||
| 859 | (let (master-menu-list) | 859 | (let (master-menu-list) |
| 860 | (while (texinfo-locate-menu-p) | 860 | (while (texinfo-locate-menu-p) |
| 861 | (setq master-menu-list | 861 | (setq master-menu-list |
| 862 | (cons (list | 862 | (cons (list |
| 863 | (texinfo-copy-menu) | 863 | (texinfo-copy-menu) |
| 864 | (texinfo-copy-menu-title)) | 864 | (texinfo-copy-menu-title)) |
| @@ -879,11 +879,11 @@ However, there does not need to be a title field." | |||
| 879 | "Buffer lacks ordinary `Top' menu in which to insert master."))) | 879 | "Buffer lacks ordinary `Top' menu in which to insert master."))) |
| 880 | (beginning-of-line) | 880 | (beginning-of-line) |
| 881 | (delete-region ; buffer must have ordinary top menu | 881 | (delete-region ; buffer must have ordinary top menu |
| 882 | (point) | 882 | (point) |
| 883 | (save-excursion (re-search-forward "^@end menu") (point))) | 883 | (save-excursion (re-search-forward "^@end menu") (point))) |
| 884 | 884 | ||
| 885 | (save-excursion | 885 | (save-excursion |
| 886 | ;; `master-menu-inserted-p' is a kludge to tell | 886 | ;; `master-menu-inserted-p' is a kludge to tell |
| 887 | ;; whether to insert @end detailmenu (see bleow) | 887 | ;; whether to insert @end detailmenu (see bleow) |
| 888 | (let (master-menu-inserted-p) | 888 | (let (master-menu-inserted-p) |
| 889 | ;; Handle top of menu | 889 | ;; Handle top of menu |
| @@ -895,9 +895,9 @@ However, there does not need to be a title field." | |||
| 895 | (while this-very-menu-list | 895 | (while this-very-menu-list |
| 896 | (insert "* " (car this-very-menu-list) "\n") | 896 | (insert "* " (car this-very-menu-list) "\n") |
| 897 | (setq this-very-menu-list (cdr this-very-menu-list))) | 897 | (setq this-very-menu-list (cdr this-very-menu-list))) |
| 898 | 898 | ||
| 899 | (setq master-menu-list (cdr master-menu-list)) | 899 | (setq master-menu-list (cdr master-menu-list)) |
| 900 | 900 | ||
| 901 | ;; Only insert detailed master menu if there is one.... | 901 | ;; Only insert detailed master menu if there is one.... |
| 902 | (if (car (car master-menu-list)) | 902 | (if (car (car master-menu-list)) |
| 903 | (progn (setq master-menu-inserted-p t) | 903 | (progn (setq master-menu-inserted-p t) |
| @@ -912,26 +912,26 @@ However, there does not need to be a title field." | |||
| 912 | ;; `texinfo-multiple-files-update'. | 912 | ;; `texinfo-multiple-files-update'. |
| 913 | 913 | ||
| 914 | ;; Now, insert all the other menus | 914 | ;; Now, insert all the other menus |
| 915 | 915 | ||
| 916 | ;; The menu master-menu-list has a form like this: | 916 | ;; The menu master-menu-list has a form like this: |
| 917 | ;; ((("beta" "alpha") "title-A") | 917 | ;; ((("beta" "alpha") "title-A") |
| 918 | ;; (("delta" "gamma") "title-B")) | 918 | ;; (("delta" "gamma") "title-B")) |
| 919 | 919 | ||
| 920 | (while master-menu-list | 920 | (while master-menu-list |
| 921 | 921 | ||
| 922 | (message | 922 | (message |
| 923 | "Inserting menu for %s .... " (car (cdr (car master-menu-list)))) | 923 | "Inserting menu for %s .... " (car (cdr (car master-menu-list)))) |
| 924 | ;; insert title of menu section | 924 | ;; insert title of menu section |
| 925 | (insert "\n" (car (cdr (car master-menu-list))) "\n\n") | 925 | (insert "\n" (car (cdr (car master-menu-list))) "\n\n") |
| 926 | 926 | ||
| 927 | ;; insert each menu entry | 927 | ;; insert each menu entry |
| 928 | (setq this-very-menu-list (reverse (car (car master-menu-list)))) | 928 | (setq this-very-menu-list (reverse (car (car master-menu-list)))) |
| 929 | (while this-very-menu-list | 929 | (while this-very-menu-list |
| 930 | (insert "* " (car this-very-menu-list) "\n") | 930 | (insert "* " (car this-very-menu-list) "\n") |
| 931 | (setq this-very-menu-list (cdr this-very-menu-list))) | 931 | (setq this-very-menu-list (cdr this-very-menu-list))) |
| 932 | 932 | ||
| 933 | (setq master-menu-list (cdr master-menu-list))) | 933 | (setq master-menu-list (cdr master-menu-list))) |
| 934 | 934 | ||
| 935 | ;; Finish menu | 935 | ;; Finish menu |
| 936 | 936 | ||
| 937 | ;; @detailmenu (see note above) | 937 | ;; @detailmenu (see note above) |
| @@ -987,7 +987,7 @@ and leave point on the line before the `@end menu' line." | |||
| 987 | (progn | 987 | (progn |
| 988 | (setq this-menu-list | 988 | (setq this-menu-list |
| 989 | (cons | 989 | (cons |
| 990 | (buffer-substring | 990 | (buffer-substring |
| 991 | (point) | 991 | (point) |
| 992 | ;; copy multi-line descriptions | 992 | ;; copy multi-line descriptions |
| 993 | (save-excursion | 993 | (save-excursion |
| @@ -999,7 +999,7 @@ and leave point on the line before the `@end menu' line." | |||
| 999 | 999 | ||
| 1000 | ;;; Determining the hierarchical level in the texinfo file | 1000 | ;;; Determining the hierarchical level in the texinfo file |
| 1001 | 1001 | ||
| 1002 | (defun texinfo-specific-section-type () | 1002 | (defun texinfo-specific-section-type () |
| 1003 | "Return the specific type of next section, as a string. | 1003 | "Return the specific type of next section, as a string. |
| 1004 | For example, \"unnumberedsubsec\". Return \"top\" for top node. | 1004 | For example, \"unnumberedsubsec\". Return \"top\" for top node. |
| 1005 | 1005 | ||
| @@ -1038,7 +1038,7 @@ Thus, a subheading or appendixsubsec is of type subsection." | |||
| 1038 | 1038 | ||
| 1039 | ;;; Locating the major positions | 1039 | ;;; Locating the major positions |
| 1040 | 1040 | ||
| 1041 | (defun texinfo-update-menu-region-beginning (level) | 1041 | (defun texinfo-update-menu-region-beginning (level) |
| 1042 | "Locate beginning of higher level section this section is within. | 1042 | "Locate beginning of higher level section this section is within. |
| 1043 | Return position of the beginning of the node line; do not move point. | 1043 | Return position of the beginning of the node line; do not move point. |
| 1044 | Thus, if this level is subsection, searches backwards for section node. | 1044 | Thus, if this level is subsection, searches backwards for section node. |
| @@ -1069,7 +1069,7 @@ Only argument is a string of the general type of section." | |||
| 1069 | 'goto-beginning) | 1069 | 'goto-beginning) |
| 1070 | (point)))))) | 1070 | (point)))))) |
| 1071 | 1071 | ||
| 1072 | (defun texinfo-update-menu-region-end (level) | 1072 | (defun texinfo-update-menu-region-end (level) |
| 1073 | "Locate end of higher level section this section is within. | 1073 | "Locate end of higher level section this section is within. |
| 1074 | Return position; do not move point. Thus, if this level is a | 1074 | Return position; do not move point. Thus, if this level is a |
| 1075 | subsection, find the node for the section this subsection is within. | 1075 | subsection, find the node for the section this subsection is within. |
| @@ -1092,14 +1092,14 @@ string of the general type of section." | |||
| 1092 | (point-max))))) | 1092 | (point-max))))) |
| 1093 | 1093 | ||
| 1094 | (defun texinfo-menu-first-node (beginning end) | 1094 | (defun texinfo-menu-first-node (beginning end) |
| 1095 | "Locate first node of the section the menu will be placed in. | 1095 | "Locate first node of the section the menu will be placed in. |
| 1096 | Return position; do not move point. | 1096 | Return position; do not move point. |
| 1097 | The menu will be located just before this position. | 1097 | The menu will be located just before this position. |
| 1098 | 1098 | ||
| 1099 | First argument is the position of the beginning of the section in | 1099 | First argument is the position of the beginning of the section in |
| 1100 | which the menu will be located; second argument is the position of the | 1100 | which the menu will be located; second argument is the position of the |
| 1101 | end of that region; it limits the search." | 1101 | end of that region; it limits the search." |
| 1102 | 1102 | ||
| 1103 | (save-excursion | 1103 | (save-excursion |
| 1104 | (goto-char beginning) | 1104 | (goto-char beginning) |
| 1105 | (forward-line 1) | 1105 | (forward-line 1) |
| @@ -1118,17 +1118,17 @@ end of that region; it limits the search." | |||
| 1118 | ("majorheading" . "chapter") | 1118 | ("majorheading" . "chapter") |
| 1119 | ("chapheading" . "chapter") | 1119 | ("chapheading" . "chapter") |
| 1120 | ("appendix" . "chapter") | 1120 | ("appendix" . "chapter") |
| 1121 | 1121 | ||
| 1122 | ("section" . "section") | 1122 | ("section" . "section") |
| 1123 | ("unnumberedsec" . "section") | 1123 | ("unnumberedsec" . "section") |
| 1124 | ("heading" . "section") | 1124 | ("heading" . "section") |
| 1125 | ("appendixsec" . "section") | 1125 | ("appendixsec" . "section") |
| 1126 | 1126 | ||
| 1127 | ("subsection" . "subsection") | 1127 | ("subsection" . "subsection") |
| 1128 | ("unnumberedsubsec" . "subsection") | 1128 | ("unnumberedsubsec" . "subsection") |
| 1129 | ("subheading" . "subsection") | 1129 | ("subheading" . "subsection") |
| 1130 | ("appendixsubsec" . "subsection") | 1130 | ("appendixsubsec" . "subsection") |
| 1131 | 1131 | ||
| 1132 | ("subsubsection" . "subsubsection") | 1132 | ("subsubsection" . "subsubsection") |
| 1133 | ("unnumberedsubsubsec" . "subsubsection") | 1133 | ("unnumberedsubsubsec" . "subsubsection") |
| 1134 | ("subsubheading" . "subsubsection") | 1134 | ("subsubheading" . "subsubsection") |
| @@ -1142,15 +1142,15 @@ are strings of their corresponding general types.") | |||
| 1142 | "^@\\(chapter \\|sect\\|subs\\|subh\\|unnum\\|major\\|chapheading \\|heading \\|appendix\\)" | 1142 | "^@\\(chapter \\|sect\\|subs\\|subh\\|unnum\\|major\\|chapheading \\|heading \\|appendix\\)" |
| 1143 | "Regexp matching chapter, section, other headings (but not the top node).") | 1143 | "Regexp matching chapter, section, other headings (but not the top node).") |
| 1144 | 1144 | ||
| 1145 | (defvar texinfo-chapter-level-regexp | 1145 | (defvar texinfo-chapter-level-regexp |
| 1146 | "chapter\\|unnumbered \\|appendix \\|majorheading\\|chapheading" | 1146 | "chapter\\|unnumbered \\|appendix \\|majorheading\\|chapheading" |
| 1147 | "Regular expression matching just the Texinfo chapter level headings.") | 1147 | "Regular expression matching just the Texinfo chapter level headings.") |
| 1148 | 1148 | ||
| 1149 | (defvar texinfo-section-level-regexp | 1149 | (defvar texinfo-section-level-regexp |
| 1150 | "section\\|unnumberedsec\\|heading \\|appendixsec" | 1150 | "section\\|unnumberedsec\\|heading \\|appendixsec" |
| 1151 | "Regular expression matching just the Texinfo section level headings.") | 1151 | "Regular expression matching just the Texinfo section level headings.") |
| 1152 | 1152 | ||
| 1153 | (defvar texinfo-subsection-level-regexp | 1153 | (defvar texinfo-subsection-level-regexp |
| 1154 | "subsection\\|unnumberedsubsec\\|subheading\\|appendixsubsec" | 1154 | "subsection\\|unnumberedsubsec\\|subheading\\|appendixsubsec" |
| 1155 | "Regular expression matching just the Texinfo subsection level headings.") | 1155 | "Regular expression matching just the Texinfo subsection level headings.") |
| 1156 | 1156 | ||
| @@ -1160,35 +1160,35 @@ are strings of their corresponding general types.") | |||
| 1160 | 1160 | ||
| 1161 | (defvar texinfo-update-menu-same-level-regexps | 1161 | (defvar texinfo-update-menu-same-level-regexps |
| 1162 | '(("top" . "top[ \t]+") | 1162 | '(("top" . "top[ \t]+") |
| 1163 | ("chapter" . | 1163 | ("chapter" . |
| 1164 | (concat "\\(^@\\)\\(" texinfo-chapter-level-regexp "\\)[ \t]*")) | 1164 | (concat "\\(^@\\)\\(" texinfo-chapter-level-regexp "\\)[ \t]*")) |
| 1165 | ("section" . | 1165 | ("section" . |
| 1166 | (concat "\\(^@\\)\\(" texinfo-section-level-regexp "\\)[ \t]*")) | 1166 | (concat "\\(^@\\)\\(" texinfo-section-level-regexp "\\)[ \t]*")) |
| 1167 | ("subsection" . | 1167 | ("subsection" . |
| 1168 | (concat "\\(^@\\)\\(" texinfo-subsection-level-regexp "\\)[ \t]+")) | 1168 | (concat "\\(^@\\)\\(" texinfo-subsection-level-regexp "\\)[ \t]+")) |
| 1169 | ("subsubsection" . | 1169 | ("subsubsection" . |
| 1170 | (concat "\\(^@\\)\\(" texinfo-subsubsection-level-regexp "\\)[ \t]+"))) | 1170 | (concat "\\(^@\\)\\(" texinfo-subsubsection-level-regexp "\\)[ \t]+"))) |
| 1171 | "*Regexps for searching for same level sections in a Texinfo file. | 1171 | "*Regexps for searching for same level sections in a Texinfo file. |
| 1172 | The keys are strings specifying the general hierarchical level in the | 1172 | The keys are strings specifying the general hierarchical level in the |
| 1173 | document; the values are regular expressions.") | 1173 | document; the values are regular expressions.") |
| 1174 | 1174 | ||
| 1175 | (defvar texinfo-update-menu-higher-regexps | 1175 | (defvar texinfo-update-menu-higher-regexps |
| 1176 | '(("top" . "^@node [ \t]*DIR") | 1176 | '(("top" . "^@node [ \t]*DIR") |
| 1177 | ("chapter" . "^@node [ \t]*top[ \t]*\\(,\\|$\\)") | 1177 | ("chapter" . "^@node [ \t]*top[ \t]*\\(,\\|$\\)") |
| 1178 | ("section" . | 1178 | ("section" . |
| 1179 | (concat | 1179 | (concat |
| 1180 | "\\(^@\\(" | 1180 | "\\(^@\\(" |
| 1181 | texinfo-chapter-level-regexp | 1181 | texinfo-chapter-level-regexp |
| 1182 | "\\)[ \t]*\\)")) | 1182 | "\\)[ \t]*\\)")) |
| 1183 | ("subsection" . | 1183 | ("subsection" . |
| 1184 | (concat | 1184 | (concat |
| 1185 | "\\(^@\\(" | 1185 | "\\(^@\\(" |
| 1186 | texinfo-section-level-regexp | 1186 | texinfo-section-level-regexp |
| 1187 | "\\|" | 1187 | "\\|" |
| 1188 | texinfo-chapter-level-regexp | 1188 | texinfo-chapter-level-regexp |
| 1189 | "\\)[ \t]*\\)")) | 1189 | "\\)[ \t]*\\)")) |
| 1190 | ("subsubsection" . | 1190 | ("subsubsection" . |
| 1191 | (concat | 1191 | (concat |
| 1192 | "\\(^@\\(" | 1192 | "\\(^@\\(" |
| 1193 | texinfo-subsection-level-regexp | 1193 | texinfo-subsection-level-regexp |
| 1194 | "\\|" | 1194 | "\\|" |
| @@ -1201,8 +1201,8 @@ The keys are strings specifying the general hierarchical level in the | |||
| 1201 | document; the values are regular expressions.") | 1201 | document; the values are regular expressions.") |
| 1202 | 1202 | ||
| 1203 | (defvar texinfo-update-menu-lower-regexps | 1203 | (defvar texinfo-update-menu-lower-regexps |
| 1204 | '(("top" . | 1204 | '(("top" . |
| 1205 | (concat | 1205 | (concat |
| 1206 | "\\(^@\\(" | 1206 | "\\(^@\\(" |
| 1207 | texinfo-chapter-level-regexp | 1207 | texinfo-chapter-level-regexp |
| 1208 | "\\|" | 1208 | "\\|" |
| @@ -1212,8 +1212,8 @@ document; the values are regular expressions.") | |||
| 1212 | "\\|" | 1212 | "\\|" |
| 1213 | texinfo-subsubsection-level-regexp | 1213 | texinfo-subsubsection-level-regexp |
| 1214 | "\\)[ \t]*\\)")) | 1214 | "\\)[ \t]*\\)")) |
| 1215 | ("chapter" . | 1215 | ("chapter" . |
| 1216 | (concat | 1216 | (concat |
| 1217 | "\\(^@\\(" | 1217 | "\\(^@\\(" |
| 1218 | texinfo-section-level-regexp | 1218 | texinfo-section-level-regexp |
| 1219 | "\\|" | 1219 | "\\|" |
| @@ -1222,14 +1222,14 @@ document; the values are regular expressions.") | |||
| 1222 | texinfo-subsubsection-level-regexp | 1222 | texinfo-subsubsection-level-regexp |
| 1223 | "\\)[ \t]*\\)")) | 1223 | "\\)[ \t]*\\)")) |
| 1224 | ("section" . | 1224 | ("section" . |
| 1225 | (concat | 1225 | (concat |
| 1226 | "\\(^@\\(" | 1226 | "\\(^@\\(" |
| 1227 | texinfo-subsection-level-regexp | 1227 | texinfo-subsection-level-regexp |
| 1228 | "\\|" | 1228 | "\\|" |
| 1229 | texinfo-subsubsection-level-regexp | 1229 | texinfo-subsubsection-level-regexp |
| 1230 | "\\)[ \t]+\\)")) | 1230 | "\\)[ \t]+\\)")) |
| 1231 | ("subsection" . | 1231 | ("subsection" . |
| 1232 | (concat | 1232 | (concat |
| 1233 | "\\(^@\\(" | 1233 | "\\(^@\\(" |
| 1234 | texinfo-subsubsection-level-regexp | 1234 | texinfo-subsubsection-level-regexp |
| 1235 | "\\)[ \t]+\\)")) | 1235 | "\\)[ \t]+\\)")) |
| @@ -1261,7 +1261,7 @@ keybindings, are: | |||
| 1261 | 1261 | ||
| 1262 | The `texinfo-column-for-description' variable specifies the column to | 1262 | The `texinfo-column-for-description' variable specifies the column to |
| 1263 | which menu descriptions are indented. Its default value is 32." | 1263 | which menu descriptions are indented. Its default value is 32." |
| 1264 | 1264 | ||
| 1265 | (interactive | 1265 | (interactive |
| 1266 | (if prefix-arg | 1266 | (if prefix-arg |
| 1267 | (list (point) (mark)))) | 1267 | (list (point) (mark)))) |
| @@ -1280,7 +1280,7 @@ which menu descriptions are indented. Its default value is 32." | |||
| 1280 | (narrow-to-region beginning end) | 1280 | (narrow-to-region beginning end) |
| 1281 | (goto-char (point-min)) | 1281 | (goto-char (point-min)) |
| 1282 | (while (re-search-forward "^@node" (point-max) t) | 1282 | (while (re-search-forward "^@node" (point-max) t) |
| 1283 | (beginning-of-line) | 1283 | (beginning-of-line) |
| 1284 | (texinfo-update-the-node)) | 1284 | (texinfo-update-the-node)) |
| 1285 | (goto-char (point-max)) | 1285 | (goto-char (point-max)) |
| 1286 | (message "Done...nodes updated in region. You may save the buffer.")))))) | 1286 | (message "Done...nodes updated in region. You may save the buffer.")))))) |
| @@ -1294,7 +1294,7 @@ which menu descriptions are indented. Its default value is 32." | |||
| 1294 | (message "Done...updated every node. You may save the buffer."))) | 1294 | (message "Done...updated every node. You may save the buffer."))) |
| 1295 | 1295 | ||
| 1296 | (defun texinfo-update-the-node () | 1296 | (defun texinfo-update-the-node () |
| 1297 | "Update one node. Point must be at the beginning of node line. | 1297 | "Update one node. Point must be at the beginning of node line. |
| 1298 | Leave point at the end of the node line." | 1298 | Leave point at the end of the node line." |
| 1299 | (texinfo-check-for-node-name) | 1299 | (texinfo-check-for-node-name) |
| 1300 | (texinfo-delete-existing-pointers) | 1300 | (texinfo-delete-existing-pointers) |
| @@ -1323,7 +1323,7 @@ to `(dir)'. Point must be at the beginning of the node line, and is | |||
| 1323 | left at the end of the node line." | 1323 | left at the end of the node line." |
| 1324 | 1324 | ||
| 1325 | (texinfo-clean-up-node-line) | 1325 | (texinfo-clean-up-node-line) |
| 1326 | (insert ", " | 1326 | (insert ", " |
| 1327 | (save-excursion | 1327 | (save-excursion |
| 1328 | ;; There may be an @chapter or other such command between | 1328 | ;; There may be an @chapter or other such command between |
| 1329 | ;; the top node line and the next node line, as a title | 1329 | ;; the top node line and the next node line, as a title |
| @@ -1354,7 +1354,7 @@ Point must be at beginning of node line. Does not move point." | |||
| 1354 | (insert " " node-name)))))) | 1354 | (insert " " node-name)))))) |
| 1355 | 1355 | ||
| 1356 | (defun texinfo-delete-existing-pointers () | 1356 | (defun texinfo-delete-existing-pointers () |
| 1357 | "Delete `Next', `Previous', and `Up' pointers. | 1357 | "Delete `Next', `Previous', and `Up' pointers. |
| 1358 | Starts from the current position of the cursor, and searches forward | 1358 | Starts from the current position of the cursor, and searches forward |
| 1359 | on the line for a comma and if one is found, deletes the rest of the | 1359 | on the line for a comma and if one is found, deletes the rest of the |
| 1360 | line, including the comma. Leaves point at beginning of line." | 1360 | line, including the comma. Leaves point at beginning of line." |
| @@ -1387,9 +1387,9 @@ will be at some level higher in the Texinfo file. The fourth argument | |||
| 1387 | ;; A `Top' node is never a next pointer, so won't find it. | 1387 | ;; A `Top' node is never a next pointer, so won't find it. |
| 1388 | (concat | 1388 | (concat |
| 1389 | ;; Match node line. | 1389 | ;; Match node line. |
| 1390 | "\\(^@node\\).*\n" | 1390 | "\\(^@node\\).*\n" |
| 1391 | ;; Match comment or ifinfo line, if any | 1391 | ;; Match comment or ifinfo line, if any |
| 1392 | "\\(\\(\\(^@c\\).*\n\\)\\|\\(^@ifinfo[ ]*\n\\)\\)?" | 1392 | "\\(\\(\\(^@c\\).*\n\\)\\|\\(^@ifinfo[ ]*\n\\)\\)?" |
| 1393 | (eval | 1393 | (eval |
| 1394 | (cdr (assoc level texinfo-update-menu-same-level-regexps)))) | 1394 | (cdr (assoc level texinfo-update-menu-same-level-regexps)))) |
| 1395 | end | 1395 | end |
| @@ -1401,16 +1401,16 @@ will be at some level higher in the Texinfo file. The fourth argument | |||
| 1401 | (concat | 1401 | (concat |
| 1402 | "\\(" | 1402 | "\\(" |
| 1403 | ;; Match node line. | 1403 | ;; Match node line. |
| 1404 | "\\(^@node\\).*\n" | 1404 | "\\(^@node\\).*\n" |
| 1405 | ;; Match comment or ifinfo line, if any | 1405 | ;; Match comment or ifinfo line, if any |
| 1406 | "\\(\\(\\(^@c\\).*\n\\)\\|\\(^@ifinfo[ ]*\n\\)\\)?" | 1406 | "\\(\\(\\(^@c\\).*\n\\)\\|\\(^@ifinfo[ ]*\n\\)\\)?" |
| 1407 | (eval | 1407 | (eval |
| 1408 | (cdr (assoc level texinfo-update-menu-same-level-regexps))) | 1408 | (cdr (assoc level texinfo-update-menu-same-level-regexps))) |
| 1409 | "\\|" | 1409 | "\\|" |
| 1410 | ;; Match node line. | 1410 | ;; Match node line. |
| 1411 | "\\(^@node\\).*\n" | 1411 | "\\(^@node\\).*\n" |
| 1412 | ;; Match comment or ifinfo line, if any | 1412 | ;; Match comment or ifinfo line, if any |
| 1413 | "\\(\\(\\(^@c\\).*\n\\)\\|\\(^@ifinfo[ ]*\n\\)\\)?" | 1413 | "\\(\\(\\(^@c\\).*\n\\)\\|\\(^@ifinfo[ ]*\n\\)\\)?" |
| 1414 | (eval | 1414 | (eval |
| 1415 | (cdr (assoc level texinfo-update-menu-higher-regexps))) | 1415 | (cdr (assoc level texinfo-update-menu-higher-regexps))) |
| 1416 | "\\|" | 1416 | "\\|" |
| @@ -1426,9 +1426,9 @@ will be at some level higher in the Texinfo file. The fourth argument | |||
| 1426 | (concat | 1426 | (concat |
| 1427 | "\\(" | 1427 | "\\(" |
| 1428 | ;; Match node line. | 1428 | ;; Match node line. |
| 1429 | "\\(^@node\\).*\n" | 1429 | "\\(^@node\\).*\n" |
| 1430 | ;; Match comment or ifinfo line, if any | 1430 | ;; Match comment or ifinfo line, if any |
| 1431 | "\\(\\(\\(^@c\\).*\n\\)\\|\\(^@ifinfo[ ]*\n\\)\\)?" | 1431 | "\\(\\(\\(^@c\\).*\n\\)\\|\\(^@ifinfo[ ]*\n\\)\\)?" |
| 1432 | (eval (cdr (assoc level texinfo-update-menu-higher-regexps))) | 1432 | (eval (cdr (assoc level texinfo-update-menu-higher-regexps))) |
| 1433 | "\\|" | 1433 | "\\|" |
| 1434 | ;; Handle `Top' node specially. | 1434 | ;; Handle `Top' node specially. |
| @@ -1450,7 +1450,7 @@ The argument is the kind of section, either `normal' or `no-pointer'." | |||
| 1450 | (let (name) | 1450 | (let (name) |
| 1451 | (cond ((eq kind 'normal) | 1451 | (cond ((eq kind 'normal) |
| 1452 | (end-of-line) ; this handles prev node top case | 1452 | (end-of-line) ; this handles prev node top case |
| 1453 | (re-search-backward ; when point is already | 1453 | (re-search-backward ; when point is already |
| 1454 | "^@node" ; at the beginning of @node line | 1454 | "^@node" ; at the beginning of @node line |
| 1455 | (save-excursion (forward-line -3)) | 1455 | (save-excursion (forward-line -3)) |
| 1456 | t) | 1456 | t) |
| @@ -1463,7 +1463,7 @@ The argument is the kind of section, either `normal' or `no-pointer'." | |||
| 1463 | 1463 | ||
| 1464 | (defun texinfo-insert-pointer (beginning end level direction) | 1464 | (defun texinfo-insert-pointer (beginning end level direction) |
| 1465 | "Insert the `Next', `Previous' or `Up' node name at point. | 1465 | "Insert the `Next', `Previous' or `Up' node name at point. |
| 1466 | Move point forward. | 1466 | Move point forward. |
| 1467 | 1467 | ||
| 1468 | The first and second arguments bound the search for a pointer to the | 1468 | The first and second arguments bound the search for a pointer to the |
| 1469 | beginning and end, respectively, of the enclosing higher level | 1469 | beginning and end, respectively, of the enclosing higher level |
| @@ -1511,7 +1511,7 @@ This command makes it awkward to navigate among sections and | |||
| 1511 | subsections; it should be used only for those documents that are meant | 1511 | subsections; it should be used only for those documents that are meant |
| 1512 | to be read like a novel rather than a reference, and for which the | 1512 | to be read like a novel rather than a reference, and for which the |
| 1513 | Info `g*' command is inadequate." | 1513 | Info `g*' command is inadequate." |
| 1514 | 1514 | ||
| 1515 | (interactive "P") | 1515 | (interactive "P") |
| 1516 | (if (not region-p) | 1516 | (if (not region-p) |
| 1517 | ;; update a single node | 1517 | ;; update a single node |
| @@ -1519,7 +1519,7 @@ Info `g*' command is inadequate." | |||
| 1519 | (if (not (re-search-backward "^@node" (point-min) t)) | 1519 | (if (not (re-search-backward "^@node" (point-min) t)) |
| 1520 | (error "Node line not found before this position.")) | 1520 | (error "Node line not found before this position.")) |
| 1521 | (texinfo-sequentially-update-the-node) | 1521 | (texinfo-sequentially-update-the-node) |
| 1522 | (message | 1522 | (message |
| 1523 | "Done...sequentially updated the node . You may save the buffer.")) | 1523 | "Done...sequentially updated the node . You may save the buffer.")) |
| 1524 | ;; else | 1524 | ;; else |
| 1525 | (let ((auto-fill-function nil) | 1525 | (let ((auto-fill-function nil) |
| @@ -1533,19 +1533,19 @@ Info `g*' command is inadequate." | |||
| 1533 | (goto-char beginning) | 1533 | (goto-char beginning) |
| 1534 | (push-mark (point) t) | 1534 | (push-mark (point) t) |
| 1535 | (while (re-search-forward "^@node" (point-max) t) | 1535 | (while (re-search-forward "^@node" (point-max) t) |
| 1536 | (beginning-of-line) | 1536 | (beginning-of-line) |
| 1537 | (texinfo-sequentially-update-the-node)) | 1537 | (texinfo-sequentially-update-the-node)) |
| 1538 | (message | 1538 | (message |
| 1539 | "Done...updated the nodes in sequence. You may save the buffer."))))) | 1539 | "Done...updated the nodes in sequence. You may save the buffer."))))) |
| 1540 | 1540 | ||
| 1541 | (defun texinfo-sequentially-update-the-node () | 1541 | (defun texinfo-sequentially-update-the-node () |
| 1542 | "Update one node such that the pointers are sequential. | 1542 | "Update one node such that the pointers are sequential. |
| 1543 | A `Next' or `Previous' pointer points to any preceding or following node, | 1543 | A `Next' or `Previous' pointer points to any preceding or following node, |
| 1544 | regardless of its hierarchical level." | 1544 | regardless of its hierarchical level." |
| 1545 | 1545 | ||
| 1546 | (texinfo-check-for-node-name) | 1546 | (texinfo-check-for-node-name) |
| 1547 | (texinfo-delete-existing-pointers) | 1547 | (texinfo-delete-existing-pointers) |
| 1548 | (message | 1548 | (message |
| 1549 | "Sequentially updating node: %s ... " (texinfo-copy-node-name)) | 1549 | "Sequentially updating node: %s ... " (texinfo-copy-node-name)) |
| 1550 | (save-restriction | 1550 | (save-restriction |
| 1551 | (widen) | 1551 | (widen) |
| @@ -1573,17 +1573,17 @@ same hierarchical level in the Texinfo file, or, in the case of the up | |||
| 1573 | pointer, some level higher. The second argument (one of `next', | 1573 | pointer, some level higher. The second argument (one of `next', |
| 1574 | `previous', or `up') specifies whether to find the `Next', `Previous', | 1574 | `previous', or `up') specifies whether to find the `Next', `Previous', |
| 1575 | or `Up' pointer." | 1575 | or `Up' pointer." |
| 1576 | (let ((case-fold-search t)) | 1576 | (let ((case-fold-search t)) |
| 1577 | (cond ((eq direction 'next) | 1577 | (cond ((eq direction 'next) |
| 1578 | (forward-line 3) ; skip over current node | 1578 | (forward-line 3) ; skip over current node |
| 1579 | (if (re-search-forward | 1579 | (if (re-search-forward |
| 1580 | texinfo-section-types-regexp | 1580 | texinfo-section-types-regexp |
| 1581 | (point-max) | 1581 | (point-max) |
| 1582 | t) | 1582 | t) |
| 1583 | 'normal | 1583 | 'normal |
| 1584 | 'no-pointer)) | 1584 | 'no-pointer)) |
| 1585 | ((eq direction 'previous) | 1585 | ((eq direction 'previous) |
| 1586 | (if (re-search-backward | 1586 | (if (re-search-backward |
| 1587 | texinfo-section-types-regexp | 1587 | texinfo-section-types-regexp |
| 1588 | (point-min) | 1588 | (point-min) |
| 1589 | t) | 1589 | t) |
| @@ -1601,7 +1601,7 @@ or `Up' pointer." | |||
| 1601 | 1601 | ||
| 1602 | (defun texinfo-sequentially-insert-pointer (level direction) | 1602 | (defun texinfo-sequentially-insert-pointer (level direction) |
| 1603 | "Insert the `Next', `Previous' or `Up' node name at point. | 1603 | "Insert the `Next', `Previous' or `Up' node name at point. |
| 1604 | Move point forward. | 1604 | Move point forward. |
| 1605 | 1605 | ||
| 1606 | The first argument is the hierarchical level of the Texinfo file, a | 1606 | The first argument is the hierarchical level of the Texinfo file, a |
| 1607 | string such as \"section\". The second argument is direction, one of | 1607 | string such as \"section\". The second argument is direction, one of |
| @@ -1633,17 +1633,17 @@ node names in pre-existing `@node' lines that lack names." | |||
| 1633 | (let (beginning-marker end-marker title last-section-position) | 1633 | (let (beginning-marker end-marker title last-section-position) |
| 1634 | 1634 | ||
| 1635 | ;; Save current position on mark ring and set mark to end. | 1635 | ;; Save current position on mark ring and set mark to end. |
| 1636 | (push-mark end t) | 1636 | (push-mark end t) |
| 1637 | (setq end-marker (mark-marker)) | 1637 | (setq end-marker (mark-marker)) |
| 1638 | 1638 | ||
| 1639 | (goto-char beginning) | 1639 | (goto-char beginning) |
| 1640 | (while (re-search-forward | 1640 | (while (re-search-forward |
| 1641 | texinfo-section-types-regexp | 1641 | texinfo-section-types-regexp |
| 1642 | end-marker | 1642 | end-marker |
| 1643 | 'end) | 1643 | 'end) |
| 1644 | ;; Copy title if desired. | 1644 | ;; Copy title if desired. |
| 1645 | (if title-p | 1645 | (if title-p |
| 1646 | (progn | 1646 | (progn |
| 1647 | (beginning-of-line) | 1647 | (beginning-of-line) |
| 1648 | (forward-word 1) | 1648 | (forward-word 1) |
| 1649 | (skip-chars-forward " \t") | 1649 | (skip-chars-forward " \t") |
| @@ -1652,9 +1652,9 @@ node names in pre-existing `@node' lines that lack names." | |||
| 1652 | (save-excursion (end-of-line) (point)))))) | 1652 | (save-excursion (end-of-line) (point)))))) |
| 1653 | ;; Insert node line if necessary. | 1653 | ;; Insert node line if necessary. |
| 1654 | (if (re-search-backward | 1654 | (if (re-search-backward |
| 1655 | "^@node" | 1655 | "^@node" |
| 1656 | ;; Avoid finding previous node line if node lines are close. | 1656 | ;; Avoid finding previous node line if node lines are close. |
| 1657 | (or last-section-position | 1657 | (or last-section-position |
| 1658 | (save-excursion (forward-line -2) (point))) t) | 1658 | (save-excursion (forward-line -2) (point))) t) |
| 1659 | ;; @node is present, and point at beginning of that line | 1659 | ;; @node is present, and point at beginning of that line |
| 1660 | (forward-word 1) ; Leave point just after @node. | 1660 | (forward-word 1) ; Leave point just after @node. |
| @@ -1669,14 +1669,14 @@ node names in pre-existing `@node' lines that lack names." | |||
| 1669 | ;; Use regexp based on what info looks for | 1669 | ;; Use regexp based on what info looks for |
| 1670 | ;; (alternatively, use "[a-zA-Z]+"); | 1670 | ;; (alternatively, use "[a-zA-Z]+"); |
| 1671 | ;; this means we only insert a title if none exists. | 1671 | ;; this means we only insert a title if none exists. |
| 1672 | (if (not (looking-at "[^,\t\n ]+")) | 1672 | (if (not (looking-at "[^,\t\n ]+")) |
| 1673 | (progn | 1673 | (progn |
| 1674 | (beginning-of-line) | 1674 | (beginning-of-line) |
| 1675 | (forward-word 1) | 1675 | (forward-word 1) |
| 1676 | (insert " " title) | 1676 | (insert " " title) |
| 1677 | (message "Inserted title %s ... " title))))) | 1677 | (message "Inserted title %s ... " title))))) |
| 1678 | ;; Go forward beyond current section title. | 1678 | ;; Go forward beyond current section title. |
| 1679 | (re-search-forward texinfo-section-types-regexp | 1679 | (re-search-forward texinfo-section-types-regexp |
| 1680 | (save-excursion (forward-line 3) (point)) t) | 1680 | (save-excursion (forward-line 3) (point)) t) |
| 1681 | (setq last-section-position (point)) | 1681 | (setq last-section-position (point)) |
| 1682 | (forward-line 1)) | 1682 | (forward-line 1)) |
| @@ -1692,13 +1692,13 @@ node names in pre-existing `@node' lines that lack names." | |||
| 1692 | 1692 | ||
| 1693 | ;;; Update and create menus for multi-file Texinfo sources | 1693 | ;;; Update and create menus for multi-file Texinfo sources |
| 1694 | 1694 | ||
| 1695 | ;; 1. M-x texinfo-multiple-files-update | 1695 | ;; 1. M-x texinfo-multiple-files-update |
| 1696 | ;; | 1696 | ;; |
| 1697 | ;; Read the include file list of an outer Texinfo file and | 1697 | ;; Read the include file list of an outer Texinfo file and |
| 1698 | ;; update all highest level nodes in the files listed and insert a | 1698 | ;; update all highest level nodes in the files listed and insert a |
| 1699 | ;; main menu in the outer file after its top node. | 1699 | ;; main menu in the outer file after its top node. |
| 1700 | 1700 | ||
| 1701 | ;; 2. C-u M-x texinfo-multiple-files-update | 1701 | ;; 2. C-u M-x texinfo-multiple-files-update |
| 1702 | ;; | 1702 | ;; |
| 1703 | ;; Same as 1, but insert a master menu. (Saves reupdating lower | 1703 | ;; Same as 1, but insert a master menu. (Saves reupdating lower |
| 1704 | ;; level menus and nodes.) This command simply reads every menu, | 1704 | ;; level menus and nodes.) This command simply reads every menu, |
| @@ -1706,7 +1706,7 @@ node names in pre-existing `@node' lines that lack names." | |||
| 1706 | ;; Similarly, if the lower level node pointers are wrong, they | 1706 | ;; Similarly, if the lower level node pointers are wrong, they |
| 1707 | ;; will stay wrong. | 1707 | ;; will stay wrong. |
| 1708 | 1708 | ||
| 1709 | ;; 3. C-u 2 M-x texinfo-multiple-files-update | 1709 | ;; 3. C-u 2 M-x texinfo-multiple-files-update |
| 1710 | ;; | 1710 | ;; |
| 1711 | ;; Read the include file list of an outer Texinfo file and | 1711 | ;; Read the include file list of an outer Texinfo file and |
| 1712 | ;; update all nodes and menus in the files listed and insert a | 1712 | ;; update all nodes and menus in the files listed and insert a |
| @@ -1715,7 +1715,7 @@ node names in pre-existing `@node' lines that lack names." | |||
| 1715 | ;;; Note: these functions: | 1715 | ;;; Note: these functions: |
| 1716 | ;;; | 1716 | ;;; |
| 1717 | ;;; * Do not save or delete any buffers. You may fill up your memory. | 1717 | ;;; * Do not save or delete any buffers. You may fill up your memory. |
| 1718 | ;;; * Do not handle any pre-existing nodes in outer file. | 1718 | ;;; * Do not handle any pre-existing nodes in outer file. |
| 1719 | ;;; Hence, you may need a file for indices. | 1719 | ;;; Hence, you may need a file for indices. |
| 1720 | 1720 | ||
| 1721 | 1721 | ||
| @@ -1733,7 +1733,7 @@ node names in pre-existing `@node' lines that lack names." | |||
| 1733 | (skip-chars-forward " \t") | 1733 | (skip-chars-forward " \t") |
| 1734 | (setq start (point)) | 1734 | (setq start (point)) |
| 1735 | (end-of-line) | 1735 | (end-of-line) |
| 1736 | (skip-chars-backward " \t") | 1736 | (skip-chars-backward " \t") |
| 1737 | (setq included-file-list | 1737 | (setq included-file-list |
| 1738 | (cons (buffer-substring start (point)) | 1738 | (cons (buffer-substring start (point)) |
| 1739 | included-file-list))) | 1739 | included-file-list))) |
| @@ -1747,7 +1747,7 @@ same place. If there is no title, returns an empty string." | |||
| 1747 | 1747 | ||
| 1748 | (save-excursion | 1748 | (save-excursion |
| 1749 | (end-of-line) | 1749 | (end-of-line) |
| 1750 | (let ((node-end (or | 1750 | (let ((node-end (or |
| 1751 | (save-excursion | 1751 | (save-excursion |
| 1752 | (if (re-search-forward "\\(^@node\\)" nil t) | 1752 | (if (re-search-forward "\\(^@node\\)" nil t) |
| 1753 | (match-beginning 0))) | 1753 | (match-beginning 0))) |
| @@ -1781,25 +1781,25 @@ Requirements: | |||
| 1781 | 1781 | ||
| 1782 | * the first file in the FILES list must be the outer file, | 1782 | * the first file in the FILES list must be the outer file, |
| 1783 | * each of the included files must contain exactly one highest | 1783 | * each of the included files must contain exactly one highest |
| 1784 | hierarchical level node, | 1784 | hierarchical level node, |
| 1785 | * this node must be the first node in the included file, | 1785 | * this node must be the first node in the included file, |
| 1786 | * each highest hierarchical level node must be of the same type. | 1786 | * each highest hierarchical level node must be of the same type. |
| 1787 | 1787 | ||
| 1788 | Thus, normally, each included file contains one, and only one, chapter." | 1788 | Thus, normally, each included file contains one, and only one, chapter." |
| 1789 | 1789 | ||
| 1790 | ;; The menu-list has the form: | 1790 | ;; The menu-list has the form: |
| 1791 | ;; | 1791 | ;; |
| 1792 | ;; \(\(\"node-name1\" . \"title1\"\) | 1792 | ;; \(\(\"node-name1\" . \"title1\"\) |
| 1793 | ;; \(\"node-name2\" . \"title2\"\) ... \) | 1793 | ;; \(\"node-name2\" . \"title2\"\) ... \) |
| 1794 | ;; | 1794 | ;; |
| 1795 | ;; However, there does not need to be a title field and this function | 1795 | ;; However, there does not need to be a title field and this function |
| 1796 | ;; does not fill it; however a comment tells you how to do so. | 1796 | ;; does not fill it; however a comment tells you how to do so. |
| 1797 | ;; You would use the title field if you wanted to insert titles in the | 1797 | ;; You would use the title field if you wanted to insert titles in the |
| 1798 | ;; description slot of a menu as a description. | 1798 | ;; description slot of a menu as a description. |
| 1799 | 1799 | ||
| 1800 | (let ((case-fold-search t) | 1800 | (let ((case-fold-search t) |
| 1801 | menu-list) | 1801 | menu-list) |
| 1802 | 1802 | ||
| 1803 | ;; Find the name of the first node of the first included file. | 1803 | ;; Find the name of the first node of the first included file. |
| 1804 | (switch-to-buffer (find-file-noselect (car (cdr files)))) | 1804 | (switch-to-buffer (find-file-noselect (car (cdr files)))) |
| 1805 | (widen) | 1805 | (widen) |
| @@ -1809,9 +1809,9 @@ Thus, normally, each included file contains one, and only one, chapter." | |||
| 1809 | (beginning-of-line) | 1809 | (beginning-of-line) |
| 1810 | (texinfo-check-for-node-name) | 1810 | (texinfo-check-for-node-name) |
| 1811 | (setq next-node-name (texinfo-copy-node-name)) | 1811 | (setq next-node-name (texinfo-copy-node-name)) |
| 1812 | 1812 | ||
| 1813 | (setq menu-list | 1813 | (setq menu-list |
| 1814 | (cons (cons | 1814 | (cons (cons |
| 1815 | next-node-name | 1815 | next-node-name |
| 1816 | (prog1 "" (forward-line 1))) | 1816 | (prog1 "" (forward-line 1))) |
| 1817 | ;; Use following to insert section titles automatically. | 1817 | ;; Use following to insert section titles automatically. |
| @@ -1830,9 +1830,9 @@ Thus, normally, each included file contains one, and only one, chapter." | |||
| 1830 | (beginning-of-line) | 1830 | (beginning-of-line) |
| 1831 | (setq previous-node-name "Top") | 1831 | (setq previous-node-name "Top") |
| 1832 | (setq files (cdr files)) | 1832 | (setq files (cdr files)) |
| 1833 | 1833 | ||
| 1834 | (while files | 1834 | (while files |
| 1835 | 1835 | ||
| 1836 | (if (not (cdr files)) | 1836 | (if (not (cdr files)) |
| 1837 | ;; No next file | 1837 | ;; No next file |
| 1838 | (setq next-node-name "") | 1838 | (setq next-node-name "") |
| @@ -1847,7 +1847,7 @@ Thus, normally, each included file contains one, and only one, chapter." | |||
| 1847 | (texinfo-check-for-node-name) | 1847 | (texinfo-check-for-node-name) |
| 1848 | (setq next-node-name (texinfo-copy-node-name)) | 1848 | (setq next-node-name (texinfo-copy-node-name)) |
| 1849 | (setq menu-list | 1849 | (setq menu-list |
| 1850 | (cons (cons | 1850 | (cons (cons |
| 1851 | next-node-name | 1851 | next-node-name |
| 1852 | (prog1 "" (forward-line 1))) | 1852 | (prog1 "" (forward-line 1))) |
| 1853 | ;; Use following to insert section titles automatically. | 1853 | ;; Use following to insert section titles automatically. |
| @@ -1860,7 +1860,7 @@ Thus, normally, each included file contains one, and only one, chapter." | |||
| 1860 | (if (not (re-search-forward "^@node" nil t)) | 1860 | (if (not (re-search-forward "^@node" nil t)) |
| 1861 | (error "No `@node' line found in %s !" (buffer-name))) | 1861 | (error "No `@node' line found in %s !" (buffer-name))) |
| 1862 | (beginning-of-line) | 1862 | (beginning-of-line) |
| 1863 | 1863 | ||
| 1864 | ;; Update other menus and nodes if requested. | 1864 | ;; Update other menus and nodes if requested. |
| 1865 | (if update-everything (texinfo-all-menus-update t)) | 1865 | (if update-everything (texinfo-all-menus-update t)) |
| 1866 | 1866 | ||
| @@ -1868,10 +1868,10 @@ Thus, normally, each included file contains one, and only one, chapter." | |||
| 1868 | (texinfo-delete-existing-pointers) | 1868 | (texinfo-delete-existing-pointers) |
| 1869 | (end-of-line) | 1869 | (end-of-line) |
| 1870 | (insert ", " next-node-name ", " previous-node-name ", " up-node-name) | 1870 | (insert ", " next-node-name ", " previous-node-name ", " up-node-name) |
| 1871 | 1871 | ||
| 1872 | (beginning-of-line) | 1872 | (beginning-of-line) |
| 1873 | (setq previous-node-name (texinfo-copy-node-name)) | 1873 | (setq previous-node-name (texinfo-copy-node-name)) |
| 1874 | 1874 | ||
| 1875 | (setq files (cdr files))) | 1875 | (setq files (cdr files))) |
| 1876 | (nreverse menu-list))) | 1876 | (nreverse menu-list))) |
| 1877 | 1877 | ||
| @@ -1884,22 +1884,22 @@ Indents the first line of the description, if any, to the value of | |||
| 1884 | (while menu-list | 1884 | (while menu-list |
| 1885 | ;; Every menu entry starts with a star and a space. | 1885 | ;; Every menu entry starts with a star and a space. |
| 1886 | (insert "* ") | 1886 | (insert "* ") |
| 1887 | 1887 | ||
| 1888 | ;; Insert the node name (and menu entry name, if present). | 1888 | ;; Insert the node name (and menu entry name, if present). |
| 1889 | (let ((node-part (car (car menu-list)))) | 1889 | (let ((node-part (car (car menu-list)))) |
| 1890 | (if (stringp node-part) | 1890 | (if (stringp node-part) |
| 1891 | ;; "Double colon" entry line; menu entry and node name are the same, | 1891 | ;; "Double colon" entry line; menu entry and node name are the same, |
| 1892 | (insert (format "%s::" node-part)) | 1892 | (insert (format "%s::" node-part)) |
| 1893 | ;; "Single colon" entry line; menu entry and node name are different. | 1893 | ;; "Single colon" entry line; menu entry and node name are different. |
| 1894 | (insert (format "%s: %s." (car node-part) (cdr node-part))))) | 1894 | (insert (format "%s: %s." (car node-part) (cdr node-part))))) |
| 1895 | 1895 | ||
| 1896 | ;; Insert the description, if present. | 1896 | ;; Insert the description, if present. |
| 1897 | (if (cdr (car menu-list)) | 1897 | (if (cdr (car menu-list)) |
| 1898 | (progn | 1898 | (progn |
| 1899 | ;; Move to right place. | 1899 | ;; Move to right place. |
| 1900 | (indent-to texinfo-column-for-description 2) | 1900 | (indent-to texinfo-column-for-description 2) |
| 1901 | ;; Insert description. | 1901 | ;; Insert description. |
| 1902 | (insert (format "%s" (cdr (car menu-list)))))) | 1902 | (insert (format "%s" (cdr (car menu-list)))))) |
| 1903 | 1903 | ||
| 1904 | (insert "\n") ; end this menu entry | 1904 | (insert "\n") ; end this menu entry |
| 1905 | (setq menu-list (cdr menu-list))) | 1905 | (setq menu-list (cdr menu-list))) |
| @@ -1945,7 +1945,7 @@ interactive), update all the menus and all the `Next', `Previous', and | |||
| 1945 | a master menu in OUTER-FILE. Also, update the `Top' level node | 1945 | a master menu in OUTER-FILE. Also, update the `Top' level node |
| 1946 | pointers of OUTER-FILE. | 1946 | pointers of OUTER-FILE. |
| 1947 | 1947 | ||
| 1948 | Notes: | 1948 | Notes: |
| 1949 | 1949 | ||
| 1950 | * this command does NOT save any files--you must save the | 1950 | * this command does NOT save any files--you must save the |
| 1951 | outer file and any modified, included files. | 1951 | outer file and any modified, included files. |
| @@ -1957,13 +1957,13 @@ Notes: | |||
| 1957 | Requirements: | 1957 | Requirements: |
| 1958 | 1958 | ||
| 1959 | * each of the included files must contain exactly one highest | 1959 | * each of the included files must contain exactly one highest |
| 1960 | hierarchical level node, | 1960 | hierarchical level node, |
| 1961 | * this highest node must be the first node in the included file, | 1961 | * this highest node must be the first node in the included file, |
| 1962 | * each highest hierarchical level node must be of the same type. | 1962 | * each highest hierarchical level node must be of the same type. |
| 1963 | 1963 | ||
| 1964 | Thus, normally, each included file contains one, and only one, | 1964 | Thus, normally, each included file contains one, and only one, |
| 1965 | chapter." | 1965 | chapter." |
| 1966 | 1966 | ||
| 1967 | (interactive (cons | 1967 | (interactive (cons |
| 1968 | (read-string | 1968 | (read-string |
| 1969 | "Name of outer `include' file: " | 1969 | "Name of outer `include' file: " |
| @@ -1971,7 +1971,7 @@ chapter." | |||
| 1971 | (cond ((not current-prefix-arg) | 1971 | (cond ((not current-prefix-arg) |
| 1972 | '(nil nil)) | 1972 | '(nil nil)) |
| 1973 | ((listp current-prefix-arg) | 1973 | ((listp current-prefix-arg) |
| 1974 | '(t nil)) ; make-master-menu | 1974 | '(t nil)) ; make-master-menu |
| 1975 | ((numberp current-prefix-arg) | 1975 | ((numberp current-prefix-arg) |
| 1976 | '(t t)) ; update-everything | 1976 | '(t t)) ; update-everything |
| 1977 | ))) | 1977 | ))) |
| @@ -1983,7 +1983,7 @@ chapter." | |||
| 1983 | previous-node-name | 1983 | previous-node-name |
| 1984 | (up-node-name "Top")) | 1984 | (up-node-name "Top")) |
| 1985 | 1985 | ||
| 1986 | ;;; Update the pointers | 1986 | ;;; Update the pointers |
| 1987 | ;;; and collect the names of the nodes and titles | 1987 | ;;; and collect the names of the nodes and titles |
| 1988 | (setq main-menu-list (texinfo-multi-file-update files update-everything)) | 1988 | (setq main-menu-list (texinfo-multi-file-update files update-everything)) |
| 1989 | 1989 | ||
| @@ -2023,7 +2023,7 @@ chapter." | |||
| 2023 | (goto-char (match-beginning 0)) | 2023 | (goto-char (match-beginning 0)) |
| 2024 | ;; Check if @detailmenu kludge is used; | 2024 | ;; Check if @detailmenu kludge is used; |
| 2025 | ;; if so, leave point before @detailmenu. | 2025 | ;; if so, leave point before @detailmenu. |
| 2026 | (search-backward "\n@detailmenu" | 2026 | (search-backward "\n@detailmenu" |
| 2027 | (save-excursion (forward-line -3) (point)) | 2027 | (save-excursion (forward-line -3) (point)) |
| 2028 | t) | 2028 | t) |
| 2029 | ;; Remove detailed master menu listing | 2029 | ;; Remove detailed master menu listing |
| @@ -2035,19 +2035,19 @@ chapter." | |||
| 2035 | (delete-region (point) end-of-detailed-menu-descriptions)))) | 2035 | (delete-region (point) end-of-detailed-menu-descriptions)))) |
| 2036 | 2036 | ||
| 2037 | ;; Create a master menu and insert it | 2037 | ;; Create a master menu and insert it |
| 2038 | (texinfo-insert-master-menu-list | 2038 | (texinfo-insert-master-menu-list |
| 2039 | (texinfo-multi-file-master-menu-list | 2039 | (texinfo-multi-file-master-menu-list |
| 2040 | included-file-list))))) | 2040 | included-file-list))))) |
| 2041 | 2041 | ||
| 2042 | ;; Remove unwanted extra lines. | 2042 | ;; Remove unwanted extra lines. |
| 2043 | (save-excursion | 2043 | (save-excursion |
| 2044 | (goto-char (point-min)) | 2044 | (goto-char (point-min)) |
| 2045 | 2045 | ||
| 2046 | (re-search-forward "^@menu") | 2046 | (re-search-forward "^@menu") |
| 2047 | (forward-line -1) | 2047 | (forward-line -1) |
| 2048 | (insert "\n") ; Ensure at least one blank line. | 2048 | (insert "\n") ; Ensure at least one blank line. |
| 2049 | (delete-blank-lines) | 2049 | (delete-blank-lines) |
| 2050 | 2050 | ||
| 2051 | (re-search-forward "^@end menu") | 2051 | (re-search-forward "^@end menu") |
| 2052 | (forward-line 1) | 2052 | (forward-line 1) |
| 2053 | (insert "\n") ; Ensure at least one blank line. | 2053 | (insert "\n") ; Ensure at least one blank line. |