summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-07-29 02:53:10 +0100
committerjao <jao@gnu.org>2021-07-29 02:53:10 +0100
commitfca520578129597fd5545811e770a87abb21bdf6 (patch)
tree0460dd711dabd8fb1589c47cf978104ded6c3199
parent191921b3118ad09f7d18caa31e33754b6387a953 (diff)
downloadelibs-fca520578129597fd5545811e770a87abb21bdf6.tar.gz
elibs-fca520578129597fd5545811e770a87abb21bdf6.tar.bz2
notmuch: image toggling in w3m seems to finally work
-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)