diff options
| author | Eli Zaretskii | 2011-12-10 12:49:33 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2011-12-10 12:49:33 +0200 |
| commit | e5d84bfe065f1d8172165ee2bdd15193f7447d8a (patch) | |
| tree | 282ca1ea83f7224c4f1c15991ce7aca99ae12185 | |
| parent | cd0314dd85973d891bcf4a8f5cd1ca025ea93e33 (diff) | |
| download | emacs-e5d84bfe065f1d8172165ee2bdd15193f7447d8a.tar.gz emacs-e5d84bfe065f1d8172165ee2bdd15193f7447d8a.zip | |
Fix documentation and one misfeature of Texinfo mode update commands.
lisp/textmodes/texnfo-upd.el: Update commentary. Add a warning not
to use texinfo-update-node and commands that call it if the
Texinfo file uses @node lines without next/prev/up pointers.
(texinfo-all-menus-update, texinfo-master-menu)
(texinfo-update-node, texinfo-every-node-update)
(texinfo-multiple-files-update): Doc fix. Warn against updating
all the @node lines.
(texinfo-master-menu): Only call texinfo-update-node if the prefix
argument is numeric. See also this thread:
http://lists.gnu.org/archive/html/emacs-devel/2011-12/msg00156.html.
Fixes: debbugs:2975
| -rw-r--r-- | lisp/ChangeLog | 13 | ||||
| -rw-r--r-- | lisp/textmodes/texnfo-upd.el | 95 |
2 files changed, 87 insertions, 21 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ed5af2e2b20..3d1f85ea73e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,16 @@ | |||
| 1 | 2011-12-10 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * textmodes/texnfo-upd.el: Update commentary. Add a warning not | ||
| 4 | to use texinfo-update-node and commands that call it if the | ||
| 5 | Texinfo file uses @node lines without next/prev/up pointers. | ||
| 6 | (texinfo-all-menus-update, texinfo-master-menu) | ||
| 7 | (texinfo-update-node, texinfo-every-node-update) | ||
| 8 | (texinfo-multiple-files-update): Doc fix. Warn against updating | ||
| 9 | all the @node lines. | ||
| 10 | (texinfo-master-menu): Only call texinfo-update-node if the prefix | ||
| 11 | argument is numeric. (Bug#2975) See also this thread: | ||
| 12 | http://lists.gnu.org/archive/html/emacs-devel/2011-12/msg00156.html. | ||
| 13 | |||
| 1 | 2011-12-09 Manuel Gómez <mgrojo@gmail.com> (tiny change) | 14 | 2011-12-09 Manuel Gómez <mgrojo@gmail.com> (tiny change) |
| 2 | 15 | ||
| 3 | * speedbar.el (speedbar-supported-extension-expressions): | 16 | * speedbar.el (speedbar-supported-extension-expressions): |
diff --git a/lisp/textmodes/texnfo-upd.el b/lisp/textmodes/texnfo-upd.el index 047bba72ccd..e21e8ba7623 100644 --- a/lisp/textmodes/texnfo-upd.el +++ b/lisp/textmodes/texnfo-upd.el | |||
| @@ -23,7 +23,9 @@ | |||
| 23 | 23 | ||
| 24 | ;;; Commentary: | 24 | ;;; Commentary: |
| 25 | 25 | ||
| 26 | ;; Known bug: update commands fail to ignore @ignore. | 26 | ;; Known bug: update commands fail to ignore @ignore, and fail to DTRT |
| 27 | ;; with the @if... directives (so expect trouble when the manual uses | ||
| 28 | ;; different @node lines or @menu items in @iftex and in @ifnottex). | ||
| 27 | 29 | ||
| 28 | ;; Summary: how to use the updating commands | 30 | ;; Summary: how to use the updating commands |
| 29 | 31 | ||
| @@ -37,6 +39,16 @@ | |||
| 37 | ;; With a prefix argument, the `texinfo-update-node' and | 39 | ;; With a prefix argument, the `texinfo-update-node' and |
| 38 | ;; `texinfo-make-menu' functions do their jobs in the region. | 40 | ;; `texinfo-make-menu' functions do their jobs in the region. |
| 39 | ;; | 41 | ;; |
| 42 | ;; Important note: We do NOT recommend use of these commands to update | ||
| 43 | ;; the `Next', `Previous' and `Up' pointers on @node lines. Most | ||
| 44 | ;; manuals, including those whose Texinfo files adhere to the strucure | ||
| 45 | ;; described below, don't need these pointers, because makeinfo will | ||
| 46 | ;; generate them automatically (see the node "makeinfo Pointer | ||
| 47 | ;; Creation" in the Texinfo manual). By contrast, due to known bugs | ||
| 48 | ;; described above, texinfo-update-node etc. could produce incorrect | ||
| 49 | ;; pointers, and thus make a perfectly valid Texinfo file into an | ||
| 50 | ;; invalid one. You _have_ been warned! | ||
| 51 | ;; | ||
| 40 | ;; In brief, the functions for creating or updating nodes and menus, are: | 52 | ;; In brief, the functions for creating or updating nodes and menus, are: |
| 41 | ;; | 53 | ;; |
| 42 | ;; texinfo-update-node (&optional beginning end) | 54 | ;; texinfo-update-node (&optional beginning end) |
| @@ -89,6 +101,16 @@ | |||
| 89 | ;; It does not matter whether the `@node' line has pre-existing | 101 | ;; It does not matter whether the `@node' line has pre-existing |
| 90 | ;; `Next', `Previous', or `Up' pointers in it. They are removed. | 102 | ;; `Next', `Previous', or `Up' pointers in it. They are removed. |
| 91 | 103 | ||
| 104 | ;; Warning: Since the pre-existing pointers are replaced with the ones | ||
| 105 | ;; computed by `texinfo-update-node', and since this function has | ||
| 106 | ;; known bugs with the more advanced Texinfo features (see above), it | ||
| 107 | ;; could produce an invalid Texinfo file. You are well advised not to | ||
| 108 | ;; use this function, except if you know what you are doing and | ||
| 109 | ;; exercise extreme caution. Keep in mind that most manuals do not | ||
| 110 | ;; need the `Next', `Previous', and `Up' pointers to be present on the | ||
| 111 | ;; @node lines; makeinfo will automatically generate them when it | ||
| 112 | ;; produces the Info or HTML versions of the manual. | ||
| 113 | |||
| 92 | ;; The `texinfo-every-node-update' function runs `texinfo-update-node' | 114 | ;; The `texinfo-every-node-update' function runs `texinfo-update-node' |
| 93 | ;; on the whole buffer. | 115 | ;; on the whole buffer. |
| 94 | 116 | ||
| @@ -119,12 +141,15 @@ | |||
| 119 | ;; on the whole buffer. | 141 | ;; on the whole buffer. |
| 120 | 142 | ||
| 121 | ;; The `texinfo-master-menu' function creates an extended menu located | 143 | ;; The `texinfo-master-menu' function creates an extended menu located |
| 122 | ;; after the top node. (The file must have a top node.) The function | 144 | ;; after the top node. (The file must have a top node.) This |
| 123 | ;; first updates all the regular menus in the buffer (incorporating the | 145 | ;; function works only on Texinfo files all of whose @node lines are |
| 124 | ;; descriptions from pre-existing menus), and then constructs a master | 146 | ;; present in a single file; use `texinfo-multiple-files-update' for |
| 125 | ;; menu that includes every entry from every other menu. (However, the | 147 | ;; multi-file manuals. The function first updates all the regular |
| 126 | ;; function cannot update an already existing master menu; if one | 148 | ;; menus in the buffer (incorporating the descriptions from |
| 127 | ;; exists, it must be removed before calling the function.) | 149 | ;; pre-existing menus), and then constructs a master menu that |
| 150 | ;; includes every entry from every other menu. (However, the function | ||
| 151 | ;; cannot update an already existing master menu; if one exists, it | ||
| 152 | ;; must be removed before calling the function.) | ||
| 128 | 153 | ||
| 129 | ;; The `texinfo-indent-menu-description' function indents every | 154 | ;; The `texinfo-indent-menu-description' function indents every |
| 130 | ;; description in the menu following point, to the specified column. | 155 | ;; description in the menu following point, to the specified column. |
| @@ -142,7 +167,7 @@ | |||
| 142 | ;; as node names in pre-existing `@node' lines that lack names. | 167 | ;; as node names in pre-existing `@node' lines that lack names. |
| 143 | ;; | 168 | ;; |
| 144 | ;; Since node names should be more concise than section or chapter | 169 | ;; Since node names should be more concise than section or chapter |
| 145 | ;; titles, node names so inserted will need to be edited manually. | 170 | ;; titles, you will usually want to manually edit node names so inserted. |
| 146 | 171 | ||
| 147 | 172 | ||
| 148 | ;;; Code: | 173 | ;;; Code: |
| @@ -330,8 +355,13 @@ at the level specified by LEVEL. Point is left at the end of menu." | |||
| 330 | "Update every regular menu in a Texinfo file. | 355 | "Update every regular menu in a Texinfo file. |
| 331 | Update pre-existing master menu, if there is one. | 356 | Update pre-existing master menu, if there is one. |
| 332 | 357 | ||
| 358 | Only single-file manuals are supported by this function. For | ||
| 359 | multi-file manuals, use `texinfo-multiple-files-update'. | ||
| 360 | |||
| 333 | If called with a non-nil argument, this function first updates all the | 361 | If called with a non-nil argument, this function first updates all the |
| 334 | nodes in the buffer before updating the menus. | 362 | nodes in the buffer before updating the menus. Do NOT invoke this |
| 363 | command with an argument if your Texinfo file uses @node lines without | ||
| 364 | the `Next', `Previous', and `Up' pointers! | ||
| 335 | 365 | ||
| 336 | Indents the first line of descriptions, and leaves trailing whitespace | 366 | Indents the first line of descriptions, and leaves trailing whitespace |
| 337 | in a menu that lacks descriptions, so descriptions will format well. | 367 | in a menu that lacks descriptions, so descriptions will format well. |
| @@ -843,17 +873,25 @@ second and subsequent lines of a multi-line description." | |||
| 843 | 873 | ||
| 844 | (defun texinfo-master-menu (update-all-nodes-menus-p) | 874 | (defun texinfo-master-menu (update-all-nodes-menus-p) |
| 845 | "Make a master menu for a whole Texinfo file. | 875 | "Make a master menu for a whole Texinfo file. |
| 846 | Non-nil argument (prefix, if interactive) means first update all | 876 | Remove pre-existing master menu, if there is one. |
| 847 | existing nodes and menus. Remove pre-existing master menu, if there is one. | 877 | |
| 878 | This function supports only single-file manuals. For multi-file | ||
| 879 | manuals, use `texinfo-multiple-files-update'. | ||
| 880 | |||
| 881 | Non-nil, non-numeric argument (C-u prefix, if interactive) means | ||
| 882 | first update all existing menus in the buffer (incorporating | ||
| 883 | descriptions from pre-existing menus) before it constructs the | ||
| 884 | master menu. If the argument is numeric (e.g., \"C-u 2\"), | ||
| 885 | update all existing nodes as well, by calling | ||
| 886 | \`texinfo-update-node' on the entire file. Warning: do NOT | ||
| 887 | invoke with a numeric argument if your Texinfo file uses @node | ||
| 888 | lines without the `Next', `Previous', `Up' pointers, as the | ||
| 889 | result could be an invalid Texinfo file! | ||
| 848 | 890 | ||
| 849 | This function creates a master menu that follows the top node. The | 891 | This function creates a master menu that follows the top node. The |
| 850 | master menu includes every entry from all the other menus. It | 892 | master menu includes every entry from all the other menus. It |
| 851 | replaces any existing ordinary menu that follows the top node. | 893 | replaces any existing ordinary menu that follows the top node. |
| 852 | 894 | ||
| 853 | If called with a non-nil argument, this function first updates all the | ||
| 854 | menus in the buffer (incorporating descriptions from pre-existing | ||
| 855 | menus) before it constructs the master menu. | ||
| 856 | |||
| 857 | The function removes the detailed part of an already existing master | 895 | The function removes the detailed part of an already existing master |
| 858 | menu. This action depends on the pre-existing master menu using the | 896 | menu. This action depends on the pre-existing master menu using the |
| 859 | standard `texinfo-master-menu-header'. | 897 | standard `texinfo-master-menu-header'. |
| @@ -909,10 +947,11 @@ section titles are often too short to explain a node well." | |||
| 909 | 947 | ||
| 910 | (if update-all-nodes-menus-p | 948 | (if update-all-nodes-menus-p |
| 911 | (progn | 949 | (progn |
| 912 | (message "Making a master menu in %s ...first updating all nodes... " | 950 | (when (numberp update-all-nodes-menus-p) |
| 913 | (buffer-name)) | 951 | (message |
| 914 | (texinfo-update-node (point-min) (point-max)) | 952 | "Making a master menu in %s ...first updating all nodes... " |
| 915 | 953 | (buffer-name)) | |
| 954 | (texinfo-update-node (point-min) (point-max))) | ||
| 916 | (message "Updating all menus in %s ... " (buffer-name)) | 955 | (message "Updating all menus in %s ... " (buffer-name)) |
| 917 | (texinfo-make-menu (point-min) (point-max)))) | 956 | (texinfo-make-menu (point-min) (point-max)))) |
| 918 | 957 | ||
| @@ -1207,6 +1246,11 @@ end of that region; it limits the search." | |||
| 1207 | "Without any prefix argument, update the node in which point is located. | 1246 | "Without any prefix argument, update the node in which point is located. |
| 1208 | Interactively, a prefix argument means to operate on the region. | 1247 | Interactively, a prefix argument means to operate on the region. |
| 1209 | 1248 | ||
| 1249 | Warning: do NOT use this function if your Texinfo file uses @node | ||
| 1250 | lines without the `Next', `Previous', `Up' pointers, because the | ||
| 1251 | result could be an invalid Texinfo file due to known deficiencies | ||
| 1252 | in this command: it does not support @ignore and @if* directives. | ||
| 1253 | |||
| 1210 | The functions for creating or updating nodes and menus, and their | 1254 | The functions for creating or updating nodes and menus, and their |
| 1211 | keybindings, are: | 1255 | keybindings, are: |
| 1212 | 1256 | ||
| @@ -1246,7 +1290,12 @@ which menu descriptions are indented. Its default value is 32." | |||
| 1246 | (message "Done...nodes updated in region. You may save the buffer.")))))) | 1290 | (message "Done...nodes updated in region. You may save the buffer.")))))) |
| 1247 | 1291 | ||
| 1248 | (defun texinfo-every-node-update () | 1292 | (defun texinfo-every-node-update () |
| 1249 | "Update every node in a Texinfo file." | 1293 | "Update every node in a Texinfo file. |
| 1294 | |||
| 1295 | Warning: do NOT use this function if your Texinfo file uses @node | ||
| 1296 | lines without the `Next', `Previous', `Up' pointers, because the | ||
| 1297 | result could be an invalid Texinfo file due to known deficiencies | ||
| 1298 | in this command: it does not support @ignore and @if* directives." | ||
| 1250 | (interactive) | 1299 | (interactive) |
| 1251 | (save-excursion | 1300 | (save-excursion |
| 1252 | (texinfo-update-node (point-min) (point-max)) | 1301 | (texinfo-update-node (point-min) (point-max)) |
| @@ -1934,7 +1983,11 @@ With optional UPDATE-EVERYTHING argument (numeric prefix arg, if | |||
| 1934 | interactive), update all the menus and all the `Next', `Previous', and | 1983 | interactive), update all the menus and all the `Next', `Previous', and |
| 1935 | `Up' pointers of all the files included in OUTER-FILE before inserting | 1984 | `Up' pointers of all the files included in OUTER-FILE before inserting |
| 1936 | a master menu in OUTER-FILE. Also, update the `Top' level node | 1985 | a master menu in OUTER-FILE. Also, update the `Top' level node |
| 1937 | pointers of OUTER-FILE. | 1986 | pointers of OUTER-FILE. Do NOT invoke this command with a numeric prefix |
| 1987 | arg, if your files use @node lines without the `Next', `Previous', `Up' | ||
| 1988 | pointers, because this could produce invalid Texinfo files due to known | ||
| 1989 | deficiencies in `texinfo-update-node': it does not support the @ignore | ||
| 1990 | and @if... directives. | ||
| 1938 | 1991 | ||
| 1939 | Notes: | 1992 | Notes: |
| 1940 | 1993 | ||