diff options
| author | Robert J. Chassell | 2003-12-25 20:20:50 +0000 |
|---|---|---|
| committer | Robert J. Chassell | 2003-12-25 20:20:50 +0000 |
| commit | d7fc69d16f9aa806b6c73fc6967f1ad62309fa67 (patch) | |
| tree | f20a70aaa3066a709b8a1c2f68815c6cf96558dc /lisp | |
| parent | fc052137c5511debc81094aab706ccf1d6a7581f (diff) | |
| download | emacs-d7fc69d16f9aa806b6c73fc6967f1ad62309fa67.tar.gz emacs-d7fc69d16f9aa806b6c73fc6967f1ad62309fa67.zip | |
(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')
| -rw-r--r-- | lisp/textmodes/texnfo-upd.el | 39 |
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 @@ | |||
| 1 | ;;; texnfo-upd.el --- utilities for updating nodes and menus in Texinfo files | 1 | ;;; texnfo-upd.el --- utilities for updating nodes and menus in Texinfo files |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1989, 1990, 1991, 1992, 2001, 2002 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1989, 1990, 1991, 1992, 2001, 2002, 2003 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Robert J. Chassell | 5 | ;; Author: Robert J. Chassell |
| 6 | ;; Maintainer: bug-texinfo@gnu.org | 6 | ;; Maintainer: bug-texinfo@gnu.org |
| @@ -1795,25 +1795,34 @@ Thus, normally, each included file contains one, and only one, chapter." | |||
| 1795 | ;; description slot of a menu as a description. | 1795 | ;; description slot of a menu as a description. |
| 1796 | 1796 | ||
| 1797 | (let ((case-fold-search t) | 1797 | (let ((case-fold-search t) |
| 1798 | menu-list next-node-name previous-node-name) | 1798 | menu-list next-node-name previous-node-name files-with-node-lines) |
| 1799 | 1799 | ||
| 1800 | ;; Find the name of the first node of the first included file. | 1800 | ;; Create a new list of included files that only have node lines |
| 1801 | (set-buffer (find-file-noselect (car (cdr files)))) | 1801 | (while files |
| 1802 | (set-buffer (find-file-noselect (car files))) | ||
| 1803 | (widen) | ||
| 1804 | (goto-char (point-min)) | ||
| 1805 | (when (re-search-forward "^@node" nil t) | ||
| 1806 | (setq files-with-node-lines (cons (car files) files-with-node-lines))) | ||
| 1807 | (setq files (cdr files))) | ||
| 1808 | (setq files-with-node-lines (nreverse files-with-node-lines)) | ||
| 1809 | |||
| 1810 | ;; Find the name of the first node in a subsequent file | ||
| 1811 | ;; and copy it into the variable next-node-name | ||
| 1812 | (set-buffer (find-file-noselect (car (cdr files-with-node-lines)))) | ||
| 1802 | (widen) | 1813 | (widen) |
| 1803 | (goto-char (point-min)) | 1814 | (goto-char (point-min)) |
| 1804 | (if (not (re-search-forward "^@node" nil t)) | ||
| 1805 | (error "No `@node' line found in %s" (buffer-name))) | ||
| 1806 | (beginning-of-line) | 1815 | (beginning-of-line) |
| 1807 | (texinfo-check-for-node-name) | 1816 | (texinfo-check-for-node-name) |
| 1808 | (setq next-node-name (texinfo-copy-node-name)) | 1817 | (setq next-node-name (texinfo-copy-node-name)) |
| 1809 | |||
| 1810 | (push (cons next-node-name (prog1 "" (forward-line 1))) | 1818 | (push (cons next-node-name (prog1 "" (forward-line 1))) |
| 1811 | ;; Use following to insert section titles automatically. | 1819 | ;; Use following to insert section titles automatically. |
| 1812 | ;; (texinfo-copy-next-section-title) | 1820 | ;; (texinfo-copy-next-section-title) |
| 1813 | menu-list) | 1821 | menu-list) |
| 1814 | 1822 | ||
| 1815 | ;; Go to outer file | 1823 | ;; Go to outer file |
| 1816 | (set-buffer (find-file-noselect (pop files))) | 1824 | ;; `pop' is analogous to (prog1 (car PLACE) (setf PLACE (cdr PLACE))) |
| 1825 | (set-buffer (find-file-noselect (pop files-with-node-lines))) | ||
| 1817 | (goto-char (point-min)) | 1826 | (goto-char (point-min)) |
| 1818 | (if (not (re-search-forward "^@node [ \t]*top[ \t]*\\(,\\|$\\)" nil t)) | 1827 | (if (not (re-search-forward "^@node [ \t]*top[ \t]*\\(,\\|$\\)" nil t)) |
| 1819 | (error "This buffer needs a Top node")) | 1828 | (error "This buffer needs a Top node")) |
| @@ -1824,18 +1833,16 @@ Thus, normally, each included file contains one, and only one, chapter." | |||
| 1824 | (beginning-of-line) | 1833 | (beginning-of-line) |
| 1825 | (setq previous-node-name "Top") | 1834 | (setq previous-node-name "Top") |
| 1826 | 1835 | ||
| 1827 | (while files | 1836 | (while files-with-node-lines |
| 1828 | 1837 | ||
| 1829 | (if (not (cdr files)) | 1838 | (if (not (cdr files-with-node-lines)) |
| 1830 | ;; No next file | 1839 | ;; No next file |
| 1831 | (setq next-node-name "") | 1840 | (setq next-node-name "") |
| 1832 | ;; Else, | 1841 | ;; Else, |
| 1833 | ;; find the name of the first node in the next file. | 1842 | ;; find the name of the first node in the next file. |
| 1834 | (set-buffer (find-file-noselect (car (cdr files)))) | 1843 | (set-buffer (find-file-noselect (car (cdr files-with-node-lines)))) |
| 1835 | (widen) | 1844 | (widen) |
| 1836 | (goto-char (point-min)) | 1845 | (goto-char (point-min)) |
| 1837 | (if (not (re-search-forward "^@node" nil t)) | ||
| 1838 | (error "No `@node' line found in %s" (buffer-name))) | ||
| 1839 | (beginning-of-line) | 1846 | (beginning-of-line) |
| 1840 | (texinfo-check-for-node-name) | 1847 | (texinfo-check-for-node-name) |
| 1841 | (setq next-node-name (texinfo-copy-node-name)) | 1848 | (setq next-node-name (texinfo-copy-node-name)) |
| @@ -1845,10 +1852,8 @@ Thus, normally, each included file contains one, and only one, chapter." | |||
| 1845 | menu-list)) | 1852 | menu-list)) |
| 1846 | 1853 | ||
| 1847 | ;; Go to node to be updated. | 1854 | ;; Go to node to be updated. |
| 1848 | (set-buffer (find-file-noselect (car files))) | 1855 | (set-buffer (find-file-noselect (car files-with-node-lines))) |
| 1849 | (goto-char (point-min)) | 1856 | (goto-char (point-min)) |
| 1850 | (if (not (re-search-forward "^@node" nil t)) | ||
| 1851 | (error "No `@node' line found in %s" (buffer-name))) | ||
| 1852 | (beginning-of-line) | 1857 | (beginning-of-line) |
| 1853 | 1858 | ||
| 1854 | ;; Update other menus and nodes if requested. | 1859 | ;; Update other menus and nodes if requested. |
| @@ -1862,7 +1867,7 @@ Thus, normally, each included file contains one, and only one, chapter." | |||
| 1862 | (beginning-of-line) | 1867 | (beginning-of-line) |
| 1863 | (setq previous-node-name (texinfo-copy-node-name)) | 1868 | (setq previous-node-name (texinfo-copy-node-name)) |
| 1864 | 1869 | ||
| 1865 | (setq files (cdr files))) | 1870 | (setq files-with-node-lines (cdr files-with-node-lines))) |
| 1866 | (nreverse menu-list))) | 1871 | (nreverse menu-list))) |
| 1867 | 1872 | ||
| 1868 | (defun texinfo-multi-files-insert-main-menu (menu-list) | 1873 | (defun texinfo-multi-files-insert-main-menu (menu-list) |