summaryrefslogtreecommitdiffhomepage
path: root/lib/net/jao-notmuch.el
diff options
context:
space:
mode:
Diffstat (limited to 'lib/net/jao-notmuch.el')
-rw-r--r--lib/net/jao-notmuch.el26
1 files changed, 17 insertions, 9 deletions
diff --git a/lib/net/jao-notmuch.el b/lib/net/jao-notmuch.el
index 8ff6053..b4c587e 100644
--- a/lib/net/jao-notmuch.el
+++ b/lib/net/jao-notmuch.el
@@ -174,16 +174,24 @@
(jao-notmuch--toggle-mime)
(jao-notmuch-goto-tree-buffer t)))
-(defun jao-notmuch--shr-toggle-images ()
- (notmuch-tree-close-message-window)
- (let ((mm-text-html-renderer 'shr)
- (shr-blocked-images nil)
- (shr-inhibit-images nil)
- (notmuch-show-text/html-blocked-images nil)
- (notmuch-multipart/alternative-discouraged '("text/plain")))
- (notmuch-tree-show-message nil)))
+(defvar-local jao-notmuch--showing-images nil)
-(defun jao-notmuch-show-images ()
+(defun jao-notmuch--shr-toggle-images ()
+ (let* ((b notmuch-tree-message-buffer)
+ (show (not (buffer-local-value 'jao-notmuch--showing-images b)))
+ (mm-text-html-renderer 'shr)
+ (shr-blocked-images (unless show shr-blocked-images))
+ (shr-inhibit-images (not show))
+ (notmuch-show-text/html-blocked-images
+ (unless show notmuch-show-text/html-blocked-images))
+ (notmuch-multipart/alternative-discouraged
+ (if show '("text/plain") notmuch-multipart/alternative-discouraged)))
+ (notmuch-tree-close-message-window)
+ (notmuch-tree-show-message nil)
+ (with-current-buffer notmuch-tree-message-buffer
+ (setq jao-notmuch--showing-images show))))
+
+(defun jao-notmuch-toggle-images ()
(interactive)
(if (eq mm-text-html-renderer 'w3m)
(when (fboundp 'jao-notmuch--w3m-toggle-images)