summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--lib/net/jao-notmuch.el18
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/net/jao-notmuch.el b/lib/net/jao-notmuch.el
index 7fae647..905dcd9 100644
--- a/lib/net/jao-notmuch.el
+++ b/lib/net/jao-notmuch.el
@@ -155,6 +155,13 @@
(defvar-local jao-notmuch--showing-images nil)
+(defun jao-notmuch--setup-w3m-images (&optional activate)
+ (setq-local w3m-ignored-image-url-regexp
+ (unless jao-notmuch--showing-images
+ notmuch-show-text/html-blocked-images))
+ (when activate
+ (w3m-toggle-inline-images (if jao-notmuch--showing-images t 'turnoff))))
+
(defun jao-notmuch-show-images ()
(interactive)
(save-window-excursion
@@ -165,13 +172,10 @@
(when (looking-at-p "(hidden)")
(notmuch-show-toggle-part-invisibility))
(forward-line 1)
- (setq-local jao-notmuch--showing-images
- (not jao-notmuch--showing-images)
- w3m-ignored-image-url-regexp
- (unless jao-notmuch--showing-images
- notmuch-show-text/html-blocked-images))
- (w3m-toggle-inline-images
- (if jao-notmuch--showing-images t 'turnoff))))))
+ (setq jao-notmuch--showing-images (not jao-notmuch--showing-images))
+ (jao-notmuch--setup-w3m-images t)))))
+
+(add-hook 'notmuch-show-mode-hook #'jao-notmuch--setup-w3m-images)
(defun jao-notmuch-show-ret ()
(interactive)