Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / b9 / 3c2b160e5de15cc642f5f351ad5335b33a30c2
1 Return-Path: <jani@nikula.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 olra.theworths.org (Postfix) with ESMTP id BB1BC431FD0\r
6         for <notmuch@notmuchmail.org>; Mon, 26 Dec 2011 13:52:29 -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: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id v9GPeJLABIIf for <notmuch@notmuchmail.org>;\r
16         Mon, 26 Dec 2011 13:52:29 -0800 (PST)\r
17 Received: from mail-ee0-f53.google.com (mail-ee0-f53.google.com\r
18  [74.125.83.53])        (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
19  certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
20  C273D431FB6    for <notmuch@notmuchmail.org>; Mon, 26 Dec 2011 13:52:28 -0800\r
21  (PST)\r
22 Received: by eekd41 with SMTP id d41so13637008eek.26\r
23         for <notmuch@notmuchmail.org>; Mon, 26 Dec 2011 13:52:27 -0800 (PST)\r
24 Received: by 10.14.51.136 with SMTP id b8mr10278450eec.65.1324936347187;\r
25         Mon, 26 Dec 2011 13:52:27 -0800 (PST)\r
26 Received: from localhost (dsl-hkibrasgw4-fe5cdc00-23.dhcp.inet.fi.\r
27         [80.220.92.23])\r
28         by mx.google.com with ESMTPS id t1sm97489975eeb.3.2011.12.26.13.52.24\r
29         (version=SSLv3 cipher=OTHER); Mon, 26 Dec 2011 13:52:25 -0800 (PST)\r
30 From: Jani Nikula <jani@nikula.org>\r
31 To: Jameson Graef Rollins <jrollins@finestructure.net>,\r
32         David Edmondson <dme@dme.org>, notmuch@notmuchmail.org\r
33 Subject: Re: [PATCH v2 1/2] emacs: create patch filename from subject for\r
34         inline patch fake parts\r
35 In-Reply-To: <8739c7jcfo.fsf@servo.finestructure.net>\r
36 References: <1321657368-13872-1-git-send-email-jani@nikula.org>\r
37         <cover.1324849534.git.jani@nikula.org>\r
38         <aa55383e8609a2e0d376744ff3e982fd072c58d6.1324849534.git.jani@nikula.org>\r
39         <cun62h3tu51.fsf@hotblack-desiato.hh.sledj.net>\r
40         <87wr9ja5bp.fsf@nikula.org>\r
41         <8739c7jcfo.fsf@servo.finestructure.net>\r
42 User-Agent: Notmuch/0.10.2+131~gb184771 (http://notmuchmail.org) Emacs/23.3.1\r
43         (i686-pc-linux-gnu)\r
44 Date: Mon, 26 Dec 2011 23:52:23 +0200\r
45 Message-ID: <87mxafq9uw.fsf@nikula.org>\r
46 MIME-Version: 1.0\r
47 Content-Type: text/plain; charset=us-ascii\r
48 X-BeenThere: notmuch@notmuchmail.org\r
49 X-Mailman-Version: 2.1.13\r
50 Precedence: list\r
51 List-Id: "Use and development of the notmuch mail system."\r
52         <notmuch.notmuchmail.org>\r
53 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
54         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
55 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
56 List-Post: <mailto:notmuch@notmuchmail.org>\r
57 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
58 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
59         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
60 X-List-Received-Date: Mon, 26 Dec 2011 21:52:29 -0000\r
61 \r
62 On Mon, 26 Dec 2011 12:38:35 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:\r
63 > On Mon, 26 Dec 2011 14:24:42 +0200, Jani Nikula <jani@nikula.org> wrote:\r
64 > > > Clicking on the button for the part saves the wrong thing, though,\r
65 > > > because it's not a real MIME part. That looks a bit awkward to fix, so\r
66 > > > perhaps you could still prefix the name with "inline: " to indicate that\r
67 > > > it's odd?\r
68 > > \r
69 > > I'm not sure I follow you here. Could you elaborate what you mean by\r
70 > > "the wrong thing", please?\r
71\r
72 > Yes, this is a problem/bug with the current behavior of these fake\r
73 > inline parts, actually.  The button should behave as those it is\r
74 > representing an actual MIME part of the message.  However, clicking the\r
75 > button saves the entire part that the fake part is derived from, rather\r
76 > than just the data in the fake part.  This is countereintuitive and\r
77 > confusing.\r
78 \r
79 Okay, thanks for the explanation. This might be beyond my elisp\r
80 skills. And IMHO out of the scope of the patch anyway.\r
81 \r
82 > > I don't think the user would want to have an "inline: " prefix in the\r
83 > > filename that would have to be removed every time. I think that kind of\r
84 > > defeats the purpose here. Or where exactly are you proposing to have the\r
85 > > prefix?\r
86\r
87 > It's confusing to have this fake part button look just like a real part\r
88 > button, without any indication that it's really a fake part, and then to\r
89 > behave differently as well.  The button needs some indication that it\r
90 > does not represent a real mime part of the message.  Giving the fake\r
91 > part a proper filename is fine, but it needs some other indicator that\r
92 > the part is fake and that the button is not going to behave as expected.\r
93 \r
94 Below is an idea I came up with, utilizing the content-type\r
95 vs. declared-type distinction. I think it's really simple and neat, but\r
96 I hope not too magical.\r
97 \r
98 Picking up an example mail from the list, inline patches would show up\r
99 like this:\r
100 \r
101 [ 0001-emacs-unify-search-mechanisms.patch: inline patch (as text/x-diff) ]\r
102 \r
103 \r
104 BR,\r
105 Jani.\r
106 \r
107 \r
108 >From b1847714f7368247fbc5c93767f59d8269eadc1c Mon Sep 17 00:00:00 2001\r
109 From: Jani Nikula <jani@nikula.org>\r
110 Date: Mon, 26 Dec 2011 23:31:41 +0200\r
111 Subject: [PATCH] emacs: add inline patch fake parts through a special handler\r
112 \r
113 Add wash generated inline patch fake parts through a special\r
114 "inline-patch-fake-part" handler to distinguish them from real MIME\r
115 parts. The fake parts are described as "inline patch (as text/x-diff)".\r
116 \r
117 Signed-off-by: Jani Nikula <jani@nikula.org>\r
118 ---\r
119  emacs/notmuch-show.el |    4 ++++\r
120  emacs/notmuch-wash.el |    2 +-\r
121  2 files changed, 5 insertions(+), 1 deletions(-)\r
122 \r
123 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
124 index eee4da9..6ef3f90 100644\r
125 --- a/emacs/notmuch-show.el\r
126 +++ b/emacs/notmuch-show.el\r
127 @@ -585,6 +585,10 @@ current buffer, if possible."\r
128                 nil))\r
129           nil))))\r
130  \r
131 +;; Handler for wash generated inline patch fake parts.\r
132 +(defun notmuch-show-insert-part-inline-patch-fake-part (msg part content-type nth depth declared-type)\r
133 +  (notmuch-show-insert-part-*/* msg part "text/x-diff" nth depth "inline patch"))\r
134 +\r
135  (defun notmuch-show-insert-part-*/* (msg part content-type nth depth declared-type)\r
136    ;; This handler _must_ succeed - it is the handler of last resort.\r
137    (notmuch-show-insert-part-header nth content-type declared-type (plist-get part :filename))\r
138 diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el\r
139 index 7d037f5..de51c88 100644\r
140 --- a/emacs/notmuch-wash.el\r
141 +++ b/emacs/notmuch-wash.el\r
142 @@ -351,7 +351,7 @@ for error."\r
143               (setq patch-end (match-beginning 0)))\r
144           (save-restriction\r
145             (narrow-to-region patch-start patch-end)\r
146 -           (setq part (plist-put part :content-type "text/x-diff"))\r
147 +           (setq part (plist-put part :content-type "inline-patch-fake-part"))\r
148             (setq part (plist-put part :content (buffer-string)))\r
149             (setq part (plist-put part :id -1))\r
150             (setq part (plist-put part :filename\r
151 -- \r
152 1.7.5.4\r
153 \r