From: Jani Nikula Date: Mon, 7 Mar 2016 19:16:01 +0000 (+0200) 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=9cb88d69b3a48a227018081e8ec768dcc209669d;p=notmuch-archives.git Re: [PATCH v6 6/6] emacs/mua: Let user specify which parts get a header in citations. --- diff --git a/66/e7cc2fa20b130713a25a997de20793e60826f2 b/66/e7cc2fa20b130713a25a997de20793e60826f2 new file mode 100644 index 000000000..03dde2e57 --- /dev/null +++ b/66/e7cc2fa20b130713a25a997de20793e60826f2 @@ -0,0 +1,226 @@ +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 00BDB6DE177E + for ; Mon, 7 Mar 2016 11:17:09 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.554 +X-Spam-Level: +X-Spam-Status: No, score=-0.554 tagged_above=-999 required=5 tests=[AWL=0.166, + 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] 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 OuRxEZclb3m7 for ; + Mon, 7 Mar 2016 11:17:06 -0800 (PST) +Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com + [74.125.82.67]) by arlo.cworth.org (Postfix) with ESMTPS id 257936DE176A for + ; Mon, 7 Mar 2016 11:17:06 -0800 (PST) +Received: by mail-wm0-f67.google.com with SMTP id 1so12481338wmg.2 + for ; Mon, 07 Mar 2016 11:17:06 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=nikula-org.20150623.gappssmtp.com; s=20150623; + h=from:to:subject:in-reply-to:references:user-agent:date:message-id + :mime-version; bh=cpR0y2ylHbM8t5j3BxKw/RNL/Iq1ZQTyeKZ8GmGR4cg=; + b=0+Yx1nlRVU5gZ5qHXAnmDW7nEgS0qJgKSVDTNuaVm0/Iqip17ADVvqkMNYO77px1Bm + CprONktmXXpCkD3qXJpLj68xpN0nWqgyxB0R/OzmyDnHYaWDX+GcnudHH91L6wcb4owR + f/bMeEgGAXOiy0Bs7gfOLMjUe0G9BLxLxDkJqBK5/6QlYi+qqgCWY91xuHcBpms5Z27q + ye8xiHbTBD+cATLV/KUMcCOM+Kbef8MYJeJTES+r/5D76+2CuNAn2NbeMhkAwwATU2OR + tiQavnk9k+580ZQto0ijvlnx+5M7W2b/PNzT695ZTWA36ZEnxd+Wu08Y+mAxVgwa+cy2 + IjiA== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:from:to:subject:in-reply-to:references + :user-agent:date:message-id:mime-version; + bh=cpR0y2ylHbM8t5j3BxKw/RNL/Iq1ZQTyeKZ8GmGR4cg=; + b=WY3JWC02KvmRq1/utS5US9bqn8CKiv+sOhLEQFsJ0ZJlFotUYOeychLoiAfq2uYmuY + FvGQ9hriks6zN8n07ZoQ7fNhJAnGtUkmBZW/Wzt0IdGx/3fkIxtB5VhbJTRw5TFeheWi + ZlPr4DR/nh5/L5tECN3f5W5uORriW5/bNO/uzPdo0bX+8cui2HEf+36x6WwGIWdx+0IG + mvawfa3XRglPoJucUaf3svWMZuq4QkL4ydjTX5IFMRMXVsC+XnMb3hSzVqNKVX0wwtjH + t0EANEAPnc7pHiE5FKg6KzPki6obqs0C3+QUe2VUtQiLkaAaLI2vecRpaGy4nUwvzCh3 + NKWQ== +X-Gm-Message-State: + AD7BkJLHlF3jRJb0nIy0tr19MHTOQCjeebAub8GpSYU+UB7PYcARZ9YAAtfzJguNs9wGFg== +X-Received: by 10.194.191.199 with SMTP id ha7mr24602900wjc.128.1457378224891; + Mon, 07 Mar 2016 11:17:04 -0800 (PST) +Received: from localhost (mobile-access-bcee39-255.dhcp.inet.fi. + [188.238.57.255]) + by smtp.gmail.com with ESMTPSA id gk4sm19399733wjd.7.2016.03.07.11.17.03 + (version=TLSv1/SSLv3 cipher=OTHER); + Mon, 07 Mar 2016 11:17:03 -0800 (PST) +From: Jani Nikula +To: David Edmondson , 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: +References: <1455992680-24978-1-git-send-email-markwalters1009@gmail.com> + <1455992680-24978-7-git-send-email-markwalters1009@gmail.com> + <87y49uqkc3.fsf@nikula.org> +User-Agent: Notmuch/0.21+73~gf8cc320 (http://notmuchmail.org) Emacs/24.4.1 + (x86_64-pc-linux-gnu) +Date: Mon, 07 Mar 2016 21:16:01 +0200 +Message-ID: <8760wy5cb2.fsf@nikula.org> +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 19:17:09 -0000 + +On Mon, 07 Mar 2016, David Edmondson wrote: +> 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. + +I'm not sure. Replying to a message with multipart/alternative and +hidden parts and attachments leads to quite a mess, to be honest (which, +I presume, is the reason for the current default). + +I'll set it to no part headers, but I might find an option to insert +part headers for parts with "content-disposition: attachment" +interesting. Either that, or the current default plus no headers for +single part messages. + +BR, +Jani. + + +> +>> 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