Commit d7fc69d1 authored by Robert J. Chassell's avatar Robert J. Chassell

(texinfo-multi-file-update): create a new list of included files,

called `files-with-node-lines', that only have node lines.  This way
@include commands can include any file, such as version and update
files without node lines, not just files that are chapters.
parent fc052137
;;; texnfo-upd.el --- utilities for updating nodes and menus in Texinfo files
;; Copyright (C) 1989, 1990, 1991, 1992, 2001, 2002 Free Software Foundation, Inc.
;; Copyright (C) 1989, 1990, 1991, 1992, 2001, 2002, 2003 Free Software Foundation, Inc.
;; Author: Robert J. Chassell
;; Maintainer: bug-texinfo@gnu.org
......@@ -1795,25 +1795,34 @@ Thus, normally, each included file contains one, and only one, chapter."
;; description slot of a menu as a description.
(let ((case-fold-search t)
menu-list next-node-name previous-node-name)
menu-list next-node-name previous-node-name files-with-node-lines)
;; Find the name of the first node of the first included file.
(set-buffer (find-file-noselect (car (cdr files))))
;; Create a new list of included files that only have node lines
(while files
(set-buffer (find-file-noselect (car files)))
(widen)
(goto-char (point-min))
(when (re-search-forward "^@node" nil t)
(setq files-with-node-lines (cons (car files) files-with-node-lines)))
(setq files (cdr files)))
(setq files-with-node-lines (nreverse files-with-node-lines))
;; Find the name of the first node in a subsequent file
;; and copy it into the variable next-node-name
(set-buffer (find-file-noselect (car (cdr files-with-node-lines))))
(widen)
(goto-char (point-min))
(if (not (re-search-forward "^@node" nil t))
(error "No `@node' line found in %s" (buffer-name)))
(beginning-of-line)
(texinfo-check-for-node-name)
(setq next-node-name (texinfo-copy-node-name))
(push (cons next-node-name (prog1 "" (forward-line 1)))
;; Use following to insert section titles automatically.
;; (texinfo-copy-next-section-title)
menu-list)
;; Go to outer file
(set-buffer (find-file-noselect (pop files)))
;; `pop' is analogous to (prog1 (car PLACE) (setf PLACE (cdr PLACE)))
(set-buffer (find-file-noselect (pop files-with-node-lines)))
(goto-char (point-min))
(if (not (re-search-forward "^@node [ \t]*top[ \t]*\\(,\\|$\\)" nil t))
(error "This buffer needs a Top node"))
......@@ -1824,18 +1833,16 @@ Thus, normally, each included file contains one, and only one, chapter."
(beginning-of-line)
(setq previous-node-name "Top")
(while files
(while files-with-node-lines
(if (not (cdr files))
(if (not (cdr files-with-node-lines))
;; No next file
(setq next-node-name "")
;; Else,
;; find the name of the first node in the next file.
(set-buffer (find-file-noselect (car (cdr files))))
(set-buffer (find-file-noselect (car (cdr files-with-node-lines))))
(widen)
(goto-char (point-min))
(if (not (re-search-forward "^@node" nil t))
(error "No `@node' line found in %s" (buffer-name)))
(beginning-of-line)
(texinfo-check-for-node-name)
(setq next-node-name (texinfo-copy-node-name))
......@@ -1845,10 +1852,8 @@ Thus, normally, each included file contains one, and only one, chapter."
menu-list))
;; Go to node to be updated.
(set-buffer (find-file-noselect (car files)))
(set-buffer (find-file-noselect (car files-with-node-lines)))
(goto-char (point-min))
(if (not (re-search-forward "^@node" nil t))
(error "No `@node' line found in %s" (buffer-name)))
(beginning-of-line)
;; Update other menus and nodes if requested.
......@@ -1862,7 +1867,7 @@ Thus, normally, each included file contains one, and only one, chapter."
(beginning-of-line)
(setq previous-node-name (texinfo-copy-node-name))
(setq files (cdr files)))
(setq files-with-node-lines (cdr files-with-node-lines)))
(nreverse menu-list)))
(defun texinfo-multi-files-insert-main-menu (menu-list)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment