+(defun mm-inline-message (handle)
+ (let ((b (point))
+ (charset (mail-content-type-get
+ (mm-handle-type handle) 'charset))
+ gnus-displaying-mime handles)
+ (when (and charset
+ (stringp charset))
+ (setq charset (intern (downcase charset)))
+ (when (eq charset 'us-ascii)
+ (setq charset nil)))
+ (save-excursion
+ (save-restriction
+ (narrow-to-region b b)
+ (mm-insert-part handle)
+ (let (gnus-article-mime-handles
+ ;; disable prepare hook
+ gnus-article-prepare-hook
+ (gnus-newsgroup-charset
+ (or charset gnus-newsgroup-charset)))
+ (run-hooks 'gnus-article-decode-hook)
+ (gnus-article-prepare-display)
+ (setq handles gnus-article-mime-handles))
+ (goto-char (point-max))
+ (unless (bolp)
+ (insert "\n"))
+ (insert "----------\n\n")
+ (when handles
+ (setq gnus-article-mime-handles
+ (nconc gnus-article-mime-handles
+ (if (listp (car handles))
+ handles (list handles)))))
+ (mm-handle-set-undisplayer
+ handle
+ `(lambda ()
+ (let (buffer-read-only)
+ (if (fboundp 'remove-specifier)
+ ;; This is only valid on XEmacs.
+ (mapcar (lambda (prop)
+ (remove-specifier
+ (face-property 'default prop) (current-buffer)))
+ '(background background-pixmap foreground)))
+ (delete-region ,(point-min-marker) ,(point-max-marker)))))))))
+
+(defun mm-display-inline-fontify (handle mode)
+ (let (text)
+ (with-temp-buffer
+ (mm-insert-part handle)
+ (funcall mode)
+ (font-lock-fontify-buffer)
+ (when (fboundp 'extent-list)
+ (map-extents (lambda (ext ignored)
+ (set-extent-property ext 'duplicable t)
+ nil)
+ nil nil nil nil nil 'text-prop))
+ (setq text (buffer-string)))
+ (mm-insert-inline handle text)))
+
+(defun mm-display-patch-inline (handle)
+ (mm-display-inline-fontify handle 'diff-mode))
+
+(defun mm-display-elisp-inline (handle)
+ (mm-display-inline-fontify handle 'emacs-lisp-mode))
+