From: David Edmondson Date: Fri, 23 Jan 2015 07:21:41 +0000 (+0000) Subject: Re: [PATCH] emacs: show: allow user to hide some mime types by default. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5e22115b302b8427502e9bbdb8a75b12f5276830;p=notmuch-archives.git Re: [PATCH] emacs: show: allow user to hide some mime types by default. --- diff --git a/fb/d06d7cedc39729ef1e552ffef30b6b373260ee b/fb/d06d7cedc39729ef1e552ffef30b6b373260ee new file mode 100644 index 000000000..2bf41f308 --- /dev/null +++ b/fb/d06d7cedc39729ef1e552ffef30b6b373260ee @@ -0,0 +1,165 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 767AB431FC9 + for ; Thu, 22 Jan 2015 23:21:51 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 1.739 +X-Spam-Level: * +X-Spam-Status: No, score=1.739 tagged_above=-999 required=5 + tests=[DNS_FROM_AHBL_RHSBL=2.438, RCVD_IN_DNSWL_LOW=-0.7, + UNPARSEABLE_RELAY=0.001] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id hPiP5WAt5Uox for ; + Thu, 22 Jan 2015 23:21:48 -0800 (PST) +Received: from mail-wg0-f50.google.com (mail-wg0-f50.google.com + [74.125.82.50]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client + certificate requested) by olra.theworths.org (Postfix) with ESMTPS id + E4869431FBC for ; Thu, 22 Jan 2015 23:21:47 -0800 + (PST) +Received: by mail-wg0-f50.google.com with SMTP id b13so5800777wgh.9 + for ; Thu, 22 Jan 2015 23:21:45 -0800 (PST) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:to:subject:in-reply-to:references:user-agent + :from:date:message-id:mime-version:content-type; + bh=ZWkq4RgDijFIFhWnPzuaOUtP0AiINqFRJw7h3U8rqKY=; + b=AyHISFp1x66MPgeD95O1QL2swJKYE61yjHkWzOjoqXTP2FgGrVGGcmRZ4YgZYq3m+q + WPE8kov10m14OnK9YU8dz8810rsxPs8mjUyMpC9Fie6Zd4+OelRTEOpqDRXXhFYyES1S + Z7rjRx1z79RFpksQQsGEBXTPs8laPJXf7Hsvlgrh1N7i6grRWzhlfifdqHHfAW61/JpK + noQu4K641Ambpc2JWGHpuhQ/99CLGTWYgEdmXIPMnXf4thVC2fGFG5AGtaTPdnlp1ge7 + bG9i5u50Je6jfyeAfX+pk+oDG2yi57pCvPlMLiJR+Ol4Nw+ZpxA/dXTeTwOfyz6OcdzX + 3OXw== +X-Gm-Message-State: + ALoCoQmFACvyd8hkO6Vj5Z99cLBuMAMplLCjAuDC7j0Z2lNhidpox6jLQpT+JakSvYGRV/NN6KXr +X-Received: by 10.194.120.40 with SMTP id kz8mr10658929wjb.21.1421997704085; + Thu, 22 Jan 2015 23:21:44 -0800 (PST) +Received: from disaster-area.hh.sledj.net + ([2a01:348:1a2:1:ea39:35ff:fe2c:a227]) + by mx.google.com with ESMTPSA id ei5sm639444wid.2.2015.01.22.23.21.42 + (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Thu, 22 Jan 2015 23:21:42 -0800 (PST) +Received: from localhost (30000@localhost [local]); + by localhost (OpenSMTPD) with ESMTPA id 2b5df55d; + Fri, 23 Jan 2015 07:21:41 +0000 (UTC) +To: Mark Walters , notmuch@notmuchmail.org +Subject: Re: [PATCH] emacs: show: allow user to hide some mime types by + default. +In-Reply-To: <1421960852-26424-1-git-send-email-markwalters1009@gmail.com> +References: <1421960852-26424-1-git-send-email-markwalters1009@gmail.com> +User-Agent: none +From: David Edmondson +Date: Fri, 23 Jan 2015 07:21:41 +0000 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Fri, 23 Jan 2015 07:21:51 -0000 + +On Thu, Jan 22 2015, Mark Walters wrote: +> This commit adds a customize variable that allows the user to choose +> to hide some mime types by default. They can still choose to view the +> part by toggling the part button. +> +> One use is for hiding all text/html parts. This would mean that some +> explicit user action was required before the part was loaded which +> would mitigate some of the problems of remote image loading by the +> emacs html renderer as detailed by dkg in +> id:87ppa7q25w.fsf@alice.fifthhorseman.net. + +Whilst I think that having this knob is a good thing, I don't think that +it's a solution to the 'text/html renderers access the network' +problem. I can't sensibly (and don't wish to) disable the display of +text/html parts by default (colleagues generate too many text/html +messages to make that feasible, and I have rss2imap generate a bunch of +text/html messages that I want to see in their full glory), but would +definitely like to choose whether a message can sell me out to +advertisers. + +I'm trying to say that this is good, but let's not get into the habit of +telling someone that complains about network access that adding +text/html to `notmuch-show-always-hide-types' is the solution. + +> --- +> +> I think this might be useful anyway (dkg asked for it before he found +> the bug) but seems particularly relevant now. +> +> To use set the variable notmuch-show-always-hide-types to '(text/html) +> or use the customize setting to add text/html to the list. +> +> Given the lack of control we have over the emacs renderers (so +> possibility of future problems) we could even set this by default. +> +> Best wishes +> +> Mark +> +> emacs/notmuch-show.el | 18 +++++++++++++++++- +> 1 file changed, 17 insertions(+), 1 deletion(-) +> +> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +> index 9f6fe07..8f49f17 100644 +> --- a/emacs/notmuch-show.el +> +++ b/emacs/notmuch-show.el +> @@ -234,6 +234,15 @@ every user interaction with notmuch." +> :type 'function +> :group 'notmuch-show) +> +> +(defcustom notmuch-show-always-hide-types nil +> + "List of mime types that should always be hidden. +> + +> +This is a list of mime types that should be initally displayed in +> +the show buffer as hidden parts; they can be displayed by +> +toggling the part button. Wildcards are allowed in the list." +> + :type '(repeat string) +> + :group 'notmuch-show) +> + +> (defmacro with-current-notmuch-show-message (&rest body) +> "Evaluate body with current buffer set to the text of current message" +> `(save-excursion +> @@ -798,6 +807,12 @@ message at DEPTH in the current thread." +> (intern (concat "notmuch-show-insert-part-" content-type)))) +> result)) +> +> +(defun notmuch-show-always-hide (mime-type) +> + "Is mime-type in notmuch-show-always-hide-types" +> + (let (match) +> + (dolist (type notmuch-show-always-hide-types match) +> + (setq match (or match (notmuch-match-content-type mime-type type)))))) +> + +> ;; + +> +> (defun notmuch-show-insert-bodypart-internal (msg part content-type nth depth button) +> @@ -900,7 +915,8 @@ useful for quoting in replies)." +> (nth (plist-get part :id)) +> (beg (point)) +> ;; Hide the part initially if HIDE is t. +> - (show-part (not (equal hide t))) +> + (show-part (and (not (equal hide t)) +> + (not (notmuch-show-always-hide mime-type)))) +> ;; We omit the part button for the first (or only) part if +> ;; this is text/plain, or HIDE is 'no-buttons. +> (button (unless (or (equal hide 'no-buttons) +> -- +> 2.1.4 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch