Function: mh-display-msg
mh-display-msg is an autoloaded and byte-compiled function defined in
mh-show.el.gz.
Signature
(mh-display-msg MSG-NUM FOLDER-NAME)
Documentation
Display MSG-NUM of FOLDER-NAME.
Sets the current buffer to the show buffer.
This function has :after advice: hmh--run-show-hook.
Source Code
;; Defined in /usr/src/emacs/lisp/mh-e/mh-show.el.gz
;;;###mh-autoload
(defun mh-display-msg (msg-num folder-name)
"Display MSG-NUM of FOLDER-NAME.
Sets the current buffer to the show buffer."
(let ((folder (mh-msg-folder folder-name)))
(set-buffer folder)
;; When Gnus uses external displayers it has to keep handles longer. So
;; we will delete these handles when mh-quit is called on the folder. It
;; would be nicer if there are weak pointers in Emacs Lisp, then we could
;; get the garbage collector to do this for us.
(unless (mh-buffer-data)
(setf (mh-buffer-data) (mh-make-buffer-data)))
;; Bind variables in folder buffer in case they are local
(let ((formfile mh-mhl-format-file)
(clean-message-header mh-clean-message-header-flag)
(invisible-headers mh-invisible-header-fields-compiled)
;; (visible-headers nil)
(msg-filename (mh-msg-filename msg-num folder-name))
(show-buffer mh-show-buffer)
(mm-inline-media-tests mh-mm-inline-media-tests))
(if (not (file-exists-p msg-filename))
(error "Message %d does not exist" msg-num))
(if (and (> mh-show-maximum-size 0)
(> (elt (file-attributes msg-filename) 7)
mh-show-maximum-size)
(not (y-or-n-p
(format
"Message %d (%d bytes) exceeds %d bytes. Display it? "
msg-num (elt (file-attributes msg-filename) 7)
mh-show-maximum-size))))
(error "Message %d not displayed" msg-num))
(set-buffer show-buffer)
(cond ((not (equal msg-filename buffer-file-name))
(mh-unvisit-file)
(setq buffer-read-only nil)
;; Cleanup old mime handles
(mh-mime-cleanup)
(erase-buffer)
;; Changing contents, so this hook needs to be reinitialized.
;; pgp.el uses this.
(kill-local-variable 'write-contents-functions)
(font-lock-mode -1)
(mh-show-mode)
(if formfile
(mh-exec-lib-cmd-output "mhl" "-nobell" "-noclear"
(if (stringp formfile)
(list "-form" formfile))
msg-filename)
(insert-file-contents-literally msg-filename))
;; Use mm to display buffer
(when (and mh-decode-mime-flag (not formfile))
(mh-add-missing-mime-version-header)
(setf (mh-buffer-data) (mh-make-buffer-data))
(mh-mime-display))
(mh-show-unquote-From)
(mh-show-xface)
(mh-show-addr)
;; Header cleanup
(goto-char (point-min))
(cond (clean-message-header
(mh-clean-msg-header (point-min)
invisible-headers
nil) ;; visible-headers
(goto-char (point-min)))
(t
(mh-start-of-uncleaned-message)))
(mh-decode-message-header)
;; the parts of visiting we want to do (no locking)
(or (eq buffer-undo-list t) ;don't save undo info for prev msgs
(setq buffer-undo-list nil))
(set-buffer-auto-saved)
;; the parts of set-visited-file-name we want to do (no locking)
(setq buffer-file-name msg-filename)
(setq buffer-backed-up nil)
(auto-save-mode 1)
(set-mark nil)
(when (and mh-decode-mime-flag (not formfile))
(mh-display-smileys)
(mh-display-emphasis))
(set-buffer-modified-p nil)
(setq buffer-read-only t)
(setq mh-show-folder-buffer folder)
(setq mode-line-buffer-identification
(list (format mh-show-buffer-mode-line-buffer-id
folder-name msg-num)))
(mh-logo-display)
(set-buffer folder)
(setq mh-showing-with-headers nil))))))