emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: informat.el: `Info-split' split size


From: Katsumi Yamaoka
Subject: Re: informat.el: `Info-split' split size
Date: Thu, 25 Sep 2008 08:58:06 +0900
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.60 (gnu/linux)

>>>>> Reiner Steib wrote:
> On Wed, Sep 24 2008, Katsumi Yamaoka wrote:

>> BTW, with MAKEINFO=no the Gnus Info files are divided into 24
>> files (gnus, gnus-1, ..., gnus-23).  Those are too small, aren't
>> they?  The threshold is hard-coded in `Info-split' (informat.el).

> ,----[ <f1> f Info-split RET ]
>| Info-split is an interactive autoloaded Lisp function in `informat'.
>| (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. [...]
> `----

> I think the threshold should not be hard-coded and it's default should
> be like makeinfo's so that we don't need such workarounds:

>> A workaround I added to the Japanese edition of the Gnus Info is:
[...]
>>   (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)))))

Thank you for following it up.  How about the attached patch?
While the threshold of makeinfo is 30000, I tried it with some
texinfo files and reduced it a bit for `Info-split'.  Now the
command ``./configure; make MAKEINFO=no info'' performed in the
Gnus trunk splits the Gnus Info into six files.

(Note that loaddefs.el, i.e. ldefs-boot.el, should be updated if
this patch is applied because of autoloading `Info-split-threshold'.)

--- informat.el~        2008-05-06 07:57:40 +0000
+++ informat.el 2008-09-24 23:54:45 +0000
@@ -153,9 +153,16 @@
 
 
 ;;;###autoload
+(defcustom Info-split-threshold 262144
+  "The number of characters by which `Info-split' splits an info file."
+  :type 'integer
+  :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
@@ -167,7 +174,7 @@
 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 "\^_")
@@ -192,7 +199,7 @@
       (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)
--- textmodes/texinfmt.el~      2008-07-31 21:47:43 +0000
+++ textmodes/texinfmt.el       2008-09-24 23:54:45 +0000
@@ -166,7 +166,7 @@
     (Info-tagify)
     (if nosplit
         nil
-      (if (> (buffer-size) 100000)
+      (if (> (buffer-size) (+ 50000 Info-split-threshold))
           (progn
             (message (setq lastmessage "Splitting Info file..."))
             (Info-split))))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]