From: yamaoka Date: Mon, 16 Aug 1999 11:44:29 +0000 (+0000) Subject: (dgnushack-texi-format): Fold up long lines. X-Git-Tag: t-gnus-6_13_0-02~3 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=7df8a6a6e7a5f5f4fad7e30c7b595a7514112274;p=elisp%2Fgnus.git- (dgnushack-texi-format): Fold up long lines. (TopLevel): Autoload "texinfmt" for avoiding byte compile warning. --- diff --git a/lisp/dgnushack.el b/lisp/dgnushack.el index bec11bb..e4d9d85 100644 --- a/lisp/dgnushack.el +++ b/lisp/dgnushack.el @@ -123,6 +123,7 @@ (defalias 'Custom-make-dependencies 'ignore) (defalias 'toolbar-gnus 'ignore) (defalias 'update-autoloads-from-directory 'ignore)) +(autoload 'texinfo-parse-line-arg "texinfmt") (unless (fboundp 'with-temp-buffer) ;; Pickup some macros. @@ -176,7 +177,7 @@ Modify to suit your needs.")) (when (or (not (file-exists-p (setq elc (concat file "c")))) (file-newer-than-file-p file elc)) (ignore-errors - (byte-compile-file file))))))) + (byte-compile-file file))))))) (defun dgnushack-recompile () (require 'gnus) @@ -329,40 +330,41 @@ You must specify the name of the package path as follows: (error "batch-texinfo-format may only be used -batch.")) (require 'texinfmt) (let ((auto-save-default nil) - (find-file-run-dired nil) + (find-file-run-dired nil) coding-system-for-write) (let ((error 0) - file - (files ())) + file + (files ())) (while command-line-args-left - (setq file (expand-file-name (car command-line-args-left))) - (cond ((not (file-exists-p file)) - (message ">> %s does not exist!" file) - (setq error 1 - command-line-args-left (cdr command-line-args-left))) - ((file-directory-p file) - (setq command-line-args-left - (nconc (directory-files file) - (cdr command-line-args-left)))) - (t - (setq files (cons file files) - command-line-args-left (cdr command-line-args-left))))) + (setq file (expand-file-name (car command-line-args-left))) + (cond ((not (file-exists-p file)) + (message ">> %s does not exist!" file) + (setq error 1 + command-line-args-left (cdr command-line-args-left))) + ((file-directory-p file) + (setq command-line-args-left + (nconc (directory-files file) + (cdr command-line-args-left)))) + (t + (setq files (cons file files) + command-line-args-left (cdr command-line-args-left))))) (while files - (setq file (car files) - files (cdr files)) - (condition-case err - (progn - (if buffer-file-name (kill-buffer (current-buffer))) - (find-file file) + (setq file (car files) + files (cdr files)) + (condition-case err + (progn + (if buffer-file-name (kill-buffer (current-buffer))) + (find-file file) (setq coding-system-for-write buffer-file-coding-system) (when (and addsuffix (re-search-forward "^@setfilename[\t ]+\\([^\t\n ]+\\)" nil t) (not (string-match "\\.info$" (match-string 1)))) (insert ".info")) - (buffer-disable-undo (current-buffer)) + (buffer-disable-undo (current-buffer)) ;; process @include before updating node - ;; This might produce some problem if we use @lowersection or such. + ;; This might produce some problem if we use @lowersection or + ;; such. (let ((input-directory default-directory) (texinfo-command-end)) (while (re-search-forward "^@include" nil t) @@ -370,25 +372,32 @@ You must specify the name of the package path as follows: (let ((filename (concat input-directory (texinfo-parse-line-arg)))) (re-search-backward "^@include") - (delete-region (point) (save-excursion (forward-line 1) (point))) + (delete-region (point) (save-excursion + (forward-line 1) + (point))) (message "Reading included file: %s" filename) (save-excursion (save-restriction (narrow-to-region (point) - (+ (point) (car (cdr (insert-file-contents filename))))) + (+ (point) + (car (cdr (insert-file-contents filename))))) (goto-char (point-min)) - ;; Remove `@setfilename' line from included file, if any, - ;; so @setfilename command not duplicated. - (if (re-search-forward - "^@setfilename" (save-excursion (forward-line 100) (point)) t) + ;; Remove `@setfilename' line from included file, + ;; if any, so @setfilename command not duplicated. + (if (re-search-forward "^@setfilename" + (save-excursion + (forward-line 100) + (point)) + t) (progn (beginning-of-line) - (delete-region - (point) (save-excursion (forward-line 1) (point)))))))))) - (texinfo-mode) + (delete-region (point) (save-excursion + (forward-line 1) + (point)))))))))) + (texinfo-mode) (texinfo-every-node-update) - (set-buffer-modified-p nil) + (set-buffer-modified-p nil) (message "texinfo formatting %s..." file) (texinfo-format-buffer nil) (if (buffer-modified-p) @@ -396,18 +405,18 @@ You must specify the name of the package path as follows: (save-buffer)))) (error (message ">> Error: %s" (prin1-to-string err)) - (message ">> point at") - (let ((s (buffer-substring (point) - (min (+ (point) 100) - (point-max)))) - (tem 0)) - (while (setq tem (string-match "\n+" s tem)) - (setq s (concat (substring s 0 (match-beginning 0)) - "\n>> " - (substring s (match-end 0))) - tem (1+ tem))) - (message ">> %s" s)) - (setq error 1)))) + (message ">> point at") + (let ((s (buffer-substring (point) + (min (+ (point) 100) + (point-max)))) + (tem 0)) + (while (setq tem (string-match "\n+" s tem)) + (setq s (concat (substring s 0 (match-beginning 0)) + "\n>> " + (substring s (match-end 0))) + tem (1+ tem))) + (message ">> %s" s)) + (setq error 1)))) (kill-emacs error)))) ;;; dgnushack.el ends here