Function: gnus-with-output-to-file
gnus-with-output-to-file is a macro defined in gnus-util.el.gz.
Signature
(gnus-with-output-to-file FILE &rest BODY)
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/gnus-util.el.gz
;; Fixme: Why not use `with-output-to-temp-buffer'?
(defmacro gnus-with-output-to-file (file &rest body)
(declare (indent 1) (debug t))
(let ((buffer (make-symbol "output-buffer"))
(size (make-symbol "output-buffer-size"))
(leng (make-symbol "output-buffer-length"))
(append (make-symbol "output-buffer-append")))
`(let* ((,size 131072)
(,buffer (make-string ,size 0))
(,leng 0)
(,append nil)
(standard-output
(lambda (c)
(aset ,buffer ,leng c)
(if (= ,size (setq ,leng (1+ ,leng)))
(progn (write-region ,buffer nil ,file ,append 'no-msg)
(setq ,leng 0
,append t))))))
,@body
(when (> ,leng 0)
(let ((coding-system-for-write 'no-conversion))
(write-region (substring ,buffer 0 ,leng) nil ,file
,append 'no-msg))))))