Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 25 / e7d0a2f4abdc7cdceb56a5c8598770235ac5c7
1 Return-Path: <m.walters@qmul.ac.uk>\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 olra.theworths.org (Postfix) with ESMTP id 145D7431FBD\r
6         for <notmuch@notmuchmail.org>; Mon,  3 Feb 2014 00:07:19 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -1.098\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
12         tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
13         NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id 9sv9sIFC--O3 for <notmuch@notmuchmail.org>;\r
17         Mon,  3 Feb 2014 00:07:11 -0800 (PST)\r
18 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
19         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id D68DE431FBC\r
22         for <notmuch@notmuchmail.org>; Mon,  3 Feb 2014 00:07:10 -0800 (PST)\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
24         by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
25         (envelope-from <m.walters@qmul.ac.uk>)\r
26         id 1WAEYO-0002cM-U3; Mon, 03 Feb 2014 08:07:06 +0000\r
27 Received: from 94.196.253.24.threembb.co.uk ([94.196.253.24] helo=localhost)\r
28         by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
29         (envelope-from <m.walters@qmul.ac.uk>)\r
30         id 1WAEXT-0002wC-FF; Mon, 03 Feb 2014 08:05:57 +0000\r
31 From: Mark Walters <markwalters1009@gmail.com>\r
32 To: "W. Trevor King" <wking@tremily.us>, notmuch@notmuchmail.org\r
33 Subject: Re: [RFC] Content-Description when naming MIME parts in Emacs mode\r
34 In-Reply-To: <20140202204616.GD14197@odin.tremily.us>\r
35 References: <20140202204616.GD14197@odin.tremily.us>\r
36 User-Agent: Notmuch/0.15.2+484~gfb59956 (http://notmuchmail.org) Emacs/23.4.1\r
37         (x86_64-pc-linux-gnu)\r
38 Date: Mon, 03 Feb 2014 08:04:21 +0000\r
39 Message-ID: <877g9chbay.fsf@qmul.ac.uk>\r
40 MIME-Version: 1.0\r
41 Content-Type: text/plain; charset=utf-8\r
42 Content-Transfer-Encoding: quoted-printable\r
43 X-Sender-Host-Address: 94.196.253.24\r
44 X-QM-Geographic: According to ripencc,\r
45         this message was delivered by a machine in Britain (UK) (GB).\r
46 X-QM-SPAM-Info: Sender has good ham record.  :)\r
47 X-QM-Body-MD5: 83111c8d7eb1a4e51711a209d5baf09a (of first 20000 bytes)\r
48 X-SpamAssassin-Score: 0.0\r
49 X-SpamAssassin-SpamBar: /\r
50 X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
51         determine if it is\r
52         spam. We require at least 5.0 points to mark a message as spam.\r
53         This message scored 0.0 points. Summary of the scoring: \r
54         * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
55         provider *      (markwalters1009[at]gmail.com)\r
56 X-QM-Scan-Virus: ClamAV says the message is clean\r
57 X-BeenThere: notmuch@notmuchmail.org\r
58 X-Mailman-Version: 2.1.13\r
59 Precedence: list\r
60 List-Id: "Use and development of the notmuch mail system."\r
61         <notmuch.notmuchmail.org>\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
63         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
65 List-Post: <mailto:notmuch@notmuchmail.org>\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
68         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
69 X-List-Received-Date: Mon, 03 Feb 2014 08:07:19 -0000\r
70 \r
71 On Sun, 02 Feb 2014, "W. Trevor King" <wking@tremily.us> wrote:\r
72 > On the rss2email list, Victor Orlikowski pointed out [1] that a number\r
73 > of MUAs don't use the Subject header of attached message/rfc822 parts\r
74 > to label multipart/digest subparts [2].  Instead, notmuch and several\r
75 > other MUAs use the filename parameter [3] as a content hint [4].\r
76 > Using the filename parameter seems more sane than diving into the\r
77 > message/rfc822 part header, but that's still not what the filename\r
78 > parameter was designed for.  It makes more sense to me to use the\r
79 > message/rfc822 part's Content-Description header [5,6], falling back\r
80 > on the filename parameter if Content-Description isn't set.\r
81 >\r
82 > It's pretty easy to patch notmuch-show-insert-bodypart to do this:\r
83 >\r
84 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
85 > index 1ac80ca..485c7d1 100644\r
86 > --- a/emacs/notmuch-show.el\r
87 > +++ b/emacs/notmuch-show.el\r
88 > @@ -874,13 +874,16 @@ useful for quoting in replies)."\r
89 >                          content-type))\r
90 >           (nth (plist-get part :id))\r
91 >           (beg (point))\r
92 > +         (name (if (plist-get part :content-description)\r
93 > +                   (plist-get part :content-description)\r
94 > +                   (plist-get part :filename)))\r
95 >           ;; Hide the part initially if HIDE is t.\r
96 >           (show-part (not (equal hide t)))\r
97 >           ;; We omit the part button for the first (or only) part if\r
98 >           ;; this is text/plain, or HIDE is 'no-buttons.\r
99 >           (button (unless (or (equal hide 'no-buttons)\r
100 >                               (and (string=3D mime-type "text/plain") (<=\r
101 =3D nth 1)))\r
102 > -                   (notmuch-show-insert-part-header nth mime-type conten=\r
103 t-type (plist-get part :filename))))\r
104 > +                   (notmuch-show-insert-part-header nth mime-type conten=\r
105 t-type name)))\r
106 >           (content-beg (point)))\r
107 >=20=20\r
108 >      ;; Store the computed mime-type for later use (e.g. by attachment ha=\r
109 ndlers).\r
110 >\r
111 > But that doesn't work, because :content-description doesn't exist in\r
112 > the part plist.  I've looked through the source for a bit and can't\r
113 > figure out where that part plist is coming from.  Is it loaded from\r
114 > notmuch output in notmuch-show-build-buffer?  I assume that\r
115 > information comes from the index, in which case I'd need to tweak\r
116 > _index_mime_part in lib/index.cc to add the description.  Indexing\r
117 > descriptions seems like a generally useful thing, even outside of my\r
118 > digest usecase (e.g. search image/jpeg attachements with =E2=80=9Cgenome=\r
119 =E2=80=9D in\r
120 > their description [6]).  However, adding a field to the schema is more\r
121 > invasive than changing the Emacs mode's attachment formatting; I\r
122 > thought I should check in here for feedback and advice before wading\r
123 > in with my =E2=80=94a=CC=B6x=CC=B6e=CC=B6=E2=80=94 scalpel ;).\r
124 \r
125 I think notmuch-show.c gets most of the header and related information\r
126 directly from the mail file not from the database directly. I think we\r
127 use gmime for that parsing so adding an extra output pair for\r
128 content-description there should be sufficient. (This is lines 655-700\r
129 or so notmuch-show.c)\r
130 \r
131 I think the emacs side should be roughly as above: we would need to\r
132 check that the default filename offered when saving is still\r
133 correct. Stylistically I think=20\r
134 +         (name (or (plist-get part :content-description)\r
135 +                   (plist-get part :filename)))\r
136 \r
137 is a little nicer.\r
138 \r
139 I think that the above all looks like a sensible change to notmuch so I\r
140 would expect something like the above to be acceptable in mainline (but\r
141 obviously that is not my call!)\r
142 \r
143 Best wishes\r
144 \r
145 Mark\r
146 \r
147 >\r
148 > Thoughs?\r
149 > Trevor\r
150 >\r
151 > [1]: http://article.gmane.org/gmane.mail.rss2email/211\r
152 > [2]: Digests: http://tools.ietf.org/html/rfc2046#section-5.1.5\r
153 > [3]: Filename: http://tools.ietf.org/search/rfc2183#section-2.3\r
154 > [4]: Filename hint to notmuch-show-insert-part-header:\r
155 >      http://git.notmuchmail.org/git/notmuch/blob/HEAD:/emacs/notmuch-show=\r
156 .el#l883\r
157 > [5]: Content-Desciption:\r
158 >      http://tools.ietf.org/html/rfc2045#section-8\r
159 > [6]: Content-Description examples:\r
160 >      http://tools.ietf.org/html/rfc2183#section-3\r
161 >\r
162 > --=20\r
163 > This email may be signed or encrypted with GnuPG (http://www.gnupg.org).\r
164 > For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy\r
165 > _______________________________________________\r
166 > notmuch mailing list\r
167 > notmuch@notmuchmail.org\r
168 > http://notmuchmail.org/mailman/listinfo/notmuch\r