aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1997-06-15 17:39:13 +0000
committerRichard M. Stallman1997-06-15 17:39:13 +0000
commit06cc857db595f8c321e6f3c201741d5b2df8821b (patch)
tree56b8e62b990a046474e1e5471ffd547e8dea6cc6
parent8697863ab31b6d0bf35143db6c11ac9fed9e6ca2 (diff)
downloademacs-06cc857db595f8c321e6f3c201741d5b2df8821b.tar.gz
emacs-06cc857db595f8c321e6f3c201741d5b2df8821b.zip
Many doc fixes.
(texinfo-all-menus-update): Check for @detailmenu. (texinfo-master-menu): Likewise. (texinfo-multiple-files-update): Likewise. (texinfo-insert-master-menu-list): Put in @detailmenu if appropriate.
-rw-r--r--lisp/textmodes/texnfo-upd.el186
1 files changed, 110 insertions, 76 deletions
diff --git a/lisp/textmodes/texnfo-upd.el b/lisp/textmodes/texnfo-upd.el
index 8d45a5d2195..3e647b7c391 100644
--- a/lisp/textmodes/texnfo-upd.el
+++ b/lisp/textmodes/texnfo-upd.el
@@ -230,8 +230,13 @@ nodes in the buffer before updating the menus."
230 (message "Checking for a master menu in %s ... "(buffer-name)) 230 (message "Checking for a master menu in %s ... "(buffer-name))
231 (save-excursion 231 (save-excursion
232 (if (re-search-forward texinfo-master-menu-header nil t) 232 (if (re-search-forward texinfo-master-menu-header nil t)
233 ;; Remove detailed master menu listing
234 (progn 233 (progn
234 ;; Check if @detailmenu kludge is used;
235 ;; if so, leave point before @detailmenu.
236 (search-backward "\n@detailmenu"
237 (save-excursion (forward-line -3) (point))
238 t)
239 ;; Remove detailed master menu listing
235 (setq master-menu-p t) 240 (setq master-menu-p t)
236 (goto-char (match-beginning 0)) 241 (goto-char (match-beginning 0))
237 (let ((end-of-detailed-menu-descriptions 242 (let ((end-of-detailed-menu-descriptions
@@ -424,7 +429,7 @@ old description into the new entry.
424For this function, the new menu is a list made up of lists of dotted 429For this function, the new menu is a list made up of lists of dotted
425pairs in which the first element of the pair is the node name and the 430pairs in which the first element of the pair is the node name and the
426second element the description. The new menu is changed destructively. 431second element the description. The new menu is changed destructively.
427The old menu is the menu as it appears in the texinfo file." 432The old menu is the menu as it appears in the Texinfo file."
428 433
429 (let ((new-menu-list-pointer new-menu-list) 434 (let ((new-menu-list-pointer new-menu-list)
430 (end-of-menu (texinfo-menu-end))) 435 (end-of-menu (texinfo-menu-end)))
@@ -511,7 +516,7 @@ Single argument, END-OF-MENU, is position limiting search."
511 "")) 516 ""))
512 517
513(defun texinfo-menu-end () 518(defun texinfo-menu-end ()
514 "Return position of end of menu. Does not change location of point. 519 "Return position of end of menu, but don't move point.
515Signal an error if not end of menu." 520Signal an error if not end of menu."
516 (save-excursion 521 (save-excursion
517 (if (re-search-forward "^@end menu" nil t) 522 (if (re-search-forward "^@end menu" nil t)
@@ -664,8 +669,8 @@ complements the node name rather than repeats it as a title does."
664 669
665;;; Handling description indentation 670;;; Handling description indentation
666 671
667; Since the make-menu functions indent descriptions, these functions 672;; Since the make-menu functions indent descriptions, these functions
668; are useful primarily for indenting a single menu specially. 673;; are useful primarily for indenting a single menu specially.
669 674
670(defun texinfo-indent-menu-description (column &optional region-p) 675(defun texinfo-indent-menu-description (column &optional region-p)
671 "Indent every description in menu following point to COLUMN. 676 "Indent every description in menu following point to COLUMN.
@@ -776,8 +781,13 @@ title of the section containing the menu."
776 (error "Too few nodes for a master menu!")) 781 (error "Too few nodes for a master menu!"))
777 (point)))) 782 (point))))
778 (if (re-search-forward texinfo-master-menu-header first-chapter t) 783 (if (re-search-forward texinfo-master-menu-header first-chapter t)
779 ;; Remove detailed master menu listing
780 (progn 784 (progn
785 ;; Check if @detailmenu kludge is used;
786 ;; if so, leave point before @detailmenu.
787 (search-backward "\n@detailmenu"
788 (save-excursion (forward-line -3) (point))
789 t)
790 ;; Remove detailed master menu listing
781 (goto-char (match-beginning 0)) 791 (goto-char (match-beginning 0))
782 (let ((end-of-detailed-menu-descriptions 792 (let ((end-of-detailed-menu-descriptions
783 (save-excursion ; beginning of end menu line 793 (save-excursion ; beginning of end menu line
@@ -812,6 +822,11 @@ title of the section containing the menu."
812 (if (re-search-forward texinfo-master-menu-header nil t) 822 (if (re-search-forward texinfo-master-menu-header nil t)
813 (progn 823 (progn
814 (goto-char (match-beginning 0)) 824 (goto-char (match-beginning 0))
825 ;; Check if @detailmenu kludge is used;
826 ;; if so, leave point before @detailmenu.
827 (search-backward "\n@detailmenu"
828 (save-excursion (forward-line -3) (point))
829 t)
815 (insert "\n") 830 (insert "\n")
816 (delete-blank-lines) 831 (delete-blank-lines)
817 (goto-char (point-min)))) 832 (goto-char (point-min))))
@@ -867,49 +882,63 @@ However, there does not need to be a title field."
867 (point) 882 (point)
868 (save-excursion (re-search-forward "^@end menu") (point))) 883 (save-excursion (re-search-forward "^@end menu") (point)))
869 884
870 (save-excursion ; leave point at beginning of menu 885 (save-excursion
871 ;; Handle top of menu 886 ;; `master-menu-inserted-p' is a kludge to tell
872 (insert "\n@menu\n") 887 ;; whether to insert @end detailmenu (see bleow)
873 ;; Insert chapter menu entries 888 (let (master-menu-inserted-p)
874 (setq this-very-menu-list (reverse (car (car master-menu-list)))) 889 ;; Handle top of menu
875 ;; Tell user what is going on. 890 (insert "\n@menu\n")
876 (message "Inserting chapter menu entry: %s ... " this-very-menu-list) 891 ;; Insert chapter menu entries
877 (while this-very-menu-list 892 (setq this-very-menu-list (reverse (car (car master-menu-list))))
878 (insert "* " (car this-very-menu-list) "\n") 893 ;; Tell user what is going on.
879 (setq this-very-menu-list (cdr this-very-menu-list))) 894 (message "Inserting chapter menu entry: %s ... " this-very-menu-list)
895 (while this-very-menu-list
896 (insert "* " (car this-very-menu-list) "\n")
897 (setq this-very-menu-list (cdr this-very-menu-list)))
880 898
881 (setq master-menu-list (cdr master-menu-list)) 899 (setq master-menu-list (cdr master-menu-list))
882 900
883 ;; Now, insert all the other menus (if we have any). 901 ;; Only insert detailed master menu if there is one....
902 (if (car (car master-menu-list))
903 (progn (setq master-menu-inserted-p t)
904 (insert (concat "\n@detailmenu" texinfo-master-menu-header))))
905
906 ;; @detailmenu added 5 Sept 1996 to `texinfo-master-menu-header'
907 ;; at Karl Berry's request to avert a bug in `makeinfo';
908 ;; all agree this is a bad kludge and should eventually be removed.
909 ;; @detailmenu ... @end detailmenu is a noop in `texinfmt.el'.
910 ;; See @end detailmenu below;
911 ;; also see `texinfo-all-menus-update' above, `texinfo-master-menu',
912 ;; `texinfo-multiple-files-update'.
913
914 ;; Now, insert all the other menus
884 915
885 ;; The menu master-menu-list has a form like this: 916 ;; The menu master-menu-list has a form like this:
886 ;; ((("beta" "alpha") "title-A") 917 ;; ((("beta" "alpha") "title-A")
887 ;; (("delta" "gamma") "title-B")) 918 ;; (("delta" "gamma") "title-B"))
888
889 (if (car (car master-menu-list))
890 (progn
891 (insert "\n@detailmenu\n")
892 (insert texinfo-master-menu-header)
893 919
894 (while master-menu-list 920 (while master-menu-list
895 921
896 (message 922 (message
897 "Inserting menu for %s .... " (car (cdr (car master-menu-list)))) 923 "Inserting menu for %s .... " (car (cdr (car master-menu-list))))
898 ;; insert title of menu section 924 ;; insert title of menu section
899 (insert "\n" (car (cdr (car master-menu-list))) "\n\n") 925 (insert "\n" (car (cdr (car master-menu-list))) "\n\n")
900 926
901 ;; insert each menu entry 927 ;; insert each menu entry
902 (setq this-very-menu-list (reverse (car (car master-menu-list)))) 928 (setq this-very-menu-list (reverse (car (car master-menu-list))))
903 (while this-very-menu-list 929 (while this-very-menu-list
904 (insert "* " (car this-very-menu-list) "\n") 930 (insert "* " (car this-very-menu-list) "\n")
905 (setq this-very-menu-list (cdr this-very-menu-list))) 931 (setq this-very-menu-list (cdr this-very-menu-list)))
906 932
907 (setq master-menu-list (cdr master-menu-list))) 933 (setq master-menu-list (cdr master-menu-list)))
908
909 (insert "@end detaimenu\n")))
910 934
911 ;; Finish menu 935 ;; Finish menu
912 (insert "@end menu\n\n"))) 936
937 ;; @detailmenu (see note above)
938 ;; Only insert @end detailmenu if a master menu was inserted.
939 (if master-menu-inserted-p
940 (insert "\n@end detailmenu"))
941 (insert "\n@end menu\n\n"))))
913 942
914(defun texinfo-locate-menu-p () 943(defun texinfo-locate-menu-p ()
915 "Find the next menu in the texinfo file. 944 "Find the next menu in the texinfo file.
@@ -1336,7 +1365,7 @@ line, including the comma. Leaves point at beginning of line."
1336 1365
1337(defun texinfo-find-pointer (beginning end level direction) 1366(defun texinfo-find-pointer (beginning end level direction)
1338 "Move point to section associated with next, previous, or up pointer. 1367 "Move point to section associated with next, previous, or up pointer.
1339Return type of pointer (either 'normal or 'no-pointer). 1368Return type of pointer (either `normal' or `no-pointer').
1340 1369
1341The first and second arguments bound the search for a pointer to the 1370The first and second arguments bound the search for a pointer to the
1342beginning and end, respectively, of the enclosing higher level 1371beginning and end, respectively, of the enclosing higher level
@@ -1417,7 +1446,7 @@ will be at some level higher in the Texinfo file. The fourth argument
1417 1446
1418(defun texinfo-pointer-name (kind) 1447(defun texinfo-pointer-name (kind)
1419 "Return the node name preceding the section command. 1448 "Return the node name preceding the section command.
1420The argument is the kind of section, either normal or no-pointer." 1449The argument is the kind of section, either `normal' or `no-pointer'."
1421 (let (name) 1450 (let (name)
1422 (cond ((eq kind 'normal) 1451 (cond ((eq kind 'normal)
1423 (end-of-line) ; this handles prev node top case 1452 (end-of-line) ; this handles prev node top case
@@ -1427,6 +1456,8 @@ The argument is the kind of section, either normal or no-pointer."
1427 t) 1456 t)
1428 (setq name (texinfo-copy-node-name))) 1457 (setq name (texinfo-copy-node-name)))
1429 ((eq kind 'no-pointer) 1458 ((eq kind 'no-pointer)
1459 ;; Don't need to put a blank in the pointer slot,
1460 ;; since insert "' " always has a space
1430 (setq name " "))) ; put a blank in the pointer slot 1461 (setq name " "))) ; put a blank in the pointer slot
1431 name)) 1462 name))
1432 1463
@@ -1438,8 +1469,7 @@ The first and second arguments bound the search for a pointer to the
1438beginning and end, respectively, of the enclosing higher level 1469beginning and end, respectively, of the enclosing higher level
1439section. The third argument is the hierarchical level of the Texinfo 1470section. The third argument is the hierarchical level of the Texinfo
1440file, a string such as \"section\". The fourth argument is direction 1471file, a string such as \"section\". The fourth argument is direction
1441towards which the pointer is directed, one of `next, `previous, or 1472towards which the pointer is directed, one of `next', `previous', or `up'."
1442'up."
1443 1473
1444 (end-of-line) 1474 (end-of-line)
1445 (insert 1475 (insert
@@ -1456,13 +1486,13 @@ towards which the pointer is directed, one of `next, `previous, or
1456 1486
1457 1487
1458;;; Updating nodes sequentially 1488;;; Updating nodes sequentially
1459; These sequential update functions insert `Next' or `Previous' 1489;; These sequential update functions insert `Next' or `Previous'
1460; pointers that point to the following or preceding nodes even if they 1490;; pointers that point to the following or preceding nodes even if they
1461; are at higher or lower hierarchical levels. This means that if a 1491;; are at higher or lower hierarchical levels. This means that if a
1462; section contains one or more subsections, the section's `Next' 1492;; section contains one or more subsections, the section's `Next'
1463; pointer will point to the subsection and not the following section. 1493;; pointer will point to the subsection and not the following section.
1464; (The subsection to which `Next' points will most likely be the first 1494;; (The subsection to which `Next' points will most likely be the first
1465; item on the section's menu.) 1495;; item on the section's menu.)
1466 1496
1467;;;###autoload 1497;;;###autoload
1468(defun texinfo-sequential-node-update (&optional region-p) 1498(defun texinfo-sequential-node-update (&optional region-p)
@@ -1535,13 +1565,13 @@ regardless of its hierarchical level."
1535Move point to section associated with the pointer. Find point even if 1565Move point to section associated with the pointer. Find point even if
1536it is in a different section. 1566it is in a different section.
1537 1567
1538Return type of pointer (either 'normal or 'no-pointer). 1568Return type of pointer (either `normal' or `no-pointer').
1539 1569
1540The first argument is a string specifying the general kind of section 1570The first argument is a string specifying the general kind of section
1541such as \"chapter\" or \"section\". The section found will be at the 1571such as \"chapter\" or \"section\". The section found will be at the
1542same hierarchical level in the Texinfo file, or, in the case of the up 1572same hierarchical level in the Texinfo file, or, in the case of the up
1543pointer, some level higher. The second argument (one of 'next, 1573pointer, some level higher. The second argument (one of `next',
1544'previous, or 'up) specifies whether to find the `Next', `Previous', 1574`previous', or `up') specifies whether to find the `Next', `Previous',
1545or `Up' pointer." 1575or `Up' pointer."
1546 (let ((case-fold-search t)) 1576 (let ((case-fold-search t))
1547 (cond ((eq direction 'next) 1577 (cond ((eq direction 'next)
@@ -1575,7 +1605,7 @@ Move point forward.
1575 1605
1576The first argument is the hierarchical level of the Texinfo file, a 1606The first argument is the hierarchical level of the Texinfo file, a
1577string such as \"section\". The second argument is direction, one of 1607string such as \"section\". The second argument is direction, one of
1578`next, `previous, or 'up." 1608`next', `previous', or `up'."
1579 1609
1580 (end-of-line) 1610 (end-of-line)
1581 (insert 1611 (insert
@@ -1586,15 +1616,15 @@ string such as \"section\". The second argument is direction, one of
1586 1616
1587 1617
1588;;; Inserting `@node' lines 1618;;; Inserting `@node' lines
1589; The `texinfo-insert-node-lines' function inserts `@node' lines as needed 1619;; The `texinfo-insert-node-lines' function inserts `@node' lines as needed
1590; before the `@chapter', `@section', and such like lines of a region 1620;; before the `@chapter', `@section', and such like lines of a region
1591; in a Texinfo file. 1621;; in a Texinfo file.
1592 1622
1593(defun texinfo-insert-node-lines (beginning end &optional title-p) 1623(defun texinfo-insert-node-lines (beginning end &optional title-p)
1594 "Insert missing `@node' lines in region of Texinfo file. 1624 "Insert missing `@node' lines in region of Texinfo file.
1595Non-nil argument (prefix, if interactive) means also to insert the 1625Non-nil argument (prefix, if interactive) means also to insert the
1596section titles as node names; and also to insert the section titles as 1626section titles as node names; and also to insert the section titles as
1597node names in pre-existing @node lines that lack names." 1627node names in pre-existing `@node' lines that lack names."
1598 (interactive "r\nP") 1628 (interactive "r\nP")
1599 1629
1600 ;; Use marker; after inserting node lines, leave point at end of 1630 ;; Use marker; after inserting node lines, leave point at end of
@@ -1755,18 +1785,17 @@ Requirements:
1755 * this node must be the first node in the included file, 1785 * this node must be the first node in the included file,
1756 * each highest hierarchical level node must be of the same type. 1786 * each highest hierarchical level node must be of the same type.
1757 1787
1758Thus, normally, each included file contains one, and only one, 1788Thus, normally, each included file contains one, and only one, chapter."
1759chapter."
1760 1789
1761; The menu-list has the form: 1790;; The menu-list has the form:
1762; 1791;;
1763; \(\(\"node-name1\" . \"title1\"\) 1792;; \(\(\"node-name1\" . \"title1\"\)
1764; \(\"node-name2\" . \"title2\"\) ... \) 1793;; \(\"node-name2\" . \"title2\"\) ... \)
1765; 1794;;
1766; 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
1767; 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.
1768; 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
1769; description slot of a menu as a description. 1798;; description slot of a menu as a description.
1770 1799
1771 (let ((case-fold-search t) 1800 (let ((case-fold-search t)
1772 menu-list) 1801 menu-list)
@@ -1849,7 +1878,7 @@ chapter."
1849(defun texinfo-multi-files-insert-main-menu (menu-list) 1878(defun texinfo-multi-files-insert-main-menu (menu-list)
1850 "Insert formatted main menu at point. 1879 "Insert formatted main menu at point.
1851Indents the first line of the description, if any, to the value of 1880Indents the first line of the description, if any, to the value of
1852texinfo-column-for-description." 1881`texinfo-column-for-description'."
1853 1882
1854 (insert "@menu\n") 1883 (insert "@menu\n")
1855 (while menu-list 1884 (while menu-list
@@ -1990,9 +2019,14 @@ chapter."
1990 ;; First, removing detailed part of any pre-existing master menu 2019 ;; First, removing detailed part of any pre-existing master menu
1991 (goto-char (point-min)) 2020 (goto-char (point-min))
1992 (if (re-search-forward texinfo-master-menu-header nil t) 2021 (if (re-search-forward texinfo-master-menu-header nil t)
1993 ;; Remove detailed master menu listing
1994 (progn 2022 (progn
1995 (goto-char (match-beginning 0)) 2023 (goto-char (match-beginning 0))
2024 ;; Check if @detailmenu kludge is used;
2025 ;; if so, leave point before @detailmenu.
2026 (search-backward "\n@detailmenu"
2027 (save-excursion (forward-line -3) (point))
2028 t)
2029 ;; Remove detailed master menu listing
1996 (let ((end-of-detailed-menu-descriptions 2030 (let ((end-of-detailed-menu-descriptions
1997 (save-excursion ; beginning of end menu line 2031 (save-excursion ; beginning of end menu line
1998 (goto-char (texinfo-menu-end)) 2032 (goto-char (texinfo-menu-end))