comparison lisp/textmodes/texnfo-upd.el @ 143:fa6580d92860

*** empty log message ***
author Jim Blandy <jimb@redhat.com>
date Thu, 20 Dec 1990 20:38:22 +0000
parents 9de5f63b6407
children 4cd7543be581
comparison
equal deleted inserted replaced
142:df6ec648915f 143:fa6580d92860
195 "Make a menu of all the appropriate nodes in this section. 195 "Make a menu of all the appropriate nodes in this section.
196 `Appropriate nodes' are those associated with sections that are 196 `Appropriate nodes' are those associated with sections that are
197 at the level specified by LEVEL. Point is left at the end of menu." 197 at the level specified by LEVEL. Point is left at the end of menu."
198 (let* 198 (let*
199 ((case-fold-search t) 199 ((case-fold-search t)
200 (beginning (texinfo-update-menu-region-beginning level)) 200 (beginning
201 (save-excursion
202 (goto-char (texinfo-update-menu-region-beginning level))
203 (end-of-line)
204 (point)))
201 (end (texinfo-update-menu-region-end level)) 205 (end (texinfo-update-menu-region-end level))
202 (first (texinfo-menu-first-node beginning end)) 206 (first (texinfo-menu-first-node beginning end))
203 (node-name (progn 207 (node-name (progn
204 (goto-char beginning) 208 (goto-char beginning)
205 (texinfo-copy-node-name))) 209 (texinfo-copy-node-name)))
587 (interactive "P") 591 (interactive "P")
588 (widen) 592 (widen)
589 (goto-char (point-min)) 593 (goto-char (point-min))
590 594
591 ;; Move point to location after `top'. 595 ;; Move point to location after `top'.
592 (if (not (re-search-forward "^@node [ \t]*top" nil t)) 596 (if (not (re-search-forward "^@node [ \t]*top[ \t]*\\(,\\|$\\)" nil t))
593 (error "This buffer needs a Top node!")) 597 (error "This buffer needs a Top node!"))
594 598
595 (let ((first-chapter 599 (let ((first-chapter
596 (save-excursion (re-search-forward "^@node") (point)))) 600 (save-excursion (re-search-forward "^@node") (point))))
597 (if (re-search-forward texinfo-master-menu-header first-chapter t) 601 (if (re-search-forward texinfo-master-menu-header first-chapter t)
782 Searches forward for a section. Hence, point must be before the 786 Searches forward for a section. Hence, point must be before the
783 section whose type will be found. Does not move point. Signal an 787 section whose type will be found. Does not move point. Signal an
784 error if the node is not the top node and a section is not found." 788 error if the node is not the top node and a section is not found."
785 (save-excursion 789 (save-excursion
786 (cond 790 (cond
787 ((re-search-forward "^@node [ \t]*top" nil t) 791 ((re-search-forward "^@node [ \t]*top[ \t]*\\(,\\|$\\)"
792 (save-excursion
793 (end-of-line)
794 (point))
795 t)
788 "top") 796 "top")
789 ((re-search-forward texinfo-section-types-regexp nil t) 797 ((re-search-forward texinfo-section-types-regexp nil t)
790 (buffer-substring (progn (beginning-of-line) ; copy its name 798 (buffer-substring (progn (beginning-of-line) ; copy its name
791 (1+ (point))) 799 (1+ (point)))
792 (progn (forward-word 1) 800 (progn (forward-word 1)
810 Return position of the beginning of the node line; do not move point. 818 Return position of the beginning of the node line; do not move point.
811 Thus, if this level is subsection, searches backwards for section node. 819 Thus, if this level is subsection, searches backwards for section node.
812 Only argument is a string of the general type of section." 820 Only argument is a string of the general type of section."
813 821
814 (cond 822 (cond
815 ((string-equal "top" level) 823 ((or (string-equal "top" level)
824 (string-equal "chapter" level))
816 (save-excursion 825 (save-excursion
817 (re-search-forward "^@node [ \t]*top" nil t) (point))) 826 (goto-char (point-min))
818 ((string-equal "chapter" level) 827 (re-search-forward "^@node [ \t]*top[ \t]*\\(,\\|$\\)" nil t)
819 (save-excursion 828 (beginning-of-line)
820 (re-search-backward "^@node [ \t]*top" nil t)
821 ;; Leave point at end of line so texinfo-menu-locate-entry-p does not
822 ;; accidentally copy an info-only title for the top node into
823 ;; the main or master menu
824 (end-of-line)
825 (point))) 829 (point)))
826 (t 830 (t
827 (save-excursion 831 (save-excursion
828 (re-search-backward 832 (re-search-backward
829 (concat 833 (concat
938 The keys are strings specifying the general hierarchical level in the 942 The keys are strings specifying the general hierarchical level in the
939 document; the values are regular expressions.") 943 document; the values are regular expressions.")
940 944
941 (defvar texinfo-update-menu-higher-regexps 945 (defvar texinfo-update-menu-higher-regexps
942 '(("top" . "^@node [ \t]*DIR") 946 '(("top" . "^@node [ \t]*DIR")
943 ("chapter" . "^@node [ \t]*top") 947 ("chapter" . "^@node [ \t]*top[ \t]*\\(,\\|$\\)")
944 ("section" . 948 ("section" .
945 (concat 949 (concat
946 "\\(^@\\(" 950 "\\(^@\\("
947 texinfo-chapter-level-regexp 951 texinfo-chapter-level-regexp
948 "\\)[ \t]*\\)")) 952 "\\)[ \t]*\\)"))
1525 menu-list)) 1529 menu-list))
1526 1530
1527 ;; Go to outer file 1531 ;; Go to outer file
1528 (switch-to-buffer (find-file-noselect (car files))) 1532 (switch-to-buffer (find-file-noselect (car files)))
1529 (goto-char (point-min)) 1533 (goto-char (point-min))
1530 (if (not (re-search-forward "^@node [ \t]*top" nil t)) 1534 (if (not (re-search-forward "^@node [ \t]*top[ \t]*\\(,\\|$\\)" nil t))
1531 (error "This buffer needs a Top node!")) 1535 (error "This buffer needs a Top node!"))
1532 (beginning-of-line) 1536 (beginning-of-line)
1533 (texinfo-delete-existing-pointers) 1537 (texinfo-delete-existing-pointers)
1534 (end-of-line) 1538 (end-of-line)
1535 (insert ", " next-node-name ", (dir), (dir)") 1539 (insert ", " next-node-name ", (dir), (dir)")