Function: Info-split
Info-split is an autoloaded, interactive and byte-compiled function
defined in informat.el.gz.
Signature
(Info-split)
Documentation
Split an info file into an indirect file plus bounded-size subfiles.
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 should be saved in place of the original visited file.
The subfiles are written in the same directory the original file is
in, with names generated by appending - and a number to the original
file name. The indirect file still functions as an Info file, but it
contains just the tag table and a directory of subfiles.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/informat.el.gz
;;;###autoload
(defun Info-split ()
"Split an info file into an indirect file plus bounded-size subfiles.
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
should be saved in place of the original visited file.
The subfiles are written in the same directory the original file is
in, with names generated by appending `-' and a number to the original
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) (+ 20000 Info-split-threshold))
(error "This is too small to be worth splitting"))
(goto-char (point-min))
(search-forward "\^_")
(forward-char -1)
(let ((start (point))
(chars-deleted 0)
subfiles
(subfile-number 1)
(case-fold-search t)
(filename (file-name-sans-versions buffer-file-name)))
(goto-char (point-max))
(forward-line -8)
(setq buffer-read-only nil)
(or (search-forward "\^_\nEnd tag table\n" nil t)
(error "Tag table required; use M-x Info-tagify"))
(search-backward "\nTag table:\n")
(if (looking-at "\nTag table:\n\^_")
(error "Tag table is just a skeleton; use M-x Info-tagify"))
(beginning-of-line)
(forward-char 1)
(save-restriction
(narrow-to-region (point-min) (point))
(goto-char (point-min))
(while (< (1+ (point)) (point-max))
(goto-char (min (+ (point) Info-split-threshold) (point-max)))
(search-forward "\^_" nil 'move)
(setq subfiles
(cons (list (+ start chars-deleted)
(concat (file-name-nondirectory filename)
(format "-%d" subfile-number)))
subfiles))
;; Put a newline at end of split file, to make Unix happier.
(insert "\n")
(write-region (point-min) (point)
(concat filename (format "-%d" subfile-number)))
(delete-region (1- (point)) (point))
;; Back up over the final ^_.
(forward-char -1)
(setq chars-deleted (+ chars-deleted (- (point) start)))
(delete-region start (point))
(setq subfile-number (1+ subfile-number))))
(while subfiles
(goto-char start)
(insert (nth 1 (car subfiles))
(format ": %d" (1- (car (car subfiles))))
"\n")
(setq subfiles (cdr subfiles)))
(goto-char start)
(insert "\^_\nIndirect:\n")
(search-forward "\nTag Table:\n")
(insert "(Indirect)\n")))