From: David Edmondson Date: Mon, 7 Mar 2016 17:27:58 +0000 (+0000) Subject: Re: [PATCH v6 6/6] emacs/mua: Let user specify which parts get a header in citations. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0cd02366e8e515b0050c026913eb7d41a7a1d785;p=notmuch-archives.git Re: [PATCH v6 6/6] emacs/mua: Let user specify which parts get a header in citations. --- diff --git a/c0/87bce4528ad55222688c200c125be3b320c2c7 b/c0/87bce4528ad55222688c200c125be3b320c2c7 new file mode 100644 index 000000000..fde0a7e7d --- /dev/null +++ b/c0/87bce4528ad55222688c200c125be3b320c2c7 @@ -0,0 +1,214 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id 3DDBB6DE1410 + for ; Mon, 7 Mar 2016 09:28:05 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.135 +X-Spam-Level: +X-Spam-Status: No, score=-0.135 tagged_above=-999 required=5 + tests=[AWL=-0.068, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, + RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, + RCVD_IN_MSPIKE_WL=-0.01, SPF_NEUTRAL=0.652, UNPARSEABLE_RELAY=0.001] + autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id mWF2-dHVqu86 for ; + Mon, 7 Mar 2016 09:28:02 -0800 (PST) +Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com + [74.125.82.65]) by arlo.cworth.org (Postfix) with ESMTPS id 80BFB6DE140C for + ; Mon, 7 Mar 2016 09:28:02 -0800 (PST) +Received: by mail-wm0-f65.google.com with SMTP id n186so12014592wmn.0 + for ; Mon, 07 Mar 2016 09:28:02 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=dme-org.20150623.gappssmtp.com; s=20150623; + h=to:subject:in-reply-to:references:from:date:message-id:mime-version; + bh=GNwpdXSLiM+UxMJnuNc2HuVYsX/c4T7P/N8FhRIZ5Eg=; + b=BtD0qEGA9Z92IfCaFQrh7S0nFCwaJMVGBgPt5plGOollAb5Wz6GFxJ1lD0uplH/Um7 + nJ36jdWajx1uHAhDh2+WG21b/csidLMR93f+Xz78GXedbBI2jwn71o+ASAOewt9ipwb1 + PtHDZZRMovn39mxJudC6b4FZBLlZExUfkgeOResHuFofmGGuijnGqqEfGo0BS0qZNupO + dw8QRdmQVqQlxBcl6hZjoznC8YsHBV3uyoYH92fKA3EM//JdIazh7T3WrqjeerlqvIbt + b44iJEwBtEp3tAzmZcjBarD9QX+QVEtTYp7wEnfhYlJmnpY+aRz7T3y9J2RPMQ2SmPPl + RRTQ== +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:from:date + :message-id:mime-version; + bh=GNwpdXSLiM+UxMJnuNc2HuVYsX/c4T7P/N8FhRIZ5Eg=; + b=matW3LSngeSjJpWX0k7yfMnPYrW4aq+cI0n+pLyG1eZrVP2csW4OQufX9+DU8z1swc + Hkx1JbCOrT7cX3zBwDzxKH2cxc6AvFFDyfYU5p4usFYJXooDaQi5AF4cifAscZBe71X2 + SwDm2b/ReI6dZrjPQUkHnb22jlqelPb2B9QETNFEzEKh3MhfDLondiqaD7Y9yU7AjgMO + Gc6gE8LmTkFh3brsRFmr00N43bsc2m+fXf80SHAJA0EdJtWkO3bE89IXMHip1NyWYJwY + hf6Zfw3gcof6HLIgfndQVNjTp+2UvJMiXmD4U8BwmwlZBYJttkOQ5GSLRVqgYWe52Y4X + Gq/w== +X-Gm-Message-State: + AD7BkJKsKv8HxgNdcpjPo1ZpfmHJfQ2tCSMhnoPIIkdW95rWsFwv9AO8mBncO1z4THgj6Q== +X-Received: by 10.28.17.141 with SMTP id 135mr2839440wmr.48.1457371681162; + Mon, 07 Mar 2016 09:28:01 -0800 (PST) +Received: from disaster-area.hh.sledj.net + ([2a01:348:1a2:1:ea39:35ff:fe2c:a227]) + by smtp.gmail.com with ESMTPSA id t3sm19023974wjz.11.2016.03.07.09.27.59 + (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Mon, 07 Mar 2016 09:27:59 -0800 (PST) +Received: from localhost (disaster-area.hh.sledj.net [local]) + by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 3f2f74c1; + Mon, 7 Mar 2016 17:27:58 +0000 (UTC) +To: Jani Nikula , Mark Walters , + notmuch@notmuchmail.org +Subject: Re: [PATCH v6 6/6] emacs/mua: Let user specify which parts get a + header in citations. +In-Reply-To: <87y49uqkc3.fsf@nikula.org> +References: <1455992680-24978-1-git-send-email-markwalters1009@gmail.com> + <1455992680-24978-7-git-send-email-markwalters1009@gmail.com> + <87y49uqkc3.fsf@nikula.org> +From: David Edmondson +Date: Mon, 07 Mar 2016 17:27:58 +0000 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.20 +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: Mon, 07 Mar 2016 17:28:05 -0000 + +On Mon, Mar 07 2016, Jani Nikula wrote: +> On Sat, 20 Feb 2016, Mark Walters wrote: +>> [ text/plain ] +> +> This patch (or, bisected commit d27d90875dfb emacs/mua: Let user specify +> which parts get a header in citations.) causes the above to be added to +> all replies. Why? +> +> I don't understand what "header" the patch is talking about. If it's the +> [ text/plain ] above and it's intentional, *shudder*. Who would want +> that? + +We definitely argued about it ages ago (and Mark pointed out as much in +his introduction to the patch series), but I don't remember which +position I took then :-) + +Seeing it now, I suspect that `notmuch-show-insert-header-p' is a better +default. + +> BR, +> Jani. +> +> +>> From: David Edmondson +>> +>> Add a customizable function specifying which parts get a header when +>> replying, and give some sensible possiblities. These are, +>> +>> 1) all parts except multipart/*. (Subparts of a multipart part do +>> receive a header button.) +>> +>> 2) only included text/* parts. +>> +>> 3) Exactly as in the show buffer. +>> +>> 4) None at all. This means the reply contains a mish-mash of all the +>> original message's parts. +>> +>> In the test suite we set the choice to option 4 to match the +>> previous behaviour. +>> --- +>> emacs/notmuch-mua.el | 19 ++++++++++++++++++- +>> emacs/notmuch-show.el | 10 ++++++++++ +>> test/test-lib.el | 4 ++++ +>> 3 files changed, 32 insertions(+), 1 deletion(-) +>> +>> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el +>> index ecc5bec..fcb3e95 100644 +>> --- a/emacs/notmuch-mua.el +>> +++ b/emacs/notmuch-mua.el +>> @@ -93,6 +93,23 @@ (defcustom notmuch-mua-cite-function 'message-cite-original +>> :link '(custom-manual "(message)Insertion Variables") +>> :group 'notmuch-reply) +>> +>> +(defcustom notmuch-mua-reply-insert-header-p-function +>> + 'notmuch-show-reply-insert-header-p-trimmed +>> + "Function to decide which parts get a header when replying. +>> + +>> +This function specifies which parts of a mime message with +>> +mutiple parts get a header." +>> + :type '(radio (const :tag "All except multipart/* and hidden parts" +>> + notmuch-show-reply-insert-header-p-trimmed) +>> + (const :tag "Only for included text parts" +>> + notmuch-show-reply-insert-header-p-minimal) +>> + (const :tag "Exactly as in show view" +>> + notmuch-show-insert-header-p) +>> + (const :tag "No part headers" +>> + notmuch-show-reply-insert-header-p-never) +>> + (function :tag "Other")) +>> + :group 'notmuch-reply) +>> + +>> ;; +>> +>> (defun notmuch-mua-get-switch-function () +>> @@ -231,7 +248,7 @@ (defun notmuch-mua-reply (query-string &optional sender reply-all) +>> ;; Don't omit long parts. +>> (notmuch-show-max-text-part-size 0) +>> ;; Insert headers for parts as appropriate for replying. +>> - (notmuch-show-insert-header-p-function #'notmuch-show-reply-insert-header-p-never)) +>> + (notmuch-show-insert-header-p-function notmuch-mua-reply-insert-header-p-function)) +>> (notmuch-show-insert-body original (plist-get original :body) 0) +>> (buffer-substring-no-properties (point-min) (point-max))))) +>> +>> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +>> index 2a81ec1..371e62d 100644 +>> --- a/emacs/notmuch-show.el +>> +++ b/emacs/notmuch-show.el +>> @@ -954,6 +954,16 @@ (defun notmuch-show-insert-header-p (part hide) +>> (defun notmuch-show-reply-insert-header-p-never (part hide) +>> nil) +>> +>> +(defun notmuch-show-reply-insert-header-p-trimmed (part hide) +>> + (let ((mime-type (notmuch-show-mime-type part))) +>> + (and (not (notmuch-match-content-type mime-type "multipart/*")) +>> + (not hide)))) +>> + +>> +(defun notmuch-show-reply-insert-header-p-minimal (part hide) +>> + (let ((mime-type (notmuch-show-mime-type part))) +>> + (and (notmuch-match-content-type mime-type "text/*") +>> + (not hide)))) +>> + +>> (defun notmuch-show-insert-bodypart (msg part depth &optional hide) +>> "Insert the body part PART at depth DEPTH in the current thread. +>> +>> diff --git a/test/test-lib.el b/test/test-lib.el +>> index 596a705..02e020c 100644 +>> --- a/test/test-lib.el +>> +++ b/test/test-lib.el +>> @@ -184,6 +184,10 @@ (defmacro notmuch-test-progn (&rest body) +>> (setq notmuch-tag-deleted-formats +>> '((".*" nil))) +>> +>> +;; For historical reasonse we don't print part headers when replying +>> +;; in the tests suite +>> +(setq notmuch-mua-reply-insert-header-p-function 'notmuch-show-reply-insert-header-p-never) +>> + +>> ;; force a common html renderer, to avoid test variations between +>> ;; environments +>> +>> -- +>> 2.1.4 +>> +>> _______________________________________________ +>> notmuch mailing list +>> notmuch@notmuchmail.org +>> https://notmuchmail.org/mailman/listinfo/notmuch +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> https://notmuchmail.org/mailman/listinfo/notmuch