Function: mh-display-with-external-viewer

mh-display-with-external-viewer is an autoloaded, interactive and byte-compiled function defined in mh-mime.el.gz.

Signature

(mh-display-with-external-viewer PART-INDEX)

Documentation

View attachment externally.

If Emacs does not know how to view an attachment, you could save it into a file and then run some program to open it. It is easier, however, to launch the program directly from MH-E with this command. While you'll most likely use this to view spreadsheets and documents, it is also useful to use your browser to view HTML attachments with higher fidelity than what Emacs can provide.

This command displays the attachment associated with the button under the cursor. If the cursor is not located over a button, then the cursor first moves to the next button, wrapping to the beginning of the message if necessary. You can provide a numeric prefix argument PART-INDEX to view the attachment labeled with that number.

This command tries to provide a reasonable default for the viewer by calling the Emacs function mailcap-mime-info. This function usually reads the file "/etc/mailcap".

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/mh-e/mh-mime.el.gz
;;; MH-Folder Commands

;; Alphabetical.

;;;###mh-autoload
(defun mh-display-with-external-viewer (part-index)
  "View attachment externally.

If Emacs does not know how to view an attachment, you could save
it into a file and then run some program to open it. It is
easier, however, to launch the program directly from MH-E with
this command. While you'll most likely use this to view
spreadsheets and documents, it is also useful to use your browser
to view HTML attachments with higher fidelity than what Emacs can
provide.

This command displays the attachment associated with the button
under the cursor. If the cursor is not located over a button,
then the cursor first moves to the next button, wrapping to the
beginning of the message if necessary. You can provide a numeric
prefix argument PART-INDEX to view the attachment labeled with
that number.

This command tries to provide a reasonable default for the viewer
by calling the Emacs function `mailcap-mime-info'. This function
usually reads the file \"/etc/mailcap\"."
  (interactive "P")
  (when (consp part-index) (setq part-index (car part-index)))
  (mh-folder-mime-action
   part-index
   #'(lambda ()
       (let* ((part (get-text-property (point) 'mh-data))
              (type (mm-handle-media-type part))
              (methods (mapcar (lambda (x) (list (cdr (assoc 'viewer x))))
                               (mailcap-mime-info type 'all)))
              (def (caar methods))
              (prompt (format-prompt "Viewer" def))
              (method (completing-read prompt methods nil nil nil nil def))
              (folder mh-show-folder-buffer)
              (buffer-read-only nil))
         (when (string-match "^[^% \t]+$" method)
           (setq method (concat method " %s")))
         (mh-flet
          ((mm-handle-set-external-undisplayer
            (handle function)
            (mh-handle-set-external-undisplayer folder handle function)))
          (unwind-protect (mm-display-external part method)
            (set-buffer-modified-p nil)))))
   nil))