mu4e-view: add toggle to show all mime-parts

Add a toggle to show (links for) all top-level MIME-parts, so you can e.g.
perform actions on 'inline' images.
This commit is contained in:
Dirk-Jan C. Binnema 2021-12-19 23:12:59 +02:00
parent d389dbb5b3
commit 8dcdd0a815
1 changed files with 18 additions and 1 deletions

View File

@ -705,6 +705,20 @@ determine which browser function to use."
(mm-destroy-parts mu4e~gnus-article-mime-handles)
(setq mu4e~gnus-article-mime-handles nil)))
(defun mu4e-view-refresh ()
"Refresh the message view."
(interactive)
(when (derived-mode-p 'mu4e-view-mode)
(kill-buffer)
(mu4e-view mu4e~view-message)))
(defun mu4e-view-toggle-show-mime-parts()
"Toggle whether to show all MIME-parts."
(interactive)
(setq gnus-inhibit-mime-unbuttonizing
(not gnus-inhibit-mime-unbuttonizing))
(mu4e-view-refresh))
(defun mu4e~view-gnus-display-mime (msg)
"Like `gnus-display-mime' but include mu4e headers to MSG."
(lambda (&optional ihandles)
@ -991,7 +1005,8 @@ Based on Gnus' article-mode."
(defcustom mu4e-view-massage-options
'( ("ctoggle citations" . gnus-article-hide-citation)
("htoggle headers" . gnus-article-hide-headers)
("ytoggle crypto" . gnus-article-hide-pem))
("ytoggle crypto" . gnus-article-hide-pem)
("mtoggle show all MIME parts" . mu4e-view-toggle-show-mime-parts))
"Various options for 'massaging' the message view. See `(gnus)
Article Treatment' for more options."
:group 'mu4e-view
@ -1003,6 +1018,8 @@ Article Treatment' for more options."
(funcall (mu4e-read-option "Massage: " mu4e-view-massage-options)))
;;; MIME-parts
(defvar-local mu4e~view-mime-parts nil
"MIME parts for this message.")
(defun mu4e~view-gather-mime-parts ()
"Gather all MIME parts as an alist.