summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-01-20 21:35:11 +0000
committerjao <jao@gnu.org>2022-01-20 21:35:11 +0000
commitec873bca5cfebe194b56ac03e4b760cf63f2156c (patch)
tree96f5c8d6a324d7fd646ca9f496dd36b178ac4523
parent5c6619e863523307bf4c9c657ec9e65d2e8bb74e (diff)
downloadelibs-ec873bca5cfebe194b56ac03e4b760cf63f2156c.tar.gz
elibs-ec873bca5cfebe194b56ac03e4b760cf63f2156c.tar.bz2
jao-notmuch-toggle-images: really toggle for shr renderer
-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)