Function: mml-insert-mime

mml-insert-mime is a byte-compiled function defined in mml.el.gz.

Signature

(mml-insert-mime HANDLE &optional NO-MARKUP)

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/mml.el.gz
(defun mml-insert-mime (handle &optional no-markup)
  (let (textp buffer mmlp)
    ;; Determine type and stuff.
    (unless (stringp (car handle))
      (unless (setq textp (equal (mm-handle-media-supertype handle) "text"))
	(with-current-buffer (setq buffer (mml-generate-new-buffer " *mml*"))
	  (if (eq (mail-content-type-get (mm-handle-type handle) 'charset)
		  'gnus-decoded)
	      ;; A part that mm-uu dissected from a non-MIME message
	      ;; because of `gnus-article-emulate-mime'.
	      (progn
		(mm-enable-multibyte)
		(insert-buffer-substring (mm-handle-buffer handle)))
	    (mm-insert-part handle 'no-cache)
	    (if (setq mmlp (equal (mm-handle-media-type handle)
				  "message/rfc822"))
		(mime-to-mml))))))
    (if mmlp
	(mml-insert-mml-markup handle nil t t)
      (unless (and no-markup
		   (equal (mm-handle-media-type handle) "text/plain"))
	(mml-insert-mml-markup handle buffer textp)))
    (cond
     (mmlp
      (insert-buffer-substring buffer)
      (goto-char (point-max))
      (insert "<#/mml>\n"))
     ((stringp (car handle))
      (mapc #'mml-insert-mime (cdr handle))
      (insert "<#/multipart>\n"))
     (textp
      (let ((charset (mail-content-type-get
		      (mm-handle-type handle) 'charset))
	    (start (point)))
	(if (eq charset 'gnus-decoded)
	    (mm-insert-part handle)
	  (insert (mm-decode-string (mm-get-part handle) charset)))
	(mml-quote-region start (point)))
      (goto-char (point-max)))
     (t
      (insert "<#/part>\n")))))