]> code.delx.au - gnu-emacs/blobdiff - lisp/informat.el
Also load for .sgm and .dtd files.
[gnu-emacs] / lisp / informat.el
index 1f91cb5b8be54dbdffbc4e97f717c0eb0c2e274c..7d7d73725bf71224b7e5f177a5e2ed1710d3b6ae 100644 (file)
@@ -1,11 +1,15 @@
-;; Info support functions package for Emacs
+;;; informat.el --- info support functions package for Emacs
+
 ;; Copyright (C) 1986 Free Software Foundation, Inc.
 
+;; Maintainer: FSF
+;; Keywords: help
+
 ;; This file is part of GNU Emacs.
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 1, or (at your option)
+;; the Free Software Foundation; either version 2, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
@@ -17,6 +21,8 @@
 ;; along with GNU Emacs; see the file COPYING.  If not, write to
 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 
+;;; Code:
+
 (require 'info)
 
 ;;;###autoload
          (goto-char (point-min))
          (if (search-forward "\^_\nIndirect:\n" nil t)
              (message "Cannot tagify split info file")
-           (let ((regexp "Node:[ \t]*\\([^,\n\t]\\)*[,\t\n]")
+           (let ((regexp "Node:[ \t]*\\([^,\n\t]*\\)[,\t\n]")
                  (case-fold-search t)
                  list)
              (while (search-forward "\n\^_" nil t)
-               (forward-line 1)
-               (let ((beg (point)))
-                 (forward-line 1)
+               ;; We want the 0-origin character position of the ^_.
+               ;; That is the same as the Emacs (1-origin) position
+               ;; of the newline before it.
+               (let ((beg (match-beginning 0)))
+                 (forward-line 2)
                  (if (re-search-backward regexp beg t)
                      (setq list
-                           (cons (list (buffer-substring
+                           (cons (list (buffer-substring-no-properties
                                          (match-beginning 1)
                                          (match-end 1))
                                        beg)
@@ -135,7 +143,7 @@ contains just the tag table and a directory of subfiles."
     (while subfiles
       (goto-char start)
       (insert (nth 1 (car subfiles))
-             (format ": %d" (car (car subfiles)))
+             (format ": %d" (1- (car (car subfiles))))
              "\n")
       (setq subfiles (cdr subfiles)))
     (goto-char start)
@@ -167,7 +175,7 @@ Check that every node pointer points to an existing node."
            (forward-line 1)
            (if (re-search-backward regexp beg t)
                (let ((name (downcase
-                             (buffer-substring
+                             (buffer-substring-no-properties
                                (match-beginning 1)
                                (progn
                                  (goto-char (match-end 1))
@@ -200,7 +208,7 @@ Check that every node pointer points to an existing node."
                  (search-forward "\n\^_" nil 'move)
                  (narrow-to-region beg (point))
                  (setq thisnode (downcase
-                                  (buffer-substring
+                                  (buffer-substring-no-properties
                                     (match-beginning 1)
                                     (progn
                                       (goto-char (match-end 1))
@@ -294,7 +302,7 @@ Check that every node pointer points to an existing node."
     (if (= (following-char) ?\()
        nil
       (setq name
-           (buffer-substring
+           (buffer-substring-no-properties
             (point)
             (progn
              (skip-chars-forward "^,\t\n")
@@ -330,7 +338,7 @@ Check that every node pointer points to an existing node."
               (setq tem (cdr tem)))
             (goto-char (1+ start))
             (while (looking-at ".*Node: \\(.*\\)\177\\([0-9]+\\)$")
-              (setq tem (downcase (buffer-substring
+              (setq tem (downcase (buffer-substring-no-properties
                                     (match-beginning 1)
                                     (match-end 1))))
               (setq tem (assoc tem allnodes))
@@ -340,8 +348,10 @@ Check that every node pointer points to an existing node."
                                 (setq tem (- (car (cdr (cdr tem)))
                                              (read (current-buffer))))
                                 (if (> tem 0) tem (- tem)))))
-                  (throw 'losing 'y)))
-            (forward-line 1))
+                  (throw 'losing 'y))
+              (forward-line 1)))
+          (if (looking-at "\^_\n")
+              (forward-line 1))
           (or (looking-at "End tag table\n")
               (throw 'losing 'z))
           nil))))
@@ -392,7 +402,7 @@ For example, invoke \"emacs -batch -f batch-info-validate $info/ ~/*.info\""
                        ((< (point-max) 30000)
                         (message "%s too small to bother tagifying" file))
                        (t
-                        (Info-tagify file))))
+                        (Info-tagify))))
                (let ((loss-name " *problems in info file*"))
                  (message "Checking validity of info file %s..." file)
                  (if (get-buffer loss-name)
@@ -404,7 +414,8 @@ For example, invoke \"emacs -batch -f batch-info-validate $info/ ~/*.info\""
                    (message ">> PROBLEMS IN INFO FILE %s" file)
                    (save-excursion
                      (set-buffer loss-name)
-                     (princ (buffer-substring (point-min) (point-max))))
+                     (princ (buffer-substring-no-properties
+                             (point-min) (point-max))))
                    (message "----------------------------------------------------------------------")
                    (setq error 1 lose t)))
                (if (and (buffer-modified-p)
@@ -413,3 +424,5 @@ For example, invoke \"emacs -batch -f batch-info-validate $info/ ~/*.info\""
                           (save-buffer))))
            (error (message ">> Error: %s" (prin1-to-string err))))))
       (kill-emacs error))))
+
+;;; informat.el ends here