tm 7.90.
[elisp/sinfo.git] / texi-util.el
1 ;;; texi-util.el --- Texinfo utility
2
3 ;; Copyright (C) 1996 MORIOKA Tomohiko
4
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Version: $Id: texi-util.el,v 1.2 1996/10/10 14:20:38 morioka Exp $
7 ;; Keywords: Texinfo
8
9 ;; This file is part of tl (Tiny Library).
10
11 ;; This program is free software; you can redistribute it and/or
12 ;; modify it under the terms of the GNU General Public License as
13 ;; published by the Free Software Foundation; either version 2, or (at
14 ;; your option) any later version.
15
16 ;; This program is distributed in the hope that it will be useful, but
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19 ;; General Public License for more details.
20
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with this program; see the file COPYING.  If not, write to
23 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
25
26 ;;; Code:
27
28 (defun texinfo-all-menu-titles-update ()
29   (interactive)
30   (goto-char (point-min))
31   (while (search-forward "\n@menu\n" nil t)
32     (goto-char (match-end 0))
33     (while (looking-at "* \\([^:]+\\)::")
34       (let ((title (buffer-substring (match-beginning 1)(match-end 1)))
35             subj)
36         (save-excursion
37           (let ((ret
38                  (re-search-forward
39                   (format
40                    "@node %s.*\n@\\(chapter\\|\\(sub\\)*section\\) \\(.+\\)"
41                    (regexp-quote title)))))
42             (if ret
43                 (let ((data (last (match-data) 2)))
44                   (setq subj (buffer-substring (car data)
45                                                (car (cdr data))))
46                   ))
47             ))
48         (if subj
49             (or (string= subj title)
50                 (progn
51                   (end-of-line)
52                   (insert subj)
53                   )))
54         (end-of-line)
55         (forward-char)
56         ))))
57
58                
59 ;;; @ end
60 ;;;
61
62 (provide 'texi-util)
63
64 ;;; texi-util.el ends here