# HG changeset patch # User Robert J. Chassell # Date 1072383650 0 # Node ID 767b85819555042536738beb0fabc012a92d4a90 # Parent 990c58ec131c3db05aacac021fcb5c0a6f0d65a7 (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. diff -r 990c58ec131c -r 767b85819555 lisp/textmodes/texnfo-upd.el --- a/lisp/textmodes/texnfo-upd.el Thu Dec 25 18:07:44 2003 +0000 +++ b/lisp/textmodes/texnfo-upd.el Thu Dec 25 20:20:50 2003 +0000 @@ -1,6 +1,6 @@ ;;; 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 @@ ;; 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 @@ (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 @@ 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 @@ (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)