1 Return-Path: <amdragon@mit.edu>
\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 D0042431FD0
\r
6 for <notmuch@notmuchmail.org>; Tue, 20 Dec 2011 13:51:47 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\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 wvniBTc9WMoQ for <notmuch@notmuchmail.org>;
\r
16 Tue, 20 Dec 2011 13:51:47 -0800 (PST)
\r
17 Received: from dmz-mailsec-scanner-1.mit.edu (DMZ-MAILSEC-SCANNER-1.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id 22357431FB6
\r
20 for <notmuch@notmuchmail.org>; Tue, 20 Dec 2011 13:51:47 -0800 (PST)
\r
21 X-AuditID: 1209190c-b7fad6d000000920-1d-4ef10370130e
\r
22 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])
\r
23 by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id F6.C1.02336.07301FE4; Tue, 20 Dec 2011 16:51:44 -0500 (EST)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
\r
26 by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id pBKLphAl011602;
\r
27 Tue, 20 Dec 2011 16:51:44 -0500
\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])
\r
29 (authenticated bits=0)
\r
30 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
31 by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id pBKLpfL7021118
\r
32 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
33 Tue, 20 Dec 2011 16:51:42 -0500 (EST)
\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)
\r
35 (envelope-from <amdragon@mit.edu>)
\r
36 id 1Rd7cC-0004yc-2R; Tue, 20 Dec 2011 16:52:52 -0500
\r
37 Date: Tue, 20 Dec 2011 16:52:52 -0500
\r
38 From: Austin Clements <amdragon@MIT.EDU>
\r
39 To: Jani Nikula <jani@nikula.org>
\r
40 Subject: Re: [PATCH] emacs: create patch filename from subject for inline
\r
42 Message-ID: <20111220215229.GF10376@mit.edu>
\r
43 References: <1321657368-13872-1-git-send-email-jani@nikula.org>
\r
44 <87aa6nxb3o.fsf@nikula.org>
\r
46 Content-Type: text/plain; charset=us-ascii
\r
47 Content-Disposition: inline
\r
48 In-Reply-To: <87aa6nxb3o.fsf@nikula.org>
\r
49 User-Agent: Mutt/1.5.21 (2010-09-15)
\r
50 X-Brightmail-Tracker:
\r
51 H4sIAAAAAAAAA+NgFupjleLIzCtJLcpLzFFi42IR4hTV1i1g/uhnsH0bv0XTdGeL6zdnMjsw
\r
52 edy6/5rd49mqW8wBTFFcNimpOZllqUX6dglcGdf/rmEq2ClRMX3BQvYGxg7hLkZODgkBE4lz
\r
53 K9+wQNhiEhfurWfrYuTiEBLYxyixY/EFFghnA6PEjZsH2ECqhAROMkkceCQJkVjCKNFzaRk7
\r
54 SIJFQFXi88oDzCA2m4CGxLb9yxlBbBEBRYnNJ/eD2cwC0hLffjczgdjCAjEST/9NAlvNK6Aj
\r
55 8fDcV2aIBbESlzf+Z4WIC0qcnPmEBaJXS+LGv5dAvRxgc5b/4wAJcwKtOts2AWy8qICKxJST
\r
56 29gmMArNQtI9C0n3LITuBYzMqxhlU3KrdHMTM3OKU5N1i5MT8/JSi3QN9XIzS/RSU0o3MYKD
\r
57 WpJnB+Obg0qHGAU4GJV4eAX3f/ATYk0sK67MPcQoycGkJMrrx/TRT4gvKT+lMiOxOCO+qDQn
\r
58 tfgQowQHs5IIb8wzoHLelMTKqtSifJiUNAeLkjivitY7PyGB9MSS1OzU1ILUIpisDAeHkgTv
\r
59 SZChgkWp6akVaZk5JQhpJg5OkOE8QMOPg9TwFhck5hZnpkPkTzHqcuz9/P0MoxBLXn5eqpQ4
\r
60 7wyQIgGQoozSPLg5sGT0ilEc6C1h3qMgVTzARAY36RXQEiagJducQT4oLklESEk1MK51EWpV
\r
61 3X7AOkzMdFOKwj69t1yzXae+OyJ6PeqCjJTDHLGPwTft2l53eU7pCNr/yvVEaILRqztem1JK
\r
62 rnVvnvLMa4a8byULb+vP21dOWhhJ8d/8d7tc4aq69/L5Z+9GH3bTSCj++7gmkf1MuHaKzJ4w
\r
63 gVn71Tu9957g6Ynj38j3yuBL51+rLCWW4oxEQy3mouJEACuZATEhAwAA
\r
64 Cc: notmuch@notmuchmail.org
\r
65 X-BeenThere: notmuch@notmuchmail.org
\r
66 X-Mailman-Version: 2.1.13
\r
68 List-Id: "Use and development of the notmuch mail system."
\r
69 <notmuch.notmuchmail.org>
\r
70 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
71 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
72 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
73 List-Post: <mailto:notmuch@notmuchmail.org>
\r
74 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
75 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
76 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
77 X-List-Received-Date: Tue, 20 Dec 2011 21:51:47 -0000
\r
79 Seems like a definite improvement, but perhaps a let* instead of all
\r
82 Quoth Jani Nikula on Dec 20 at 10:05 pm:
\r
84 > Shameless promotion of own patches... I suppose not many use the
\r
85 > notmuch-wash-convert-inline-patch-to-part option, but with this patch
\r
86 > I've actually started to like it better. An actual patch name from
\r
87 > subject instead of "inline patch".
\r
89 > As I said, the lisp is less than perfect here, but this is still better
\r
90 > than what's existing.
\r
99 > On Sat, 19 Nov 2011 01:02:48 +0200, Jani Nikula <jani@nikula.org> wrote:
\r
100 > > Use the mail subject line for creating a descriptive filename for the wash
\r
101 > > generated inline patch fake parts. The names are similar to the ones
\r
102 > > created by 'git format-patch', just without the leading numbers.
\r
104 > > Signed-off-by: Jani Nikula <jani@nikula.org>
\r
108 > > I know notmuch-subject-to-patch-filename is totally un-lispy. Suggestions
\r
109 > > welcome on how to make it lispy and keep it somewhat readable.
\r
111 > > If we later want to have a '>' counterpart to '|' to save messages to files
\r
112 > > rather than pipe, then this could be generalized and re-used for creating
\r
113 > > the suggested filename for that.
\r
115 > > I don't even use the notmuch-wash-convert-inline-patch-to-part option that
\r
116 > > much, but having it suggest "inline patch" as filename is just ugly...
\r
118 > > emacs/notmuch-wash.el | 16 +++++++++++++++-
\r
119 > > 1 files changed, 15 insertions(+), 1 deletions(-)
\r
121 > > diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el
\r
122 > > index 1f420b2..755d64a 100644
\r
123 > > --- a/emacs/notmuch-wash.el
\r
124 > > +++ b/emacs/notmuch-wash.el
\r
125 > > @@ -290,6 +290,17 @@ When doing so, maintaining citation leaders in the wrapped text."
\r
127 > > (defvar diff-file-header-re) ; From `diff-mode.el'.
\r
129 > > +(defun notmuch-subject-to-patch-filename (str)
\r
130 > > + "Convert a typical patch mail subject line into a suitable filename."
\r
131 > > + (let ((s str))
\r
132 > > + (setq s (replace-regexp-in-string "^ *\\(\\[[^]]*\\]\\)? *" "" s))
\r
133 > > + (setq s (replace-regexp-in-string "[. ]*$" "" s))
\r
134 > > + (setq s (replace-regexp-in-string "[^A-Za-z0-9._-]+" "-" s))
\r
135 > > + (setq s (replace-regexp-in-string "\\.+" "." s))
\r
136 > > + (when (> (length s) 52)
\r
137 > > + (setq s (substring s 0 52)))
\r
138 > > + (concat s ".patch")))
\r
140 > > (defun notmuch-wash-convert-inline-patch-to-part (msg depth)
\r
141 > > "Convert an inline patch into a fake 'text/x-diff' attachment.
\r
143 > > @@ -316,7 +327,10 @@ for error."
\r
144 > > (setq part (plist-put part :content-type "text/x-diff"))
\r
145 > > (setq part (plist-put part :content (buffer-string)))
\r
146 > > (setq part (plist-put part :id -1))
\r
147 > > - (setq part (plist-put part :filename "inline patch"))
\r
148 > > + (setq part (plist-put part :filename
\r
149 > > + (notmuch-subject-to-patch-filename
\r
151 > > + (plist-get msg :headers) :Subject))))
\r
152 > > (delete-region (point-min) (point-max))
\r
153 > > (notmuch-show-insert-bodypart nil part depth))))))
\r