Function: texinfo-insert-master-menu-list
texinfo-insert-master-menu-list is a byte-compiled function defined in
texnfo-upd.el.gz.
Signature
(texinfo-insert-master-menu-list MASTER-MENU-LIST)
Documentation
Format and insert the master menu in the current buffer.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/texnfo-upd.el.gz
(defun texinfo-insert-master-menu-list (master-menu-list)
"Format and insert the master menu in the current buffer."
(goto-char (point-min))
;; Insert a master menu only after `Top' node and before next node
;; (or include file if there is no next node).
(unless (re-search-forward "^@node [ \t]*top[ \t]*\\(,\\|$\\)" nil t)
(error "This buffer needs a Top node"))
(let ((first-chapter
(save-excursion (re-search-forward "^@node\\|^@include") (point))))
(unless (re-search-forward "^@menu" first-chapter t)
(error "Buffer lacks a menu in its first node; create it, then run me again")))
(beginning-of-line)
(delete-region ; buffer must have ordinary top menu
(point)
(save-excursion (re-search-forward "^@end menu") (point)))
(save-excursion
;; `master-menu-inserted-p' is a kludge to tell
;; whether to insert @end detailmenu (see below)
(let (master-menu-inserted-p)
;; Handle top of menu
(insert "\n@menu\n")
;; Insert chapter menu entries. Tell user what is going on.
(message "Inserting chapter menu entry: %s ... "
(car (car master-menu-list)))
(dolist (entry (reverse (car (car master-menu-list))))
(insert "* " entry "\n"))
(setq master-menu-list (cdr master-menu-list))
;; Only insert detailed master menu if there is one....
(if (car (car master-menu-list))
(progn (setq master-menu-inserted-p t)
(insert (concat "\n@detailmenu\n"
texinfo-master-menu-header))))
;; @detailmenu added 5 Sept 1996 to `texinfo-master-menu-header'
;; at Karl Berry's request to avert a bug in `makeinfo';
;; all agree this is a bad kludge and should eventually be removed.
;; @detailmenu ... @end detailmenu is a noop in `texinfmt.el'.
;; See @end detailmenu below;
;; also see `texinfo-all-menus-update' above, `texinfo-master-menu',
;; `texinfo-multiple-files-update'.
;; Now, insert all the other menus
;; The menu master-menu-list has a form like this:
;; ((("beta" "alpha") "title-A")
;; (("delta" "gamma") "title-B"))
(dolist (menu master-menu-list)
(message "Inserting menu for %s .... " (cadr menu))
;; insert title of menu section
(insert "\n" (cadr menu) "\n\n")
;; insert each menu entry
(dolist (entry (reverse (car menu)))
(insert "* " entry "\n")))
;; Finish menu
;; @detailmenu (see note above)
;; Only insert @end detailmenu if a master menu was inserted.
(if master-menu-inserted-p
(insert "\n@end detailmenu"))
(insert "\n@end menu\n\n"))))