diff options
-rw-r--r-- | lib/net/jao-notmuch.el | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/lib/net/jao-notmuch.el b/lib/net/jao-notmuch.el index 53137be..bd48e8f 100644 --- a/lib/net/jao-notmuch.el +++ b/lib/net/jao-notmuch.el @@ -174,6 +174,20 @@ (jao-notmuch--toggle-mime) (jao-notmuch-goto-tree-buffer t))) +(defun jao-notmuch--view-html () + "Open the text/html part of the current message using `notmuch-show-view-part'." + (interactive) + (save-excursion + (goto-char + (prop-match-beginning + (text-property-search-forward + :notmuch-part + "text/html" + (lambda (value notmuch-part) + (equal (plist-get notmuch-part :content-type) + value))))) + (notmuch-show-view-part))) + (defvar-local jao-notmuch--showing-images nil) (defun jao-notmuch--shr-toggle-images () @@ -193,10 +207,12 @@ (defun jao-notmuch-toggle-images () (interactive) - (if (eq mm-text-html-renderer 'w3m) - (when (fboundp 'jao-notmuch--w3m-toggle-images) - (jao-notmuch--w3m-toggle-images)) - (jao-notmuch--shr-toggle-images))) + (cond ((eq mm-text-html-renderer 'w3m) + (when (fboundp 'jao-notmuch--w3m-toggle-images) + (jao-notmuch--w3m-toggle-images))) + (window-system (jao-notmuch--shr-toggle-images)) + (t (with-current-buffer notmuch-tree-message-buffer + (jao-notmuch--view-html))))) ;;;; Keeping track of unread messages in current tree view |