summaryrefslogtreecommitdiff
path: root/lisp/textmodes/texnfo-upd.el
diff options
context:
space:
mode:
authorRobert J. Chassell <bob@rattlesnake.com>2003-12-25 20:20:50 +0000
committerRobert J. Chassell <bob@rattlesnake.com>2003-12-25 20:20:50 +0000
commitd7fc69d16f9aa806b6c73fc6967f1ad62309fa67 (patch)
treef20a70aaa3066a709b8a1c2f68815c6cf96558dc /lisp/textmodes/texnfo-upd.el
parentfc052137c5511debc81094aab706ccf1d6a7581f (diff)
downloademacs-d7fc69d16f9aa806b6c73fc6967f1ad62309fa67.tar.gz
(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.
Diffstat (limited to 'lisp/textmodes/texnfo-upd.el')
-rw-r--r--lisp/textmodes/texnfo-upd.el39
1 files changed, 22 insertions, 17 deletions
diff --git a/lisp/textmodes/texnfo-upd.el b/lisp/textmodes/texnfo-upd.el
index fb44acbff4f..17b0affac92 100644
--- a/lisp/textmodes/texnfo-upd.el
+++ b/lisp/textmodes/texnfo-upd.el
@@ -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 @@ 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)