summaryrefslogtreecommitdiffhomepage
path: root/lib/net
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 /lib/net
parent5c6619e863523307bf4c9c657ec9e65d2e8bb74e (diff)
downloadelibs-ec873bca5cfebe194b56ac03e4b760cf63f2156c.tar.gz
elibs-ec873bca5cfebe194b56ac03e4b760cf63f2156c.tar.bz2
jao-notmuch-toggle-images: really toggle for shr renderer
Diffstat (limited to 'lib/net')
-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)