summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--lib/net/jao-notmuch.el26
-rw-r--r--notmuch.org2
2 files changed, 18 insertions, 10 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)
diff --git a/notmuch.org b/notmuch.org
index ff4b73c..07bc472 100644
--- a/notmuch.org
+++ b/notmuch.org
@@ -464,7 +464,7 @@
("D" . jao-notmuch-tree-toggle-delete-thread)
("h" . jao-notmuch-goto-message-buffer)
("H" . jao-notmuch-click-message-buffer)
- ("i" . jao-notmuch-show-images)
+ ("i" . jao-notmuch-toggle-images)
("K" . jao-notmuch-tag-jump-and-next)
("k" . jao-notmuch-tree-read-thread)
("n" . jao-notmuch-tree-next)