Function: texinfo-multiple-files-update

texinfo-multiple-files-update is an autoloaded, interactive and byte-compiled function defined in texnfo-upd.el.gz.

Signature

(texinfo-multiple-files-update OUTER-FILE &optional MAKE-MASTER-MENU UPDATE-EVERYTHING)

Documentation

Update first node pointers in each file included in OUTER-FILE; create or update the Top level node pointers and the main menu in the outer file that refers to such nodes. This does not create or update menus or pointers within the included files.

With optional MAKE-MASTER-MENU argument (prefix arg, if interactive), insert a master menu in OUTER-FILE in addition to creating or updating pointers in the first @node line in each included file and creating or updating the Top level node pointers of the outer file. This does not create or update other menus and pointers within the included files.

With optional UPDATE-EVERYTHING argument (numeric prefix arg, if interactive), update all the menus and all the Next, Previous, and Up pointers of all the files included in OUTER-FILE before inserting a master menu in OUTER-FILE. Also, update the Top level node pointers of OUTER-FILE. Do NOT invoke this command with a numeric prefix arg, if your files use @node lines without the Next, Previous, Up pointers, because this could produce invalid Texinfo files due to known deficiencies in texinfo-update-node: it does not support the @ignore and @if... directives.

Notes:

  * this command does NOT save any files--you must save the
    outer file and any modified, included files.

  * except for the Top node, this command does NOT handle any
    pre-existing nodes in the outer file; hence, indices must be
    enclosed in an included file.

Requirements:

  * each of the included files must contain exactly one highest
    hierarchical level node,
  * this highest node must be the first node in the included file,
  * each highest hierarchical level node must be of the same type.

Thus, normally, each included file contains one, and only one, chapter.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/texnfo-upd.el.gz
;;; The multiple-file update function

;;;###autoload
(defun texinfo-multiple-files-update
  (outer-file &optional make-master-menu update-everything)
  "Update first node pointers in each file included in OUTER-FILE;
create or update the `Top' level node pointers and the main menu in
the outer file that refers to such nodes.  This does not create or
update menus or pointers within the included files.

With optional MAKE-MASTER-MENU argument (prefix arg, if interactive),
insert a master menu in OUTER-FILE in addition to creating or updating
pointers in the first @node line in each included file and creating or
updating the `Top' level node pointers of the outer file.  This does
not create or update other menus and pointers within the included
files.

With optional UPDATE-EVERYTHING argument (numeric prefix arg, if
interactive), update all the menus and all the `Next', `Previous', and
`Up' pointers of all the files included in OUTER-FILE before inserting
a master menu in OUTER-FILE.  Also, update the `Top' level node
pointers of OUTER-FILE.  Do NOT invoke this command with a numeric prefix
arg, if your files use @node lines without the `Next', `Previous', `Up'
pointers, because this could produce invalid Texinfo files due to known
deficiencies in `texinfo-update-node': it does not support the @ignore
and @if... directives.

Notes:

  * this command does NOT save any files--you must save the
    outer file and any modified, included files.

  * except for the `Top' node, this command does NOT handle any
    pre-existing nodes in the outer file; hence, indices must be
    enclosed in an included file.

Requirements:

  * each of the included files must contain exactly one highest
    hierarchical level node,
  * this highest node must be the first node in the included file,
  * each highest hierarchical level node must be of the same type.

Thus, normally, each included file contains one, and only one,
chapter."

  (interactive (cons
		(read-string
		 "Name of outer `include' file: "
		 (buffer-file-name))
		(cond
		 ((not current-prefix-arg)	'(nil nil))
		 ((listp current-prefix-arg)	'(t nil)) ; make-master-menu
		 ((numberp current-prefix-arg)	'(t t))))) ; update-everything

  (let* ((included-file-list (texinfo-multi-file-included-list outer-file))
	 (files included-file-list)
	 ;; next-node-name
	 ;; previous-node-name
	 ;; Update the pointers and collect the names of the nodes and titles
	 (main-menu-list (texinfo-multi-file-update files update-everything)))

    ;; Insert main menu

    ;; Go to outer file
    (set-buffer (find-file-noselect (car included-file-list)))
    (if (texinfo-old-menu-p
	 (point-min)
	 (save-excursion
	   (re-search-forward "^@include")
	   (line-beginning-position)))
	;; If found, leave point after word `menu' on the `@menu' line.
	(progn
	  (texinfo-incorporate-descriptions main-menu-list)
	  ;; Delete existing menu.
	  (beginning-of-line)
	  (delete-region
	   (point)
	   (save-excursion (re-search-forward "^@end menu") (point)))
	  ;; Insert main menu
	  (texinfo-multi-files-insert-main-menu main-menu-list))

      ;; Else no current menu; insert it before `@include'
      (texinfo-multi-files-insert-main-menu main-menu-list))

    ;; Insert master menu

    (if make-master-menu
	(progn
	  ;; First, removing detailed part of any pre-existing master menu
	  (goto-char (point-min))
	  (if (search-forward texinfo-master-menu-header nil t)
	      (progn
		(goto-char (match-beginning 0))
		;; Check if @detailmenu kludge is used;
		;; if so, leave point before @detailmenu.
		(search-backward "\n@detailmenu" (line-beginning-position -2) t)
		;; Remove detailed master menu listing
		(let ((end-of-detailed-menu-descriptions
		       (save-excursion	; beginning of end menu line
			 (goto-char (texinfo-menu-end))
			 (beginning-of-line) (forward-char -1)
			 (point))))
		  (delete-region (point) end-of-detailed-menu-descriptions))))

	  ;; Create a master menu and insert it
	  (texinfo-insert-master-menu-list
	   (texinfo-multi-file-master-menu-list
	    included-file-list)))))

  ;; Remove unwanted extra lines.
  (save-excursion
    (goto-char (point-min))

    (re-search-forward "^@menu")
    (forward-line -1)
    (insert  "\n")			; Ensure at least one blank line.
    (delete-blank-lines)

    (re-search-forward "^@end menu")
    (forward-line 1)
    (insert  "\n")			; Ensure at least one blank line.
    (delete-blank-lines))

  (message "Multiple files updated."))