From a060053fa519d6c690fd6e740990ec9dc343dcdb Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Tue, 21 Feb 2012 07:50:11 +0000 Subject: [PATCH] Re: [PATCH v2 1/2] emacs: support defining a list of alternative parts to show --- c2/da5cb0de385a7711b5f5b7ebf530d0087c460e | 133 ++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 c2/da5cb0de385a7711b5f5b7ebf530d0087c460e diff --git a/c2/da5cb0de385a7711b5f5b7ebf530d0087c460e b/c2/da5cb0de385a7711b5f5b7ebf530d0087c460e new file mode 100644 index 000000000..823b06622 --- /dev/null +++ b/c2/da5cb0de385a7711b5f5b7ebf530d0087c460e @@ -0,0 +1,133 @@ +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 9E8C9431FAF + for ; Mon, 20 Feb 2012 23:50:17 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 NqrmZfdhu+wO for ; + Mon, 20 Feb 2012 23:50:16 -0800 (PST) +Received: from mail-qw0-f46.google.com (mail-qw0-f46.google.com + [209.85.216.46]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id D5FCA431FAE + for ; Mon, 20 Feb 2012 23:50:16 -0800 (PST) +Received: by qadc10 with SMTP id c10so4570797qad.5 + for ; Mon, 20 Feb 2012 23:50:15 -0800 (PST) +Received-SPF: pass (google.com: domain of jani@nikula.org designates + 10.229.136.144 as permitted sender) client-ip=10.229.136.144; +Authentication-Results: mr.google.com; + spf=pass (google.com: domain of jani@nikula.org + designates 10.229.136.144 as permitted sender) + smtp.mail=jani@nikula.org +Received: from mr.google.com ([10.229.136.144]) + by 10.229.136.144 with SMTP id r16mr18499281qct.62.1329810615299 + (num_hops = 1); Mon, 20 Feb 2012 23:50:15 -0800 (PST) +Received: by 10.229.136.144 with SMTP id r16mr15593502qct.62.1329810615157; + Mon, 20 Feb 2012 23:50:15 -0800 (PST) +Received: from localhost (nikula.org. [92.243.24.172]) + by mx.google.com with ESMTPS id hp1sm6771287qab.22.2012.02.20.23.50.13 + (version=SSLv3 cipher=OTHER); Mon, 20 Feb 2012 23:50:14 -0800 (PST) +From: Jani Nikula +To: notmuch@notmuchmail.org +Subject: Re: [PATCH v2 1/2] emacs: support defining a list of alternative + parts to show +In-Reply-To: + +References: + +User-Agent: Notmuch/0.11.1+168~g25a7ceb (http://notmuchmail.org) Emacs/23.1.1 + (i686-pc-linux-gnu) +Date: Tue, 21 Feb 2012 07:50:11 +0000 +Message-ID: <87obssiq18.fsf@nikula.org> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Gm-Message-State: + ALoCoQmH41EQSC7KaHI6o1t1HpFsjHLflYRGPKyU1RjOgQRT9HW67lyi3+K7k7egDo6zVCDpcsJf +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: Tue, 21 Feb 2012 07:50:17 -0000 + +On Thu, 9 Feb 2012 14:46:02 +0000, Jani Nikula wrote: +> Make notmuch-show-all-multipart/alternative-parts accept a list of +> regexps to match the part types to determine which parts to show in +> addition to the preferred types. This allows the user to force display +> some alternative part types while normally showing just the preferred +> ones. + +Wah, this patch (1/2) is crap, as it also seems to affect the +reply. I'll probably return to this later, after the json reply stuff is +merged or so. + +BR, +Jani. + + +> +> Signed-off-by: Jani Nikula +> --- +> emacs/notmuch-show.el | 23 ++++++++++++++++++----- +> 1 files changed, 18 insertions(+), 5 deletions(-) +> +> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +> index 24fde05..5f643f1 100644 +> --- a/emacs/notmuch-show.el +> +++ b/emacs/notmuch-show.el +> @@ -94,10 +94,20 @@ any given message." +> :group 'notmuch-show +> :group 'notmuch-hooks) +> +> -;; Mostly useful for debugging. +> (defcustom notmuch-show-all-multipart/alternative-parts t +> - "Should all parts of multipart/alternative parts be shown?" +> - :type 'boolean +> + "Which parts of multipart/alternative should be shown? +> + +> +This variable determines which parts of multipart/alternative +> +should be displayed. Set to t (the default) to show all +> +parts. Set to nil to only show the preferred parts. Set to a list +> +of regexps to display the preferred parts, and parts matching any +> +of the regexps, for example: +> + +> + (setq notmuch-show-all-multipart/alternative-parts +> + '(\"text/.*calendar\" \"text/html\"))" +> + :type '(choice (const :tag "Show all parts" t) +> + (const :tag "Show preferred parts" nil) +> + (repeat :tag "Show preferred and parts matching regexps" string)) +> :group 'notmuch-show) +> +> (defcustom notmuch-show-indent-messages-width 1 +> @@ -513,8 +523,11 @@ current buffer, if possible." +> ;; should be chosen if there are more than one that match? +> (mapc (lambda (inner-part) +> (let ((inner-type (plist-get inner-part :content-type))) +> - (if (or notmuch-show-all-multipart/alternative-parts +> - (string= chosen-type inner-type)) +> + (if (or (equal notmuch-show-all-multipart/alternative-parts t) +> + (string= chosen-type inner-type) +> + (and +> + notmuch-show-all-multipart/alternative-parts +> + (equal (string-match-p (mapconcat (lambda (s) (format "^%s$" s)) notmuch-show-all-multipart/alternative-parts "\\|") inner-type) 0))) +> (notmuch-show-insert-bodypart msg inner-part depth) +> (notmuch-show-insert-part-header (plist-get inner-part :id) inner-type inner-type nil " (not shown)")))) +> inner-parts) +> -- +> 1.7.1 +> -- 2.26.2