Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / b0 / 17a2b20670ca8341f2259c47b3eb0f12c0d1db
1 Return-Path: <dme@dme.org>\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 E34C06DE1765\r
6  for <notmuch@notmuchmail.org>; Tue,  9 Feb 2016 12:34:21 -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.091\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.091 tagged_above=-999 required=5\r
12  tests=[AWL=-0.024, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,\r
13  RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01,\r
14  RCVD_IN_MSPIKE_WL=-0.01, SPF_NEUTRAL=0.652, UNPARSEABLE_RELAY=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 h0PXWBRcJT_i for <notmuch@notmuchmail.org>;\r
19  Tue,  9 Feb 2016 12:34:19 -0800 (PST)\r
20 Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com\r
21  [74.125.82.65]) by arlo.cworth.org (Postfix) with ESMTPS id 7D6266DE01D3 for\r
22  <notmuch@notmuchmail.org>; Tue,  9 Feb 2016 12:34:19 -0800 (PST)\r
23 Received: by mail-wm0-f65.google.com with SMTP id g62so2573wme.2\r
24  for <notmuch@notmuchmail.org>; Tue, 09 Feb 2016 12:34:19 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
26  d=dme-org.20150623.gappssmtp.com; s=20150623;\r
27  h=to:subject:in-reply-to:references:from:date:message-id:mime-version\r
28  :content-type; bh=7X00I8Jju9Q7iaCL8m0I5lcpruVckpPINYXojOe+okg=;\r
29  b=xbwKS4DZ9hwtf9rGnl2IBrWgZ1PhJieLcLt7fZ0b3a4eLS7gUIp2SUlSY26UxB2bmQ\r
30  S3wHh7Caoa5iPN9jYwlNud7WWg/F2KWp+swib6hLCecReiaxe19G7iRO6ZKKO7/LvJ0m\r
31  FLHdwm3SyB+sXV4je2d8WTVdE3IzRn6li7HJuok8iU7YdKXRu3HFNBYumnZG6SJMgoem\r
32  dTP+5vtNE7CRtPzHVz9fJMN3o7UFB43VQ8NPcFVXEC6E0cTbkUnNvzSIpmTk5ZF0Am8w\r
33  nwc9vaGZfz2+vmLa8YLhbbFJvohIyyWO2pUit70lPIcJjn7Wy4orKDwTry8/t+Ot5iS/\r
34  9Ueg==\r
35 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
36  d=1e100.net; s=20130820;\r
37  h=x-gm-message-state:to:subject:in-reply-to:references:from:date\r
38  :message-id:mime-version:content-type;\r
39  bh=7X00I8Jju9Q7iaCL8m0I5lcpruVckpPINYXojOe+okg=;\r
40  b=eyIzx698p5NMWCUMCC9m1C6yjbCzAWwFiA1iw31S6+ulF4q8ZU6XMz8Civ1RG3NbUF\r
41  LB8NE7aad/aUTNy+jxqUJwnpM8tBzg5jomW3QvTLK3WHTq97vHn3FupmZHh1bCKZndi0\r
42  2ux2QNZxY9JZv8VAME1r7BcMVV7gFL06GEbQP7t1hLCFD8EVhMsW3X9N+NWbRTKzowvj\r
43  lGxe5KhCKJ17++35xNhpw5XD+VcbtW4VMcR70XMusw01WHdEtzaUlJ8epjIPFlHjFRG7\r
44  rseC36AXoi1h6dUyPE4fOgTB9A10LBT4zhiseAyV1UaXYKN/Ge7y2gfY+Fl9llTXyJRA\r
45  T75w==\r
46 X-Gm-Message-State:\r
47  AG10YOQMt3j8QHZUIxAX42YUiRNDkkOSe8GybpLzaKiP65Z61LP/tsWvTwTSerauodX5kQ==\r
48 X-Received: by 10.28.174.72 with SMTP id x69mr6828563wme.68.1455050058217;\r
49  Tue, 09 Feb 2016 12:34:18 -0800 (PST)\r
50 Received: from disaster-area.hh.sledj.net\r
51  ([2a01:348:1a2:1:ea39:35ff:fe2c:a227])\r
52  by smtp.gmail.com with ESMTPSA id w8sm36318414wjx.21.2016.02.09.12.34.16\r
53  (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
54  Tue, 09 Feb 2016 12:34:16 -0800 (PST)\r
55 Received: from localhost (disaster-area.hh.sledj.net [local])\r
56  by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 05b79c16;\r
57  Tue, 9 Feb 2016 20:34:16 +0000 (UTC)\r
58 To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
59 Subject: Re: [PATCH v4 6/7] emacs/mua: Let user specify which parts get a\r
60  header in citations.\r
61 In-Reply-To: <1446894276-7814-7-git-send-email-markwalters1009@gmail.com>\r
62 References: <1446894276-7814-1-git-send-email-markwalters1009@gmail.com>\r
63  <1446894276-7814-7-git-send-email-markwalters1009@gmail.com>\r
64 From: David Edmondson <dme@dme.org>\r
65 Date: Tue, 09 Feb 2016 20:34:16 +0000\r
66 Message-ID: <m2ziv939o7.fsf@dme.org>\r
67 MIME-Version: 1.0\r
68 Content-Type: text/plain\r
69 X-BeenThere: notmuch@notmuchmail.org\r
70 X-Mailman-Version: 2.1.20\r
71 Precedence: list\r
72 List-Id: "Use and development of the notmuch mail system."\r
73  <notmuch.notmuchmail.org>\r
74 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
75  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
76 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
77 List-Post: <mailto:notmuch@notmuchmail.org>\r
78 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
79 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
80  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
81 X-List-Received-Date: Tue, 09 Feb 2016 20:34:22 -0000\r
82 \r
83 On Sat, Nov 07 2015, Mark Walters wrote:\r
84 > From: David Edmondson <dme@dme.org>\r
85 >\r
86 > Add a customizable function specifying which parts get a header when\r
87 > replying, and give some sensible possiblities. These are,\r
88 >\r
89 > 1) all parts except multipart/*. (Subparts of a multipart part do\r
90 > receive a header button.)\r
91 >\r
92 > 2) only included text/* parts.\r
93 >\r
94 > 3) Exactly as in the show buffer.\r
95 >\r
96 > 4) None at all. This means the reply contains a mish-mash of all the\r
97 > original message's parts.\r
98 > ---\r
99 >  emacs/notmuch-mua.el  | 30 ++++++++++++++++++++++++++----\r
100 >  emacs/notmuch-show.el | 13 +++++++++++++\r
101 >  2 files changed, 39 insertions(+), 4 deletions(-)\r
102 >\r
103 > diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
104 > index 2f7abb0..a675f47 100644\r
105 > --- a/emacs/notmuch-mua.el\r
106 > +++ b/emacs/notmuch-mua.el\r
107 > @@ -91,6 +91,23 @@ (defcustom notmuch-mua-cite-function 'message-cite-original\r
108 >    :link '(custom-manual "(message)Insertion Variables")\r
109 >    :group 'notmuch-reply)\r
110 >  \r
111 > +(defcustom notmuch-mua-reply-insert-header-p-function\r
112 > +  'notmuch-show-reply-insert-header-p-trimmed\r
113 > +  "Function to decide which parts get a header when replying.\r
114 > +\r
115 > +This function specifies which parts of a mime message with\r
116 > +mutiple parts get a header."\r
117 > +  :type '(radio (const :tag "All except multipart/* and hidden parts"\r
118 > +                            notmuch-show-reply-insert-header-p-trimmed)\r
119 > +             (const :tag "Only for included text parts"\r
120 > +                            notmuch-show-reply-insert-header-p-minimal)\r
121 > +             (const :tag "Exactly as in show view"\r
122 > +                            notmuch-show-insert-header-p)\r
123 > +             (const :tag "No part headers"\r
124 > +                            notmuch-show-reply-insert-header-p-never)\r
125 > +             (function :tag "Other"))\r
126 > +  :group 'notmuch-reply)\r
127 > +\r
128 \r
129 These are all functions - should we be `declare-function'ing them, given\r
130 that they come from elsewhere? Presumably the compiler is not clever\r
131 enough to complain if we don't.\r
132 \r
133 >  ;;\r
134 >  \r
135 >  (defun notmuch-mua-get-switch-function ()\r
136 > @@ -221,10 +238,15 @@ (defun notmuch-mua-reply (query-string &optional sender reply-all)\r
137 >       (insert "Date: " date "\n\n")\r
138 >  \r
139 >       (insert (with-temp-buffer\r
140 > -               ;; Don't attempt to clean up messages, excerpt\r
141 > -               ;; citations, etc. in the original message before\r
142 > -               ;; quoting.\r
143 > -               (let ((notmuch-show-insert-text/plain-hook nil))\r
144 > +               (let\r
145 > +                   ;; Don't attempt to clean up messages, excerpt\r
146 > +                   ;; citations, etc. in the original message before\r
147 > +                   ;; quoting.\r
148 > +                   ((notmuch-show-insert-text/plain-hook nil)\r
149 > +                    ;; Don't omit long parts.\r
150 > +                    (notmuch-show-max-text-part-size 0)\r
151 > +                    ;; Insert headers for parts as appropriate for replying.\r
152 > +                    (notmuch-show-insert-header-p-function notmuch-mua-reply-insert-header-p-function))\r
153 >                   (notmuch-show-insert-body original (plist-get original :body) 0)\r
154 >                   (buffer-substring-no-properties (point-min) (point-max)))))\r
155 >  \r
156 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
157 > index f4a65cc..7ff9ed5 100644\r
158 > --- a/emacs/notmuch-show.el\r
159 > +++ b/emacs/notmuch-show.el\r
160 > @@ -959,6 +959,19 @@ (defun notmuch-show-insert-header-p (part hide)\r
161 >      (not (and (string= mime-type "text/plain")\r
162 >             (<= (plist-get part :id) 1)))))\r
163 >  \r
164 > +(defun notmuch-show-reply-insert-header-p-never (part hide)\r
165 > +  nil)\r
166 > +\r
167 > +(defun notmuch-show-reply-insert-header-p-trimmed (part hide)\r
168 > +  (let ((mime-type (notmuch-show-mime-type part)))\r
169 > +    (and (not (notmuch-match-content-type mime-type "multipart/*"))\r
170 > +      (not hide))))\r
171 > +\r
172 > +(defun notmuch-show-reply-insert-header-p-minimal (part hide)\r
173 > +  (let ((mime-type (notmuch-show-mime-type part)))\r
174 > +    (and (notmuch-match-content-type mime-type "text/*")\r
175 > +      (not hide))))\r
176 > +\r
177 >  (defun notmuch-show-insert-bodypart (msg part depth &optional hide)\r
178 >    "Insert the body part PART at depth DEPTH in the current thread.\r
179 >  \r
180 > -- \r
181 > 2.1.4\r