]> code.delx.au - gnu-emacs/blobdiff - lisp/informat.el
Remove compatibility with Emacs 24.3 in octave-mode
[gnu-emacs] / lisp / informat.el
index 1b07792fa665dadfe1155689dc2bd8e46c510fef..8a539f5c675c5b3a7c82e0cec9506bae7ca6d96d 100644 (file)
@@ -1,16 +1,16 @@
 ;;; informat.el --- info support functions package for Emacs
 
-;; Copyright (C) 1986 Free Software Foundation, Inc.
+;; Copyright (C) 1986, 2001-2016 Free Software Foundation, Inc.
 
-;; Maintainer: FSF
+;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: help
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; 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)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -18,9 +18,7 @@
 ;; GNU General Public License for more details.
 
 ;; 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.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
 
 (require 'info)
 
+(declare-function texinfo-format-refill "texinfmt" ())
+
+;; From texinfmt.el
+(defvar texinfo-command-start)
+(defvar texinfo-command-end)
+
 ;;;###autoload
 (defun Info-tagify (&optional input-buffer-name)
   "Create or update Info file tag table in current buffer or in a region."
   ;; save-restrictions would not work
   ;; because it records the old max relative to the end.
   ;; We record it relative to the beginning.
-  (if input-buffer-name
-      (message "Tagifying region in %s ..." input-buffer-name)
-      (message
-       "Tagifying %s ..."  (file-name-nondirectory (buffer-file-name))))
   (let ((omin (point-min))
        (omax (point-max))
        (nomax (= (point-max) (1+ (buffer-size))))
-       (opoint (point)))
+       (opoint (point))
+       (msg (format "Tagifying %s..."
+                    (cond (input-buffer-name
+                           (format "region in %s" input-buffer-name))
+                          (buffer-file-name
+                           (file-name-nondirectory (buffer-file-name)))
+                          (t "buffer")))))
+    (message "%s" msg)
     (unwind-protect
     (progn
       (widen)
                (insert "\^_\nEnd tag table\n")))))
       (goto-char opoint)
       (narrow-to-region omin (if nomax (1+ (buffer-size))
-                              (min omax (point-max))))))
-  (if input-buffer-name
-      (message "Tagifying region in %s done" input-buffer-name)
-      (message
-       "Tagifying %s done"  (file-name-nondirectory (buffer-file-name)))))
+                              (min omax (point-max)))))
+    (message "%sdone" msg)))
 
 \f
+;;;###autoload
+(defcustom Info-split-threshold 262144
+  "The number of characters by which `Info-split' splits an info file."
+  :type 'integer
+  :version "23.1"
+  :group 'texinfo)
+
 ;;;###autoload
 (defun Info-split ()
   "Split an info file into an indirect file plus bounded-size subfiles.
-Each subfile will be up to 50,000 characters plus one node.
+Each subfile will be up to the number of characters that
+`Info-split-threshold' specifies, plus one node.
 
 To use this command, first visit a large Info file that has a tag
 table.  The buffer is modified into a (small) indirect info file which
@@ -166,7 +178,7 @@ file name.  The indirect file still functions as an Info file, but it
 contains just the tag table and a directory of subfiles."
 
   (interactive)
-  (if (< (buffer-size) 70000)
+  (if (< (buffer-size) (+ 20000 Info-split-threshold))
       (error "This is too small to be worth splitting"))
   (goto-char (point-min))
   (search-forward "\^_")
@@ -191,7 +203,7 @@ contains just the tag table and a directory of subfiles."
       (narrow-to-region (point-min) (point))
       (goto-char (point-min))
       (while (< (1+ (point)) (point-max))
-       (goto-char (min (+ (point) 50000) (point-max)))
+       (goto-char (min (+ (point) Info-split-threshold) (point-max)))
        (search-forward "\^_" nil 'move)
        (setq subfiles
              (cons (list (+ start chars-deleted)
@@ -488,8 +500,7 @@ For example, invoke \"emacs -batch -f batch-info-validate $info/ ~/*.info\""
                      nil ;(message "Checking validity of info file %s... OK" file)
                    (message "----------------------------------------------------------------------")
                    (message ">> PROBLEMS IN INFO FILE %s" file)
-                   (save-excursion
-                     (set-buffer loss-name)
+                   (with-current-buffer loss-name
                      (princ (buffer-substring-no-properties
                              (point-min) (point-max))))
                    (message "----------------------------------------------------------------------")