Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / bb / ab682f79b046dfa713ecdf7f4286413095e29e
1 Return-Path: <kas@shutemov.name>\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 D00F1431FAF\r
6         for <notmuch@notmuchmail.org>; Mon, 28 Jan 2013 07:57:08 -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\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         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 iSOU33VkFZT4 for <notmuch@notmuchmail.org>;\r
16         Mon, 28 Jan 2013 07:57:08 -0800 (PST)\r
17 X-Greylist: delayed 380 seconds by postgrey-1.32 at olra;\r
18         Mon, 28 Jan 2013 07:57:08 PST\r
19 Received: from shutemov.name (shutemov.name [204.155.152.216])\r
20         by olra.theworths.org (Postfix) with ESMTP id 1E6C0431FAE\r
21         for <notmuch@notmuchmail.org>; Mon, 28 Jan 2013 07:57:08 -0800 (PST)\r
22 Received: by shutemov.name (Postfix, from userid 1000)\r
23         id 23CD0333D9; Mon, 28 Jan 2013 17:52:25 +0200 (EET)\r
24 From: "Kirill A. Shutemov" <kirill@shutemov.name>\r
25 To: Felipe Contreras <felipe.contreras@gmail.com>\r
26 Subject: [PATCH 1/5] open_reply: fallback to use addr.local if addr.name is\r
27  nil\r
28 Date: Mon, 28 Jan 2013 17:52:16 +0200\r
29 Message-Id: <1359388340-27136-2-git-send-email-kirill@shutemov.name>\r
30 X-Mailer: git-send-email 1.7.10.4\r
31 In-Reply-To: <1359388340-27136-1-git-send-email-kirill@shutemov.name>\r
32 References: <1359388340-27136-1-git-send-email-kirill@shutemov.name>\r
33 Cc: notmuch@notmuchmail.org\r
34 X-BeenThere: notmuch@notmuchmail.org\r
35 X-Mailman-Version: 2.1.13\r
36 Precedence: list\r
37 List-Id: "Use and development of the notmuch mail system."\r
38         <notmuch.notmuchmail.org>\r
39 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
40         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
41 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
42 List-Post: <mailto:notmuch@notmuchmail.org>\r
43 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
44 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
45         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
46 X-List-Received-Date: Mon, 28 Jan 2013 15:57:09 -0000\r
47 \r
48 From: "Kirill A. Shutemov" <kirill@shutemov.name>\r
49 \r
50 If address doesn't contain name we end up with " wrote:" as a reply\r
51 header. It doesn't look nice.\r
52 \r
53 Let's use addr.local + "@" if name is not defined. If addr.local is not\r
54 defined too, let's just use "somebody".\r
55 \r
56 Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>\r
57 ---\r
58  notmuch-ruby.vim |    6 +++++-\r
59  1 file changed, 5 insertions(+), 1 deletion(-)\r
60 \r
61 diff --git a/notmuch-ruby.vim b/notmuch-ruby.vim\r
62 index 761c87f..d8a9878 100644\r
63 --- a/notmuch-ruby.vim\r
64 +++ b/notmuch-ruby.vim\r
65 @@ -492,7 +492,11 @@ ruby << EOF\r
66                         lines << ''\r
67  \r
68                         body_lines = []\r
69 -                       body_lines << "%s wrote:" % Mail::Address.new(orig[:from].value).name\r
70 +                       addr = Mail::Address.new(orig[:from].value)\r
71 +                       name = addr.name\r
72 +                       name = addr.local + "@" if name.nil? && !addr.local.nil?\r
73 +                       name = "somebody" if name.nil?\r
74 +                       body_lines << "%s wrote:" % name\r
75                         part = orig.find_first_text\r
76                         part.convert.each_line do |l|\r
77                                 body_lines << "> %s" % l.chomp\r
78 -- \r
79 1.7.10.4\r
80 \r