From 666d7d94655a3b9151504b9550411feb845c7b96 Mon Sep 17 00:00:00 2001 From: jao Date: Mon, 5 Jul 2021 00:34:44 +0100 Subject: cleaner handling of images in html email --- lib/net/jao-notmuch.el | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'lib/net/jao-notmuch.el') diff --git a/lib/net/jao-notmuch.el b/lib/net/jao-notmuch.el index bb57f57..97e34f5 100644 --- a/lib/net/jao-notmuch.el +++ b/lib/net/jao-notmuch.el @@ -108,28 +108,30 @@ (jao-notmuch-goto-message-buffer)) (notmuch-show-browse-urls))) +(defun jao-notmuch--toggle-mime () + (save-excursion + (goto-char (point-min)) + (when (re-search-forward "\\[ multipart/alternative \\]" nil t) + (while (forward-button 1 nil nil t) + (notmuch-show-toggle-part-invisibility))))) + (defun jao-notmuch-toggle-mime-parts () (interactive) (when (jao-notmuch-goto-message-buffer) (goto-char (point-min)) - (let ((notmuch-show-text/html-blocked-images nil) - (shr-inhibit-images nil) - (shr-blocked-images nil)) - (save-excursion - (when (re-search-forward "\\[ multipart/alternative \\]" nil t) - (while (forward-button 1 nil nil t) - (notmuch-show-toggle-part-invisibility))))) + (jao-notmuch--toggle-mime) (jao-notmuch-goto-tree-buffer))) -(defun jao-notmuch-toggle-images () +(defun jao-notmuch-show-images () (interactive) (save-window-excursion (jao-notmuch-goto-message-buffer) (when (derived-mode-p 'notmuch-show-mode) - (let ((notmuch-show-text/html-blocked-images nil) - (shr-inhibit-images nil) - (shr-blocked-images nil)) - (notmuch-refresh-this-buffer))))) + (setq-local mm-w3m-safe-url-regexp nil + notmuch-show-text/html-blocked-images nil + shr-inhibit-images nil + shr-blocked-images nil) + (notmuch-refresh-this-buffer)))) ;; Keeping track of unread messages in current tree view -- cgit v1.2.3