annotate lisp/packages/informat.el @ 147:e186c2b7192d xemacs-20-2

Added tag r20-2p1 for changeset 2af401a6ecca
author cvs
date Mon, 13 Aug 2007 09:34:48 +0200
parents ac2d302a0011
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; informat.el --- info support functions package for Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; Copyright (C) 1986 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Maintainer: FSF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; Keywords: help
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; XEmacs is distributed in the hope that it will be useful, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;; along with XEmacs; see the file COPYING. If not, write to the Free
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
22 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
23 ;; 02111-1307, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
25 ;;; Synched up with: FSF 19.34.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 (require 'info)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 (defun Info-tagify ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 "Create or update Info-file tag table in current buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;; Save and restore point and restrictions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ;; save-restrictions would not work
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 ;; because it records the old max relative to the end.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ;; We record it relative to the beginning.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 (message "Tagifying %s ..." (file-name-nondirectory (buffer-file-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 (let ((omin (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (omax (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 (nomax (= (point-max) (1+ (buffer-size))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (opoint (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 (if (search-forward "\^_\nIndirect:\n" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (message "Cannot tagify split info file")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (let ((regexp "Node:[ \t]*\\([^,\n\t]*\\)[,\t\n]")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (case-fold-search t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 (while (search-forward "\n\^_" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 ;; We want the 0-origin character position of the ^_.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 ;; That is the same as the Emacs (1-origin) position
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 ;; of the newline before it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (let ((beg (match-beginning 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (forward-line 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 (if (re-search-backward regexp beg t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (setq list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (cons (list (buffer-substring-no-properties
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (match-end 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 beg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (forward-line -8)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (let ((buffer-read-only nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (if (search-forward "\^_\nEnd tag table\n" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (let ((end (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 (search-backward "\nTag table:\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (delete-region (point) end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (insert "\^_\f\nTag table:\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (move-marker Info-tag-table-marker (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (setq list (nreverse list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (while list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (insert "Node: " (car (car list)) ?\177)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (princ (car (cdr (car list))) (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (insert ?\n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (setq list (cdr list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (insert "\^_\nEnd tag table\n")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (goto-char opoint)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (narrow-to-region omin (if nomax (1+ (buffer-size))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 (min omax (point-max))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (message "Tagifying %s ... done" (file-name-nondirectory (buffer-file-name))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (defun Info-split ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 "Split an info file into an indirect file plus bounded-size subfiles.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 Each subfile will be up to 50,000 characters plus one node.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 To use this command, first visit a large Info file that has a tag
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 table. The buffer is modified into a (small) indirect info file which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 should be saved in place of the original visited file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 The subfiles are written in the same directory the original file is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 in, with names generated by appending `-' and a number to the original
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 file name. The indirect file still functions as an Info file, but it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 contains just the tag table and a directory of subfiles."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (if (< (buffer-size) 70000)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (error "This is too small to be worth splitting"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (search-forward "\^_")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (forward-char -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 (let ((start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (chars-deleted 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 subfiles
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 (subfile-number 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 (case-fold-search t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (filename (file-name-sans-versions buffer-file-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 (forward-line -8)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 (setq buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 (or (search-forward "\^_\nEnd tag table\n" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 (error "Tag table required; use M-x Info-tagify"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 (search-backward "\nTag table:\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (if (looking-at "\nTag table:\n\^_")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 (error "Tag table is just a skeleton; use M-x Info-tagify"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 (forward-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (narrow-to-region (point-min) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 (while (< (1+ (point)) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 (goto-char (min (+ (point) 50000) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (search-forward "\^_" nil 'move)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 (setq subfiles
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (cons (list (+ start chars-deleted)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (concat (file-name-nondirectory filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 (format "-%d" subfile-number)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 subfiles))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 ;; Put a newline at end of split file, to make Unix happier.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 (insert "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (write-region (point-min) (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 (concat filename (format "-%d" subfile-number)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 (delete-region (1- (point)) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 ;; Back up over the final ^_.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 (forward-char -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 (setq chars-deleted (+ chars-deleted (- (point) start)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 (delete-region start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (setq subfile-number (1+ subfile-number))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 (while subfiles
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 (goto-char start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 (insert (nth 1 (car subfiles))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 (format ": %d" (1- (car (car subfiles))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 (setq subfiles (cdr subfiles)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 (goto-char start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 (insert "\^_\nIndirect:\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 (search-forward "\nTag Table:\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 (insert "(Indirect)\n")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 (defun Info-validate ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 "Check current buffer for validity as an Info file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 Check that every node pointer points to an existing node."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 (if (search-forward "\nTag table:\n(Indirect)\n" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 (error "Don't yet know how to validate indirect info files: \"%s\""
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 (buffer-name (current-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (let ((allnodes '(("*")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (regexp "Node:[ \t]*\\([^,\n\t]*\\)[,\t\n]")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 (case-fold-search t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 (tags-losing nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 (lossages ()))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 (while (search-forward "\n\^_" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 (let ((beg (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 (if (re-search-backward regexp beg t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 (let ((name (downcase
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 (buffer-substring-no-properties
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 (goto-char (match-end 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 (skip-chars-backward " \t")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 (point))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 (if (assoc name allnodes)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 (setq lossages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 (cons (list name "Duplicate node-name" nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 lossages))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (setq allnodes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (cons (list name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (and (re-search-backward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 "prev[ious]*:" beg t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (goto-char (match-end 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (downcase
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (Info-following-node-name)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 beg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 allnodes)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 (while (search-forward "\n\^_" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 (let ((beg (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 thisnode next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (if (re-search-backward regexp beg t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 (search-forward "\n\^_" nil 'move)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 (narrow-to-region beg (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (setq thisnode (downcase
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (buffer-substring-no-properties
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 (goto-char (match-end 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (skip-chars-backward " \t")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 (and (search-backward "next:" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 (setq next (Info-validate-node-name "invalid Next"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 (assoc next allnodes)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (if (equal (car (cdr (assoc next allnodes)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 thisnode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 ;; allow multiple `next' pointers to one node
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 (let ((tem lossages))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 (while tem
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 (if (and (equal (car (cdr (car tem)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 "should have Previous")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 (equal (car (car tem))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 next))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 (setq lossages (delq (car tem) lossages)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (setq tem (cdr tem))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (setq lossages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 (cons (list next
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 "should have Previous"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 thisnode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 lossages))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 (if (re-search-backward "prev[ious]*:" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 (Info-validate-node-name "invalid Previous"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 (if (search-backward "up:" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (Info-validate-node-name "invalid Up"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 (if (re-search-forward "\n* Menu:" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 (while (re-search-forward "\n\\* " nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 (Info-validate-node-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 (concat "invalid menu item "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 (buffer-substring (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 (skip-chars-forward "^:")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 (Info-extract-menu-node-name))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (while (re-search-forward "\\*note[ \n]*[^:\t]*:" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 (goto-char (+ (match-beginning 0) 5))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 (skip-chars-forward " \n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (Info-validate-node-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 (concat "invalid reference "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 (buffer-substring (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 (skip-chars-forward "^:")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 (Info-extract-menu-node-name "Bad format cross-reference")))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 (setq tags-losing (not (Info-validate-tags-table)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 (if (or lossages tags-losing)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 (with-output-to-temp-buffer " *problems in info file*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 (while lossages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (princ "In node \"")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 (princ (car (car lossages)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 (princ "\", ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 (let ((tem (nth 1 (car lossages))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 (cond ((string-match "\n" tem)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 (princ (substring tem 0 (match-beginning 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 (princ "..."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 (princ tem))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (if (nth 2 (car lossages))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (princ ": ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 (let ((tem (nth 2 (car lossages))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (cond ((string-match "\n" tem)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 (princ (substring tem 0 (match-beginning 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 (princ "..."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (princ tem))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 (terpri)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (setq lossages (cdr lossages)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 (if tags-losing (princ "\nTags table must be recomputed\n")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 ;; Here if info file is valid.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 ;; If we already made a list of problems, clear it out.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 (if (get-buffer " *problems in info file*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 (set-buffer " *problems in info file*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 (kill-buffer (current-buffer)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 (message "File appears valid"))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 (defun Info-validate-node-name (kind &optional name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 (if name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (goto-char (match-end 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 (skip-chars-forward " \t")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 (if (= (following-char) ?\()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 (setq name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 (buffer-substring-no-properties
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 (skip-chars-forward "^,\t\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 (skip-chars-backward " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (point))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (if (null name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (setq name (downcase name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (or (and (> (length name) 0) (= (aref name 0) ?\())
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (assoc name allnodes)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 (setq lossages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 (cons (list thisnode kind name) lossages))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 (defun Info-validate-tags-table ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (if (not (search-forward "\^_\nEnd tag table\n" nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 (not (catch 'losing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 (let* ((end (match-beginning 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 (start (progn (search-backward "\nTag table:\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 (1- (match-end 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 tem)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 (setq tem allnodes)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 (while tem
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 (goto-char start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 (or (equal (car (car tem)) "*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (search-forward (concat "Node: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (car (car tem))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 "\177")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 end t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (throw 'losing 'x))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (setq tem (cdr tem)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (goto-char (1+ start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (while (looking-at ".*Node: \\(.*\\)\177\\([0-9]+\\)$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (setq tem (downcase (buffer-substring-no-properties
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 (match-end 1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 (setq tem (assoc tem allnodes))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 (if (or (not tem)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 (< 1000 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (goto-char (match-beginning 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 (setq tem (- (car (cdr (cdr tem)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 (read (current-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 (if (> tem 0) tem (- tem)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (throw 'losing 'y))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (forward-line 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (if (looking-at "\^_\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (forward-line 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 (or (looking-at "End tag table\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 (throw 'losing 'z))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 (defun batch-info-validate ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 "Runs `Info-validate' on the files remaining on the command line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 Must be used only with -batch, and kills Emacs on completion.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 Each file will be processed even if an error occurred previously.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 For example, invoke \"emacs -batch -f batch-info-validate $info/ ~/*.info\""
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 (if (not noninteractive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 (error "batch-info-validate may only be used -batch."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (let ((version-control t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (auto-save-default nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 (find-file-run-dired nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 (kept-old-versions 259259)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 (kept-new-versions 259259))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (let ((error 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 (files ()))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 (while command-line-args-left
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 (setq file (expand-file-name (car command-line-args-left)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (cond ((not (file-exists-p file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 (message ">> %s does not exist!" file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (setq error 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 command-line-args-left (cdr command-line-args-left)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 ((file-directory-p file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 (setq command-line-args-left (nconc (directory-files file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 (cdr command-line-args-left))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 (setq files (cons file files)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 command-line-args-left (cdr command-line-args-left)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 (while files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 (setq file (car files)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 files (cdr files))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 (let ((lose nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 (condition-case err
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 (if buffer-file-name (kill-buffer (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 (find-file file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 (buffer-disable-undo (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 (set-buffer-modified-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 (fundamental-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 (let ((case-fold-search nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 (cond ((search-backward "\n\^_\^L\nTag table:\n" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 (message "%s already tagified" file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 ((< (point-max) 30000)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 (message "%s too small to bother tagifying" file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 (Info-tagify))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 (let ((loss-name " *problems in info file*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 (message "Checking validity of info file %s..." file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 (if (get-buffer loss-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 (kill-buffer loss-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 (Info-validate)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 (if (not (get-buffer loss-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 nil ;(message "Checking validity of info file %s... OK" file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 (message "----------------------------------------------------------------------")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 (message ">> PROBLEMS IN INFO FILE %s" file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 (set-buffer loss-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 (princ (buffer-substring-no-properties
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 (point-min) (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 (message "----------------------------------------------------------------------")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 (setq error 1 lose t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 (if (and (buffer-modified-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 (not lose))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 (progn (message "Saving modified %s" file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 (save-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 (error (message ">> Error: %s" (prin1-to-string err))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 (kill-emacs error))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 ;;; informat.el ends here