Synch with No Gnus (201109102129).
[elisp/gnus-doc-ja.git] / infohack.el
index edb2ec8..69f4d66 100644 (file)
@@ -1,5 +1,5 @@
 ;;; infohack.el --- a hack to format info file.
-;; Copyright (C)  2001, 2003, 2004, 2008  Free Software Foundation, Inc.
+;; Copyright (C)  2001, 2003, 2004, 2008, 2009  Free Software Foundation, Inc.
 
 ;; Author: Shenghuo Zhu <zsh@cs.rochester.edu>
 ;; Keywords: info
@@ -79,7 +79,9 @@
          (expand-file-name (file-name-nondirectory buffer-file-name)
                            default-directory))
     (setq buffer-file-coding-system coding-system)
-    (if (> (buffer-size) 100000)
+    (if (> (buffer-size) (if (boundp 'Info-split-threshold)
+                            (+ 50000 Info-split-threshold)
+                          100000))
        (Info-split))
     (save-buffer)))
 
@@ -114,26 +116,28 @@ Both characters must have the same length of multi-byte form."
 (require 'bytecomp)
 
 ;; Reduce the number of split Info files.
-(if (featurep 'xemacs)
-    (if (load "informat.el" t t)
-       (let* ((fn (symbol-function 'Info-split))
-              (fns (prin1-to-string fn)))
-         (load "informat.elc" t t)
-         (when (and (string-match "\\([\t\n ]+\\)50000\\([\t\n )]+\\)" fns)
-                    (condition-case nil
-                        (setq fn (byte-compile
-                                  (read (replace-match "\\1200000\\2" nil nil
-                                                       fns))))
-                      (error nil))
-                    (fset 'Info-split fn)))))
-  (require 'informat)
-  (let* ((fn (symbol-function 'Info-split))
-        (fns (prin1-to-string fn)))
-    (when (string-match "\\([\t\n ]+\\)50000\\([\t\n ]+\\)" fns)
-      (condition-case nil
-         (fset 'Info-split (read (replace-match "\\1200000\\2" nil nil fns)))
-       (error
-        (fset 'Info-split fn))))))
+(unless (boundp 'Info-split-threshold)
+  (if (featurep 'xemacs)
+      (if (load "informat.el" t t)
+         (let* ((fn (symbol-function 'Info-split))
+                (fns (prin1-to-string fn)))
+           (load "informat.elc" t t)
+           (when (and (string-match "\\([\t\n ]+\\)50000\\([\t\n )]+\\)" fns)
+                      (condition-case nil
+                          (setq fn (byte-compile
+                                    (read (replace-match "\\1262144\\2"
+                                                         nil nil fns))))
+                        (error nil))
+                      (fset 'Info-split fn)))))
+    (require 'informat)
+    (let* ((fn (symbol-function 'Info-split))
+          (fns (prin1-to-string fn)))
+      (when (string-match "\\([\t\n ]+\\)50000\\([\t\n ]+\\)" fns)
+       (condition-case nil
+           (fset 'Info-split (read (replace-match "\\1262144\\2"
+                                                  nil nil fns)))
+         (error
+          (fset 'Info-split fn)))))))
 
 (defun infohack-texi-format (file &optional addsuffix)
   (let ((auto-save-default nil)
@@ -170,7 +174,12 @@ Both characters must have the same length of multi-byte form."
          (texinfo-every-node-update)
          (set-buffer-modified-p nil)
          (message "texinfo formatting %s..." file)
-         (let ((si:message (symbol-function 'message)))
+         (let ((si:message (symbol-function 'message))
+               (coding (or (and (string-match "\\`Japanese"
+                                              current-language-environment)
+                                (boundp 'locale-coding-system)
+                                locale-coding-system)
+                           'iso-2022-7bit)))
            ;; Encode messages to terminal.
            (fset
             'message
@@ -181,11 +190,11 @@ Both characters must have the same length of multi-byte form."
                                  (equal (car args) buffer-file-name))
                       (funcall ,si:message "%s"
                                (encode-coding-string (apply 'format fmt args)
-                                                     'iso-2022-7bit))))
+                                                     ',coding))))
                `(lambda (fmt &rest args)
                   (funcall ,si:message "%s"
                            (encode-coding-string (apply 'format fmt args)
-                                                 'iso-2022-7bit))))))
+                                                 ',coding))))))
            (unwind-protect
                (texinfo-format-buffer nil)
              (fset 'message si:message)))