Function: gnus-mime-view-part-as-type

gnus-mime-view-part-as-type is an interactive and byte-compiled function defined in gnus-art.el.gz.

Signature

(gnus-mime-view-part-as-type &optional MIME-TYPE PRED EVENT)

Documentation

Choose a MIME media type, and view the part as such.

If non-nil, PRED is a predicate to use during completion to limit the available media-types.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-art.el.gz
(defun gnus-mime-view-part-as-type (&optional mime-type pred event)
  "Choose a MIME media type, and view the part as such.
If non-nil, PRED is a predicate to use during completion to limit the
available media-types."
  (interactive (list nil nil last-nonmenu-event) gnus-article-mode)
  (save-excursion
    (if event (mouse-set-point event))
    (unless mime-type
      (setq mime-type
	    (let ((default (gnus-mime-view-part-as-type-internal)))
	      (gnus-completing-read
	       "View as MIME type"
	       (if pred
		   (seq-filter pred (mailcap-mime-types))
		 (mailcap-mime-types))
	       nil nil nil
	       (car default)))))
    (gnus-article-check-buffer)
    (let ((handle (get-text-property (point) 'gnus-data)))
      (when handle
	(when (equal (mm-handle-media-type handle) "message/external-body")
	  (unless (mm-handle-cache handle)
	    (mm-extern-cache-contents handle))
	  (setq handle (mm-handle-cache handle)))
	(setq handle
	      (mm-make-handle (mm-handle-buffer handle)
			      (cons mime-type (cdr (mm-handle-type handle)))
			      (mm-handle-encoding handle)
			      (mm-handle-undisplayer handle)
			      (mm-handle-disposition handle)
			      (mm-handle-description handle)
			      nil
			      (mm-handle-id handle)))
	(setq gnus-article-mime-handles
	      (mm-merge-handles gnus-article-mime-handles handle))
	(when (mm-handle-displayed-p handle)
	  (mm-remove-part handle))
	(gnus-mm-display-part handle)))))