[PATCH] Add a defcustom for whether to block remote images by default.

Jinwoo Lee jinwoo68 at gmail.com
Wed Jan 28 17:39:32 PST 2015


---
 emacs/notmuch-show.el | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 66350d4..bc48922 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -136,6 +136,11 @@ indentation."
   :type 'boolean
   :group 'notmuch-show)
 
+(defcustom notmuch-show-block-remote-images t
+  "Block remote images by default."
+  :type 'boolean
+  :group 'notmuch-show)
+
 (defvar notmuch-show-thread-id nil)
 (make-variable-buffer-local 'notmuch-show-thread-id)
 (put 'notmuch-show-thread-id 'permanent-local t)
@@ -798,10 +803,12 @@ will return nil if the CID is unknown or cannot be retrieved."
 	   ;; URL-decode it (see RFC 2392).
 	   (let ((cid (url-unhex-string url)))
 	     (first (notmuch-show--get-cid-content cid)))))
-	;; Block all external images to prevent privacy leaks and
-	;; potential attacks.  FIXME: If we block an image, offer a
-	;; button to load external images.
-	(shr-blocked-images "."))
+	;; By default, block all external images to prevent privacy
+	;; leaks and potential attacks.  FIXME: If we block an image,
+	;; offer a button to load external images.
+	(shr-blocked-images (if notmuch-show-block-remote-images
+				"."
+			      shr-blocked-images)))
     (shr-insert-document dom)
     t))
 
-- 
2.2.2



More information about the notmuch mailing list