X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=texi%2Finfohack.el;h=6e5705a3fad838dd80ad1a53a6e81c5f0df669bf;hb=5ed7ff00b3f3bce83210faf41accaff0c4b15f30;hp=d3e59a1c230af12ce750cc17554ee1db83bf644f;hpb=de689c11a44faf9b9d7fd0b95887ae7c248f1a8e;p=gnus diff --git a/texi/infohack.el b/texi/infohack.el index d3e59a1c2..6e5705a3f 100644 --- a/texi/infohack.el +++ b/texi/infohack.el @@ -30,11 +30,19 @@ (defun infohack-remove-unsupported () (goto-char (point-min)) (while (re-search-forward "@\\(end \\)?ifnottex" nil t) - (replace-match ""))) + (replace-match "")) + (goto-char (point-min)) + (while (search-forward "\n@iflatex\n" nil t) + (delete-region (1+ (match-beginning 0)) + (search-forward "\n@end iflatex\n")))) (defun infohack (file) - (let ((dest-directory default-directory)) + (let ((dest-directory default-directory) + (max-lisp-eval-depth (max max-lisp-eval-depth 600)) + coding-system) (find-file file) + (setq buffer-read-only nil) + (setq coding-system buffer-file-coding-system) (infohack-remove-unsupported) (texinfo-every-node-update) (texinfo-format-buffer t) ;; Don't save any file. @@ -42,10 +50,32 @@ (setq buffer-file-name (expand-file-name (file-name-nondirectory buffer-file-name) default-directory)) + (setq buffer-file-coding-system coding-system) (if (> (buffer-size) 100000) (Info-split)) (save-buffer))) +(eval-and-compile + (when (string-match "windows-nt\\|os/2\\|emx\\|cygwin" + (symbol-name system-type)) + (defun subst-char-in-region (START END FROMCHAR TOCHAR &optional NOUNDO) + "From START to END, replace FROMCHAR with TOCHAR each time it occurs. +If optional arg NOUNDO is non-nil, don't record this change for undo +and don't mark the buffer as really changed. +Both characters must have the same length of multi-byte form." + (let ((original-buffer-undo-list buffer-undo-list) + (modified (buffer-modified-p))) + (if NOUNDO + (setq buffer-undo-list t)) + (goto-char START) + (let ((from (char-to-string FROMCHAR)) + (to (char-to-string TOCHAR))) + (while (search-forward from END t) + (replace-match to t t))) + (if NOUNDO + (progn (setq buffer-undo-list original-buffer-undo-list) + (set-buffer-modidifed-p modified))))))) + (defun batch-makeinfo () "Emacs makeinfo in batch mode." (infohack (car command-line-args-left))