[PATCH] emacs: Add a defcustom that specifies regexp for blocked remote images.

Subject: [PATCH] emacs: Add a defcustom that specifies regexp for blocked remote images.

Date: Thu, 29 Jan 2015 09:28:47 -0800

To: notmuch@notmuchmail.org

Cc:

From: Jinwoo Lee


It's default value is ".", meaning all remote images will be blocked
by default.
---
 emacs/notmuch-show.el | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 66350d4..cc6aca9 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -136,6 +136,11 @@ indentation."
   :type 'boolean
   :group 'notmuch-show)
 
+(defcustom notmuch-show-text/html-blocked-images "."
+  "Remote images that have URLs matching this regexp will be blocked."
+  :type '(choice (const nil) regexp)
+  :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,11 @@ 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 notmuch-show-text/html-blocked-images)
+	(gnus-blocked-images notmuch-show-text/html-blocked-images))
     (shr-insert-document dom)
     t))
 
-- 
2.2.2


Thread: