Function: mm-with-part

mm-with-part is a macro defined in mm-decode.el.gz.

Signature

(mm-with-part HANDLE &rest FORMS)

Documentation

Run FORMS in the temp buffer containing the contents of HANDLE.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/mm-decode.el.gz
;;;
;;; Functions for outputting parts
;;;

(defmacro mm-with-part (handle &rest forms)
  "Run FORMS in the temp buffer containing the contents of HANDLE."
  (declare (indent 1) (debug t))
  ;; The handle-buffer's content is a sequence of bytes, not a sequence of
  ;; chars, so the buffer should be unibyte.  It may happen that the
  ;; handle-buffer is multibyte for some reason, in which case now is a good
  ;; time to adjust it, since we know at this point that it should
  ;; be unibyte.
  `(let* ((handle ,handle))
     (when (and (mm-handle-buffer handle)
		(buffer-name (mm-handle-buffer handle)))
       (with-temp-buffer
	 (mm-disable-multibyte)
	 (insert-buffer-substring (mm-handle-buffer handle))
	 (mm-decode-content-transfer-encoding
	  (mm-handle-encoding handle)
	  (mm-handle-media-type handle))
	 ,@forms))))