Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 24 / faa7a340a3e09bcaef0f956d7c559052334a5b
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 1653A6DE199D\r
6  for <notmuch@notmuchmail.org>; Sat,  7 Nov 2015 03:05:07 -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.204\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.204 tagged_above=-999 required=5 tests=[AWL=0.074, \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,\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 4A70BRKMDcnx for <notmuch@notmuchmail.org>;\r
19  Sat,  7 Nov 2015 03:05:05 -0800 (PST)\r
20 Received: from mail-wm0-f51.google.com (mail-wm0-f51.google.com\r
21  [74.125.82.51]) by arlo.cworth.org (Postfix) with ESMTPS id 2CC116DE170E for\r
22  <notmuch@notmuchmail.org>; Sat,  7 Nov 2015 03:04:55 -0800 (PST)\r
23 Received: by wmnn186 with SMTP id n186so60910668wmn.1\r
24  for <notmuch@notmuchmail.org>; Sat, 07 Nov 2015 03:04:53 -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=3y7zFNfOMVRgGPwSbevgO8BJ5NGj7loC6K7g8sSjHvk=;\r
28  b=LABkj75eUmjTN2K5FnXOxjwXvWlyNkfJ2oy36WGtTV/8O0Kd6o30/X/4s7AKeb2kj7\r
29  f9xTzB/axmvnKSLaojsNR58h8aHPqjqb4PhkVW/m2wflV/GQbnjZF7XpLs0HPamKKojr\r
30  Eg3FyKf0Zh3/T67bJPBNFsX9RnaV58aUf2KH4Lclxqg/iNPCyff1B93Eu2H2t0diadkT\r
31  Kh608wXLD0zIUi+NCdsb4jsSKCXQb6a12JmUvVxi1bTz1bFywtX4u12sHolfXXBRereY\r
32  UHCjnHdFEm26UEX5qVclvr6Oq3iR3Bu3qobD70mJnKGVT4ZsUBUBrDxd8ZI/Tm9SvIyW\r
33  vsJQ==\r
34 X-Received: by 10.28.143.1 with SMTP id r1mr15972715wmd.80.1446894293740;\r
35  Sat, 07 Nov 2015 03:04:53 -0800 (PST)\r
36 Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162])\r
37  by smtp.gmail.com with ESMTPSA id 186sm3443760wmp.10.2015.11.07.03.04.52\r
38  (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
39  Sat, 07 Nov 2015 03:04:52 -0800 (PST)\r
40 From: Mark Walters <markwalters1009@gmail.com>\r
41 To: notmuch@notmuchmail.org\r
42 Subject: [PATCH v4 6/7] emacs/mua: Let user specify which parts get a header\r
43  in citations.\r
44 Date: Sat,  7 Nov 2015 11:04:35 +0000\r
45 Message-Id: <1446894276-7814-7-git-send-email-markwalters1009@gmail.com>\r
46 X-Mailer: git-send-email 2.1.4\r
47 In-Reply-To: <1446894276-7814-1-git-send-email-markwalters1009@gmail.com>\r
48 References: <1446894276-7814-1-git-send-email-markwalters1009@gmail.com>\r
49 X-BeenThere: notmuch@notmuchmail.org\r
50 X-Mailman-Version: 2.1.20\r
51 Precedence: list\r
52 List-Id: "Use and development of the notmuch mail system."\r
53  <notmuch.notmuchmail.org>\r
54 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
55  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
56 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
57 List-Post: <mailto:notmuch@notmuchmail.org>\r
58 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
59 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
60  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
61 X-List-Received-Date: Sat, 07 Nov 2015 11:05:07 -0000\r
62 \r
63 From: David Edmondson <dme@dme.org>\r
64 \r
65 Add a customizable function specifying which parts get a header when\r
66 replying, and give some sensible possiblities. These are,\r
67 \r
68 1) all parts except multipart/*. (Subparts of a multipart part do\r
69 receive a header button.)\r
70 \r
71 2) only included text/* parts.\r
72 \r
73 3) Exactly as in the show buffer.\r
74 \r
75 4) None at all. This means the reply contains a mish-mash of all the\r
76 original message's parts.\r
77 ---\r
78  emacs/notmuch-mua.el  | 30 ++++++++++++++++++++++++++----\r
79  emacs/notmuch-show.el | 13 +++++++++++++\r
80  2 files changed, 39 insertions(+), 4 deletions(-)\r
81 \r
82 diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
83 index 2f7abb0..a675f47 100644\r
84 --- a/emacs/notmuch-mua.el\r
85 +++ b/emacs/notmuch-mua.el\r
86 @@ -91,6 +91,23 @@ (defcustom notmuch-mua-cite-function 'message-cite-original\r
87    :link '(custom-manual "(message)Insertion Variables")\r
88    :group 'notmuch-reply)\r
89  \r
90 +(defcustom notmuch-mua-reply-insert-header-p-function\r
91 +  'notmuch-show-reply-insert-header-p-trimmed\r
92 +  "Function to decide which parts get a header when replying.\r
93 +\r
94 +This function specifies which parts of a mime message with\r
95 +mutiple parts get a header."\r
96 +  :type '(radio (const :tag "All except multipart/* and hidden parts"\r
97 +                              notmuch-show-reply-insert-header-p-trimmed)\r
98 +               (const :tag "Only for included text parts"\r
99 +                              notmuch-show-reply-insert-header-p-minimal)\r
100 +               (const :tag "Exactly as in show view"\r
101 +                              notmuch-show-insert-header-p)\r
102 +               (const :tag "No part headers"\r
103 +                              notmuch-show-reply-insert-header-p-never)\r
104 +               (function :tag "Other"))\r
105 +  :group 'notmuch-reply)\r
106 +\r
107  ;;\r
108  \r
109  (defun notmuch-mua-get-switch-function ()\r
110 @@ -221,10 +238,15 @@ (defun notmuch-mua-reply (query-string &optional sender reply-all)\r
111         (insert "Date: " date "\n\n")\r
112  \r
113         (insert (with-temp-buffer\r
114 -                 ;; Don't attempt to clean up messages, excerpt\r
115 -                 ;; citations, etc. in the original message before\r
116 -                 ;; quoting.\r
117 -                 (let ((notmuch-show-insert-text/plain-hook nil))\r
118 +                 (let\r
119 +                     ;; Don't attempt to clean up messages, excerpt\r
120 +                     ;; citations, etc. in the original message before\r
121 +                     ;; quoting.\r
122 +                     ((notmuch-show-insert-text/plain-hook nil)\r
123 +                      ;; Don't omit long parts.\r
124 +                      (notmuch-show-max-text-part-size 0)\r
125 +                      ;; Insert headers for parts as appropriate for replying.\r
126 +                      (notmuch-show-insert-header-p-function notmuch-mua-reply-insert-header-p-function))\r
127                     (notmuch-show-insert-body original (plist-get original :body) 0)\r
128                     (buffer-substring-no-properties (point-min) (point-max)))))\r
129  \r
130 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
131 index f4a65cc..7ff9ed5 100644\r
132 --- a/emacs/notmuch-show.el\r
133 +++ b/emacs/notmuch-show.el\r
134 @@ -959,6 +959,19 @@ (defun notmuch-show-insert-header-p (part hide)\r
135      (not (and (string= mime-type "text/plain")\r
136               (<= (plist-get part :id) 1)))))\r
137  \r
138 +(defun notmuch-show-reply-insert-header-p-never (part hide)\r
139 +  nil)\r
140 +\r
141 +(defun notmuch-show-reply-insert-header-p-trimmed (part hide)\r
142 +  (let ((mime-type (notmuch-show-mime-type part)))\r
143 +    (and (not (notmuch-match-content-type mime-type "multipart/*"))\r
144 +        (not hide))))\r
145 +\r
146 +(defun notmuch-show-reply-insert-header-p-minimal (part hide)\r
147 +  (let ((mime-type (notmuch-show-mime-type part)))\r
148 +    (and (notmuch-match-content-type mime-type "text/*")\r
149 +        (not hide))))\r
150 +\r
151  (defun notmuch-show-insert-bodypart (msg part depth &optional hide)\r
152    "Insert the body part PART at depth DEPTH in the current thread.\r
153  \r
154 -- \r
155 2.1.4\r
156 \r