From fca520578129597fd5545811e770a87abb21bdf6 Mon Sep 17 00:00:00 2001 From: jao Date: Thu, 29 Jul 2021 02:53:10 +0100 Subject: notmuch: image toggling in w3m seems to finally work --- lib/net/jao-notmuch.el | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'lib/net') 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) -- cgit v1.2.3