From 907db013c0273dc0ac520559058d672177950776 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Mon, 2 Aug 2021 23:39:33 +0300 Subject: [PATCH] mu4e-view-gnus: Manipulate gnus so it blocks remote images mu4e reuses the default gnus-blocked-images, but sadly in the mu4e context, the default (a function called gnus-block-private-groups) does _not_ work (i.e., it never blocks). Advise this function so it'll block for mu4e as well, and update the docs. Fixes: #2072. --- mu4e/mu4e-view-gnus.el | 7 +++++++ mu4e/mu4e.texi | 18 +++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/mu4e/mu4e-view-gnus.el b/mu4e/mu4e-view-gnus.el index 2b8d68c2..125ac76c 100644 --- a/mu4e/mu4e-view-gnus.el +++ b/mu4e/mu4e-view-gnus.el @@ -422,6 +422,13 @@ Gnus' article-mode." (advice-add 'gnus-set-mode-line :around #'mu4e~view-nop) (advice-add 'gnus-button-reply :around #'mu4e~view-button-reply) (advice-add 'gnus-msg-mail :around #'mu4e~view-msg-mail) + + ;; advice gnus-block-private-groups to always return "." + ;; so that by default we block images. + (advice-add 'gnus-block-private-groups :around + (lambda(func &rest args) + (if (mu4e~view-mode-p) + "." (apply func args)))) (mu4e~view-mode-body)) ;;; Massaging the message view diff --git a/mu4e/mu4e.texi b/mu4e/mu4e.texi index f9aabfb0..75dc242c 100644 --- a/mu4e/mu4e.texi +++ b/mu4e/mu4e.texi @@ -1370,10 +1370,17 @@ To disable this, set @code{gnus-inhibit-images} to @t{t}. By default, external images in HTML are not retrieved from external URLs because they can be used to track you. +Apart from that, you can also control whether to load remote images; +since loading remote images is often used for privacy violations, by +default this is not allowed. + You can specify what URLs to block by setting -@code{gnus-blocked-images} to a regular exporession or to a function -that will receive the message as an argument. For example, to enable -images in Github notifications, do the following: +@code{gnus-blocked-images} to a regular expression or to a function +that will receive a single parameter which is not meaningful for +@t{mu4e}. + +For example, to enable images in Github notifications, you could use +the following: @lisp (setq gnus-blocked-images @@ -1383,6 +1390,11 @@ images in Github notifications, do the following: nil "."))) @end lisp +@code{mu4e} inherits the default @t{gnus-blocked-images} from Gnus and +ensures that it works with @t{mu4e} too. However, mu4e is not Gnus, so +if you have Gnus-specific settings for @t{gnus-blocked-images}, you +should verify that they have the desired effect in @code{mu4e} as +well. @node MSGV Custom headers @section Custom headers