2008-09-24 Katsumi Yamaoka <yamaoka@jpl.org>
+ * infohack.el (infohack): Insert @include files before performing
+ texinfo-every-node-update.
+
* gnus.texi (The Gnus Registry): Don't give argument to @item used in
@enumerate section so as to be able to be formatted with MAKEINFO=no.
(find-file file)
(setq buffer-read-only nil)
(setq coding-system buffer-file-coding-system)
+
+ ;; Insert @include files before performing `texinfo-every-node-update'.
+ (set-syntax-table texinfo-format-syntax-table)
+ (let (start texinfo-command-end filename)
+ (while (re-search-forward "^@include" nil t)
+ (setq start (match-beginning 0)
+ texinfo-command-end (point)
+ filename (texinfo-parse-line-arg))
+ (delete-region start (point-at-bol 2))
+ (message "Reading included file: %s" filename)
+ (save-excursion
+ (save-restriction
+ (narrow-to-region
+ (point)
+ (+ (point) (car (cdr (insert-file-contents filename)))))
+ (goto-char (point-min))
+ ;; Remove `@setfilename' line from included file, if any,
+ ;; so @setfilename command not duplicated.
+ (if (re-search-forward "^@setfilename" (point-at-eol 100) t)
+ (delete-region (point-at-bol 1)
+ (point-at-bol 2)))))))
+
(infohack-remove-unsupported)
(texinfo-every-node-update)
(texinfo-format-buffer t) ;; Don't save any file.