]> code.delx.au - gnu-emacs/blobdiff - lisp/informat.el
Merge from emacs--rel--22
[gnu-emacs] / lisp / informat.el
index f96852685f7a1dfeec4db792db06cf2afcfe90d8..81b05d7b61a0bd06f93c882f60c838cf4f3ff342 100644 (file)
@@ -1,6 +1,7 @@
 ;;; informat.el --- info support functions package for Emacs
 
-;; Copyright (C) 1986 Free Software Foundation, Inc.
+;; Copyright (C) 1986, 2001, 2002, 2003, 2004, 2005,
+;;   2006, 2007, 2008 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: help
@@ -9,7 +10,7 @@
 
 ;; 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 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
@@ -19,8 +20,8 @@
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
@@ -31,6 +32,8 @@
 
 (require 'info)
 
+(declare-function texinfo-format-refill "texinfmt" ())
+
 ;;;###autoload
 (defun Info-tagify (&optional input-buffer-name)
   "Create or update Info file tag table in current buffer or in a region."
@@ -49,6 +52,7 @@
        (opoint (point)))
     (unwind-protect
     (progn
+      (widen)
       (goto-char (point-min))
       (if (search-forward "\^_\nIndirect:\n" nil t)
           (message
@@ -56,7 +60,7 @@
         (let (tag-list
               refillp
               (case-fold-search t)
-              (regexp 
+              (regexp
                (concat
                 "\\("
 
                 "\\|"
 
                 "\\("
-                "\n\^_"
+                "\n\^_\\(\^L\\)?"
                 "\\)"
 
                 "\\("
-                "\nFile:[ \t]*\\([^,\n\t]*\\)[,\t\n]+[ \t\n]*"
+                "\n\\(File:[ \t]*\\([^,\n\t]*\\)[,\t\n]+[ \t\n]*\\)?"
                 "Node:[ \t]*"
                 "\\("
-                "[^,\n\t]*"      ; match-string 11 matches arg to node name
+                "[^,\n\t]*"      ; match-string 13 matches arg to node name
                 "\\)"
                 "[,\t\n]"
                 "\\)"
                   (delete-region  (match-beginning 0) (match-end 0))))
               ;; else this is a Node
               (setq tag-list
-                    (cons (list 
-                           (concat "Node: " (match-string 11))
-                           (match-beginning 0))
+                    (cons (list
+                           (concat "Node: " (match-string-no-properties 13))
+                           (1+ (match-beginning 10)))
                           tag-list))))
 
              (goto-char (point-max))
                      (beginning-of-line)
                      (delete-region (point) end)))
                (goto-char (point-max))
-               (insert "\n\^_\f\nTag table:\n")
+               (or (bolp)
+                   (newline))
+               (insert "\^_\f\nTag table:\n")
                (if (eq major-mode 'info-mode)
                    (move-marker Info-tag-table-marker (point)))
                (setq tag-list (nreverse tag-list))
       (narrow-to-region omin (if nomax (1+ (buffer-size))
                               (min omax (point-max))))))
   (if input-buffer-name
-      (message "Tagifying region in %s ..." input-buffer-name)
+      (message "Tagifying region in %s done" input-buffer-name)
       (message
-       "Tagifying %s ..."  (file-name-nondirectory (buffer-file-name)))))
+       "Tagifying %s done"  (file-name-nondirectory (buffer-file-name)))))
 
 \f
 ;;;###autoload
@@ -274,8 +280,10 @@ Check that every node pointer points to an existing node."
            (forward-line 1)
            (if (re-search-backward regexp beg t)
                (save-restriction
-                 (search-forward "\n\^_" nil 'move)
-                 (narrow-to-region beg (point))
+                 (let ((md (match-data)))
+                   (search-forward "\n\^_" nil 'move)
+                   (narrow-to-region beg (point))
+                   (set-match-data md))
                  (setq Info-validate-thisnode (downcase
                                                (buffer-substring-no-properties
                                                 (match-beginning 1)
@@ -434,7 +442,7 @@ Must be used only with -batch, and kills Emacs on completion.
 Each file will be processed even if an error occurred previously.
 For example, invoke \"emacs -batch -f batch-info-validate $info/ ~/*.info\""
   (if (not noninteractive)
-      (error "batch-info-validate may only be used -batch."))
+      (error "batch-info-validate may only be used -batch"))
   (let ((version-control t)
        (auto-save-default nil)
        (find-file-run-dired nil)
@@ -448,7 +456,7 @@ For example, invoke \"emacs -batch -f batch-info-validate $info/ ~/*.info\""
        (cond ((not (file-exists-p file))
               (message ">> %s does not exist!" file)
               (setq error 1
-                    command-line-args-left (cdr command-line-args-left))) 
+                    command-line-args-left (cdr command-line-args-left)))
              ((file-directory-p file)
               (setq command-line-args-left (nconc (directory-files file)
                                              (cdr command-line-args-left))))
@@ -498,4 +506,5 @@ For example, invoke \"emacs -batch -f batch-info-validate $info/ ~/*.info\""
 
 (provide 'informat)
 
+;;; arch-tag: 581c440e-5be1-4f31-b005-2d5824bbf569
 ;;; informat.el ends here