1 Return-Path: <felipe.contreras@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 5556B431FAF
\r
6 for <notmuch@notmuchmail.org>; Sat, 2 Nov 2013 07:03:52 -0700 (PDT)
\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 R7WjF3S+pRCg for <notmuch@notmuchmail.org>;
\r
17 Sat, 2 Nov 2013 07:03:47 -0700 (PDT)
\r
18 Received: from mail-oa0-f47.google.com (mail-oa0-f47.google.com
\r
19 [209.85.219.47]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id D5947429E2F
\r
22 for <notmuch@notmuchmail.org>; Sat, 2 Nov 2013 07:03:09 -0700 (PDT)
\r
23 Received: by mail-oa0-f47.google.com with SMTP id i1so5600758oag.20
\r
24 for <notmuch@notmuchmail.org>; Sat, 02 Nov 2013 07:03:09 -0700 (PDT)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
26 h=from:to:cc:subject:date:message-id:in-reply-to:references;
\r
27 bh=nUfpfnyEzVAgubSTNofFIM/3EdIsp9KtsuFNEDp4SOU=;
\r
28 b=sAK5o+tEj6oraTSBusDpfG79PUgRF2gy9sKwR3hCq4Wb6vuiUMMrBOtJKzzW19ELFB
\r
29 6Y67tvu8nRYuT/AkWUk9uLCejZUQBOtFVKgOc/XNhQYxSjjnUzfYqwm85mCvHZHdmgf6
\r
30 Wbq+gOWQgkhBxvJ0eGDcRL3MQICIrEVGNyuyjoX7Vz+Q9TPwqCPa0Hk+mZ86zmgOlzgi
\r
31 wdADofOfZHPpincZRhsEw49LCCIBd5jvJf+dkE3Jgp9dLu3gpq7fm64tLYemI2vm9Pme
\r
32 H2OAb6BbkZjK7yJB7mHviC6hrAl7XqB4Sehw6XITONZQJaj+9EVOgd03ZMD+EHNMc1eI
\r
34 X-Received: by 10.60.116.230 with SMTP id jz6mr6619934oeb.21.1383400989318;
\r
35 Sat, 02 Nov 2013 07:03:09 -0700 (PDT)
\r
36 Received: from localhost (187-162-140-241.static.axtel.net. [187.162.140.241])
\r
37 by mx.google.com with ESMTPSA id
\r
38 ru3sm19958939obc.2.2013.11.02.07.03.07 for <multiple recipients>
\r
39 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
\r
40 Sat, 02 Nov 2013 07:03:08 -0700 (PDT)
\r
41 From: Felipe Contreras <felipe.contreras@gmail.com>
\r
42 To: notmuch@notmuchmail.org
\r
43 Subject: [PATCH 13/21] vim: refactor open_reply()
\r
44 Date: Sat, 2 Nov 2013 07:55:46 -0600
\r
45 Message-Id: <1383400554-1832-14-git-send-email-felipe.contreras@gmail.com>
\r
46 X-Mailer: git-send-email 1.8.4.2+fc1
\r
47 In-Reply-To: <1383400554-1832-1-git-send-email-felipe.contreras@gmail.com>
\r
48 References: <1383400554-1832-1-git-send-email-felipe.contreras@gmail.com>
\r
49 X-BeenThere: notmuch@notmuchmail.org
\r
50 X-Mailman-Version: 2.1.13
\r
52 List-Id: "Use and development of the notmuch mail system."
\r
53 <notmuch.notmuchmail.org>
\r
54 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
55 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
56 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
57 List-Post: <mailto:notmuch@notmuchmail.org>
\r
58 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
59 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
60 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
61 X-List-Received-Date: Sat, 02 Nov 2013 14:03:52 -0000
\r
63 In preparation for composing new messages.
\r
65 Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
\r
67 vim/notmuch.vim | 92 ++++++++++++++++++++++++++++++---------------------------
\r
68 1 file changed, 49 insertions(+), 43 deletions(-)
\r
70 diff --git a/vim/notmuch.vim b/vim/notmuch.vim
\r
71 index 9a45300..8383fd6 100644
\r
72 --- a/vim/notmuch.vim
\r
73 +++ b/vim/notmuch.vim
\r
74 @@ -504,12 +504,37 @@ ruby << EOF
\r
75 return "<#{random_tag}@#{Socket.gethostname}.notmuch>"
\r
78 - def open_reply(orig)
\r
79 + def open_compose_helper(lines, cur)
\r
81 'Notmuch-Help: Type in your message here; to help you use these bindings:',
\r
82 'Notmuch-Help: ,s - send the message (Notmuch-Help lines will be removed)',
\r
83 'Notmuch-Help: ,q - abort the message',
\r
86 + dir = File.expand_path('~/.notmuch/compose')
\r
87 + FileUtils.mkdir_p(dir)
\r
88 + Tempfile.open(['nm-', '.mail'], dir) do |f|
\r
89 + f.puts(help_lines)
\r
93 + sig_file = File.expand_path('~/.signature')
\r
94 + if File.exists?(sig_file)
\r
96 + f.write(File.read(sig_file))
\r
101 + cur += help_lines.size + 1
\r
103 + VIM::command("let s:reply_from='%s'" % $email_address)
\r
104 + VIM::command("call s:new_file_buffer('compose', '#{f.path}')")
\r
105 + VIM::command("call cursor(#{cur}, 0)")
\r
109 + def open_reply(orig)
\r
110 reply = orig.reply do |m|
\r
112 if not m[:reply_to]
\r
113 @@ -522,54 +547,35 @@ ruby << EOF
\r
114 m.content_transfer_encoding = '7bit'
\r
117 - dir = File.expand_path('~/.notmuch/compose')
\r
118 - FileUtils.mkdir_p(dir)
\r
119 - Tempfile.open(['nm-', '.mail'], dir) do |f|
\r
122 - lines += help_lines
\r
126 - if $mail_installed
\r
127 - addr = Mail::Address.new(orig[:from].value)
\r
129 - name = addr.local + "@" if name.nil? && !addr.local.nil?
\r
131 - name = orig[:from]
\r
133 - name = "somebody" if name.nil?
\r
135 - body_lines << "%s wrote:" % name
\r
136 - part = orig.find_first_text
\r
137 - part.convert.each_line do |l|
\r
138 - body_lines << "> %s" % l.chomp
\r
144 - reply.body = body_lines.join("\n")
\r
147 - lines += reply.to_s.lines.map { |e| e.chomp }
\r
150 + if $mail_installed
\r
151 + addr = Mail::Address.new(orig[:from].value)
\r
153 + name = addr.local + "@" if name.nil? && !addr.local.nil?
\r
155 + name = orig[:from]
\r
157 + name = "somebody" if name.nil?
\r
159 - old_count = lines.count - 1
\r
160 + body_lines << "%s wrote:" % name
\r
161 + part = orig.find_first_text
\r
162 + part.convert.each_line do |l|
\r
163 + body_lines << "> %s" % l.chomp
\r
170 + reply.body = body_lines.join("\n")
\r
172 - sig_file = File.expand_path('~/.signature')
\r
173 - if File.exists?(sig_file)
\r
175 - f.write(File.read(sig_file))
\r
177 + lines += reply.to_s.lines.map { |e| e.chomp }
\r
181 + cur = lines.count - 1
\r
183 - VIM::command("let s:reply_from='%s'" % $email_address)
\r
184 - VIM::command("call s:new_file_buffer('compose', '#{f.path}')")
\r
185 - VIM::command("call cursor(#{old_count}, 0)")
\r
187 + open_compose_helper(lines, cur)
\r
190 def folders_render()
\r