Function: mh-mime-display

mh-mime-display is an autoloaded and byte-compiled function defined in mh-mime.el.gz.

Signature

(mh-mime-display &optional PRE-DISSECTED-HANDLES)

Documentation

Display (and possibly decode) MIME handles.

Optional argument, PRE-DISSECTED-HANDLES is a list of MIME handles. If present they are displayed otherwise the buffer is parsed and then displayed.

Source Code

;; Defined in /usr/src/emacs/lisp/mh-e/mh-mime.el.gz
;;;###mh-autoload
(defun mh-mime-display (&optional pre-dissected-handles)
  "Display (and possibly decode) MIME handles.
Optional argument, PRE-DISSECTED-HANDLES is a list of MIME
handles. If present they are displayed otherwise the buffer is
parsed and then displayed."
  (let ((handles ())
        (folder mh-show-folder-buffer)
        (raw-message-data (buffer-string)))
    (mh-flet
     ((mm-handle-set-external-undisplayer
       (handle function)
       (mh-handle-set-external-undisplayer folder handle function)))
     (goto-char (point-min))
     (unless (search-forward "\n\n" nil t)
       (goto-char (point-max))
       (insert "\n\n"))

     (condition-case err
         (progn
           ;; If needed dissect the current buffer
           (if pre-dissected-handles
               (setq handles pre-dissected-handles)
             (if (setq handles (mm-dissect-buffer nil))
                 (mm-uu-dissect-text-parts handles)
               (setq handles (mm-uu-dissect)))
             (setf (mh-mime-handles (mh-buffer-data))
                   (mm-merge-handles handles
                                        (mh-mime-handles (mh-buffer-data))))
             (unless handles
               (mh-decode-message-body)))

           (cond ((and handles
                       (or (not (stringp (car handles)))
                           (cdr handles)))
                  ;; Go to start of message body
                  (goto-char (point-min))
                  (or (search-forward "\n\n" nil t)
                      (goto-char (point-max)))

                  ;; Delete the body
                  (delete-region (point) (point-max))

                  ;; Display the MIME handles
                  (mh-mime-display-part handles))
                 (t
                  (mh-signature-highlight))))
       (error
        (message "Could not display body: %s" (error-message-string err))
        (delete-region (point-min) (point-max))
        (insert raw-message-data))))))