Re: Hi all
[notmuch-archives.git] / b4 / 19f1138a29c17fd72a5e6ded7bc2f2b50333bd
1 Return-Path: <markwalters1009@gmail.com>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5  by arlo.cworth.org (Postfix) with ESMTP id A4B666DE1AE1\r
6  for <notmuch@notmuchmail.org>; Sun, 14 Feb 2016 10:40:28 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.247\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.247 tagged_above=-999 required=5 tests=[AWL=0.323,\r
12   DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13  FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7,\r
14  RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001]\r
15  autolearn=disabled\r
16 Received: from arlo.cworth.org ([127.0.0.1])\r
17  by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
18  with ESMTP id BztGXDzIMMIZ for <notmuch@notmuchmail.org>;\r
19  Sun, 14 Feb 2016 10:40:26 -0800 (PST)\r
20 Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com\r
21  [74.125.82.68]) by arlo.cworth.org (Postfix) with ESMTPS id 4E6446DE10C1 for\r
22  <notmuch@notmuchmail.org>; Sun, 14 Feb 2016 10:40:24 -0800 (PST)\r
23 Received: by mail-wm0-f68.google.com with SMTP id g62so12193406wme.2\r
24  for <notmuch@notmuchmail.org>; Sun, 14 Feb 2016 10:40:24 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
26  h=from:to:cc:subject:date:message-id:in-reply-to:references;\r
27  bh=gR4Pj1W0tfGTQleSCmGyahj2v5hHtQ3Nh6BbHawCCV0=;\r
28  b=yC/ltf/HbW4VQpa+DjPZzGuvKauw0LfUf0tTAexe0lTGmk5YfbrjFX29/CxyXe6zaq\r
29  8aGuxCb8zQGo/IzQrzMvuJx/06iHSnrJ/IjYO5GfnjNsG2rr0PSW3rU/qkIM8spuLLGj\r
30  9p2qCsrO0hRMJzcdULzETEkTqQcI6fuV2mjvIawV3jz0oKaLLsVCd40Iw5hRg81d9ueM\r
31  Boe/wy1w3bg0diIdBVHlsmxZdSJTbB54phIPHrqeYdCHFrru7xhxhQCqQDPgjVZ3ysHz\r
32  HqTXBdcb02xk11IfmrMyWNAeSRGUwMeRCpNBx5BFnOzTGpJLtIXZUhw5+kCRUsDnxHZ+\r
33  S8tA==\r
34 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
35  d=1e100.net; s=20130820;\r
36  h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\r
37  :references;\r
38  bh=gR4Pj1W0tfGTQleSCmGyahj2v5hHtQ3Nh6BbHawCCV0=;\r
39  b=X14xEjzzHmkp/BWvgUrlP6sY5mX7t/GH6DBYmYibCd48sc2RqVMzxg+gH+SZFMnNGB\r
40  /IkeUErE3WjQwl8RnSMAkgH5AHdN3+JFTDUaVKx5HtowsCY9JLHBW8iZG1aVYlP2Pr34\r
41  4acd+BpPsUsoxL9XtK5pSa99j8qoane7nnAf8bxYa89A8Zsu0pUdRZ9J9OW5sJo6fkAr\r
42  WyBZHcYHEqCsdfqnMHQuLDe/KcRY8JfU9tFb9GJUas7BAklYQ0c7jc/6chfqF4OnAHr6\r
43  uVmiLprOlntxAS6dvEp3CAI8yYZYAm1T+Z/Q/rtFlO8QTjY0w8iAT1Ip1spnWnRBzfbH\r
44  Ctpg==\r
45 X-Gm-Message-State:\r
46  AG10YOT6d3U++MNY2ZLyY7bH1UU3cscTfoACu/k2B+FdnWRi6UsnbSPGNEd47p1HuuovTg==\r
47 X-Received: by 10.28.0.86 with SMTP id 83mr9154703wma.63.1455475223066;\r
48  Sun, 14 Feb 2016 10:40:23 -0800 (PST)\r
49 Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162])\r
50  by smtp.gmail.com with ESMTPSA id uo9sm21731546wjc.49.2016.02.14.10.40.22\r
51  (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
52  Sun, 14 Feb 2016 10:40:22 -0800 (PST)\r
53 From: Mark Walters <markwalters1009@gmail.com>\r
54 To: notmuch@notmuchmail.org\r
55 Subject: [PATCH v5 6/7] emacs/mua: Let user specify which parts get a header\r
56  in citations.\r
57 Date: Sun, 14 Feb 2016 18:39:58 +0000\r
58 Message-Id: <1455475199-32622-7-git-send-email-markwalters1009@gmail.com>\r
59 X-Mailer: git-send-email 2.1.4\r
60 In-Reply-To: <1455475199-32622-1-git-send-email-markwalters1009@gmail.com>\r
61 References: <1455475199-32622-1-git-send-email-markwalters1009@gmail.com>\r
62 X-BeenThere: notmuch@notmuchmail.org\r
63 X-Mailman-Version: 2.1.20\r
64 Precedence: list\r
65 List-Id: "Use and development of the notmuch mail system."\r
66  <notmuch.notmuchmail.org>\r
67 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
68  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
69 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
70 List-Post: <mailto:notmuch@notmuchmail.org>\r
71 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
72 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
73  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
74 X-List-Received-Date: Sun, 14 Feb 2016 18:40:28 -0000\r
75 \r
76 From: David Edmondson <dme@dme.org>\r
77 \r
78 Add a customizable function specifying which parts get a header when\r
79 replying, and give some sensible possiblities. These are,\r
80 \r
81 1) all parts except multipart/*. (Subparts of a multipart part do\r
82 receive a header button.)\r
83 \r
84 2) only included text/* parts.\r
85 \r
86 3) Exactly as in the show buffer.\r
87 \r
88 4) None at all. This means the reply contains a mish-mash of all the\r
89 original message's parts.\r
90 ---\r
91  emacs/notmuch-mua.el  | 30 ++++++++++++++++++++++++++----\r
92  emacs/notmuch-show.el | 13 +++++++++++++\r
93  2 files changed, 39 insertions(+), 4 deletions(-)\r
94 \r
95 diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
96 index a386d43..fcb3e95 100644\r
97 --- a/emacs/notmuch-mua.el\r
98 +++ b/emacs/notmuch-mua.el\r
99 @@ -93,6 +93,23 @@ Note that these functions use `mail-citation-hook' if that is non-nil."\r
100    :link '(custom-manual "(message)Insertion Variables")\r
101    :group 'notmuch-reply)\r
102  \r
103 +(defcustom notmuch-mua-reply-insert-header-p-function\r
104 +  'notmuch-show-reply-insert-header-p-trimmed\r
105 +  "Function to decide which parts get a header when replying.\r
106 +\r
107 +This function specifies which parts of a mime message with\r
108 +mutiple parts get a header."\r
109 +  :type '(radio (const :tag "All except multipart/* and hidden parts"\r
110 +                              notmuch-show-reply-insert-header-p-trimmed)\r
111 +               (const :tag "Only for included text parts"\r
112 +                              notmuch-show-reply-insert-header-p-minimal)\r
113 +               (const :tag "Exactly as in show view"\r
114 +                              notmuch-show-insert-header-p)\r
115 +               (const :tag "No part headers"\r
116 +                              notmuch-show-reply-insert-header-p-never)\r
117 +               (function :tag "Other"))\r
118 +  :group 'notmuch-reply)\r
119 +\r
120  ;;\r
121  \r
122  (defun notmuch-mua-get-switch-function ()\r
123 @@ -223,10 +240,15 @@ Note that these functions use `mail-citation-hook' if that is non-nil."\r
124         (insert "Date: " date "\n\n")\r
125  \r
126         (insert (with-temp-buffer\r
127 -                 ;; Don't attempt to clean up messages, excerpt\r
128 -                 ;; citations, etc. in the original message before\r
129 -                 ;; quoting.\r
130 -                 (let ((notmuch-show-insert-text/plain-hook nil))\r
131 +                 (let\r
132 +                     ;; Don't attempt to clean up messages, excerpt\r
133 +                     ;; citations, etc. in the original message before\r
134 +                     ;; quoting.\r
135 +                     ((notmuch-show-insert-text/plain-hook nil)\r
136 +                      ;; Don't omit long parts.\r
137 +                      (notmuch-show-max-text-part-size 0)\r
138 +                      ;; Insert headers for parts as appropriate for replying.\r
139 +                      (notmuch-show-insert-header-p-function notmuch-mua-reply-insert-header-p-function))\r
140                     (notmuch-show-insert-body original (plist-get original :body) 0)\r
141                     (buffer-substring-no-properties (point-min) (point-max)))))\r
142  \r
143 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
144 index 5654d11..ec58cac 100644\r
145 --- a/emacs/notmuch-show.el\r
146 +++ b/emacs/notmuch-show.el\r
147 @@ -957,6 +957,19 @@ this part.")\r
148      (not (and (string= mime-type "text/plain")\r
149               (<= (plist-get part :id) 1)))))\r
150  \r
151 +(defun notmuch-show-reply-insert-header-p-never (part hide)\r
152 +  nil)\r
153 +\r
154 +(defun notmuch-show-reply-insert-header-p-trimmed (part hide)\r
155 +  (let ((mime-type (notmuch-show-mime-type part)))\r
156 +    (and (not (notmuch-match-content-type mime-type "multipart/*"))\r
157 +        (not hide))))\r
158 +\r
159 +(defun notmuch-show-reply-insert-header-p-minimal (part hide)\r
160 +  (let ((mime-type (notmuch-show-mime-type part)))\r
161 +    (and (notmuch-match-content-type mime-type "text/*")\r
162 +        (not hide))))\r
163 +\r
164  (defun notmuch-show-insert-bodypart (msg part depth &optional hide)\r
165    "Insert the body part PART at depth DEPTH in the current thread.\r
166  \r
167 -- \r
168 2.1.4\r
169 \r