1 Return-Path: <dmitry.kurochkin@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 olra.theworths.org (Postfix) with ESMTP id 5F7E8431FD0
\r
6 for <notmuch@notmuchmail.org>; Tue, 20 Dec 2011 12:12:41 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 i-dQgYbxgF1q for <notmuch@notmuchmail.org>;
\r
17 Tue, 20 Dec 2011 12:12:40 -0800 (PST)
\r
18 Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com
\r
19 [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client
\r
20 certificate requested) by olra.theworths.org (Postfix) with ESMTPS id
\r
21 806D8431FB6 for <notmuch@notmuchmail.org>; Tue, 20 Dec 2011 12:12:40 -0800
\r
23 Received: by wgbds13 with SMTP id ds13so10716678wgb.2
\r
24 for <notmuch@notmuchmail.org>; Tue, 20 Dec 2011 12:12:38 -0800 (PST)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
\r
26 h=from:to:subject:in-reply-to:references:user-agent:date:message-id
\r
27 :mime-version:content-type;
\r
28 bh=w2ja/q75YtfiMa9tA7kS1sQ+BIEdiFmcRTFIN9xVYi8=;
\r
29 b=FBuBy1P5Iab6MjjqAdt8q/EeZsTYmFDCsIWWJimdUmF5N8xG1tf/09jE4Dp18CxL/+
\r
30 uLm+42/kBd5w1P1bQhnnVgbuC8lrm4QFYffE4TsyweOIZnCoy1E1yzvPVSsqvhWkz3RL
\r
31 69pMN40binN3dNf1m5uymzoRmEhzp8SdWPIXQ=
\r
32 Received: by 10.216.134.162 with SMTP id s34mr1923598wei.59.1324411958903;
\r
33 Tue, 20 Dec 2011 12:12:38 -0800 (PST)
\r
34 Received: from localhost ([91.144.186.21])
\r
35 by mx.google.com with ESMTPS id n9sm3253664wbo.16.2011.12.20.12.12.37
\r
36 (version=TLSv1/SSLv3 cipher=OTHER);
\r
37 Tue, 20 Dec 2011 12:12:38 -0800 (PST)
\r
38 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
\r
39 To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org
\r
40 Subject: Re: [PATCH] emacs: create patch filename from subject for inline
\r
42 In-Reply-To: <87aa6nxb3o.fsf@nikula.org>
\r
43 References: <1321657368-13872-1-git-send-email-jani@nikula.org>
\r
44 <87aa6nxb3o.fsf@nikula.org>
\r
45 User-Agent: Notmuch/0.10.2+96~g74e5ae5 (http://notmuchmail.org) Emacs/23.3.1
\r
46 (x86_64-pc-linux-gnu)
\r
47 Date: Wed, 21 Dec 2011 00:11:55 +0400
\r
48 Message-ID: <87mxanvw8k.fsf@gmail.com>
\r
50 Content-Type: text/plain; charset=us-ascii
\r
51 X-BeenThere: notmuch@notmuchmail.org
\r
52 X-Mailman-Version: 2.1.13
\r
54 List-Id: "Use and development of the notmuch mail system."
\r
55 <notmuch.notmuchmail.org>
\r
56 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
57 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
58 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
59 List-Post: <mailto:notmuch@notmuchmail.org>
\r
60 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
61 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
62 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
63 X-List-Received-Date: Tue, 20 Dec 2011 20:12:41 -0000
\r
67 On Tue, 20 Dec 2011 22:05:31 +0200, Jani Nikula <jani@nikula.org> wrote:
\r
69 > Shameless promotion of own patches... I suppose not many use the
\r
70 > notmuch-wash-convert-inline-patch-to-part option, but with this patch
\r
71 > I've actually started to like it better. An actual patch name from
\r
72 > subject instead of "inline patch".
\r
74 > As I said, the lisp is less than perfect here, but this is still better
\r
75 > than what's existing.
\r
80 I do not use the option but the patch sounds useful to me. I would try
\r
83 I think a simple test would be useful here BTW.
\r
93 > On Sat, 19 Nov 2011 01:02:48 +0200, Jani Nikula <jani@nikula.org> wrote:
\r
94 > > Use the mail subject line for creating a descriptive filename for the wash
\r
95 > > generated inline patch fake parts. The names are similar to the ones
\r
96 > > created by 'git format-patch', just without the leading numbers.
\r
98 > > Signed-off-by: Jani Nikula <jani@nikula.org>
\r
102 > > I know notmuch-subject-to-patch-filename is totally un-lispy. Suggestions
\r
103 > > welcome on how to make it lispy and keep it somewhat readable.
\r
105 > > If we later want to have a '>' counterpart to '|' to save messages to files
\r
106 > > rather than pipe, then this could be generalized and re-used for creating
\r
107 > > the suggested filename for that.
\r
109 > > I don't even use the notmuch-wash-convert-inline-patch-to-part option that
\r
110 > > much, but having it suggest "inline patch" as filename is just ugly...
\r
112 > > emacs/notmuch-wash.el | 16 +++++++++++++++-
\r
113 > > 1 files changed, 15 insertions(+), 1 deletions(-)
\r
115 > > diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el
\r
116 > > index 1f420b2..755d64a 100644
\r
117 > > --- a/emacs/notmuch-wash.el
\r
118 > > +++ b/emacs/notmuch-wash.el
\r
119 > > @@ -290,6 +290,17 @@ When doing so, maintaining citation leaders in the wrapped text."
\r
121 > > (defvar diff-file-header-re) ; From `diff-mode.el'.
\r
123 > > +(defun notmuch-subject-to-patch-filename (str)
\r
124 > > + "Convert a typical patch mail subject line into a suitable filename."
\r
125 > > + (let ((s str))
\r
126 > > + (setq s (replace-regexp-in-string "^ *\\(\\[[^]]*\\]\\)? *" "" s))
\r
127 > > + (setq s (replace-regexp-in-string "[. ]*$" "" s))
\r
128 > > + (setq s (replace-regexp-in-string "[^A-Za-z0-9._-]+" "-" s))
\r
129 > > + (setq s (replace-regexp-in-string "\\.+" "." s))
\r
130 > > + (when (> (length s) 52)
\r
131 > > + (setq s (substring s 0 52)))
\r
132 > > + (concat s ".patch")))
\r
134 > > (defun notmuch-wash-convert-inline-patch-to-part (msg depth)
\r
135 > > "Convert an inline patch into a fake 'text/x-diff' attachment.
\r
137 > > @@ -316,7 +327,10 @@ for error."
\r
138 > > (setq part (plist-put part :content-type "text/x-diff"))
\r
139 > > (setq part (plist-put part :content (buffer-string)))
\r
140 > > (setq part (plist-put part :id -1))
\r
141 > > - (setq part (plist-put part :filename "inline patch"))
\r
142 > > + (setq part (plist-put part :filename
\r
143 > > + (notmuch-subject-to-patch-filename
\r
145 > > + (plist-get msg :headers) :Subject))))
\r
146 > > (delete-region (point-min) (point-max))
\r
147 > > (notmuch-show-insert-bodypart nil part depth))))))
\r
152 > _______________________________________________
\r
153 > notmuch mailing list
\r
154 > notmuch@notmuchmail.org
\r
155 > http://notmuchmail.org/mailman/listinfo/notmuch
\r