[PATCH 1/5] open_reply: fallback to use addr.local if addr.name is nil
Kirill A. Shutemov
kirill at shutemov.name
Mon Jan 28 07:52:16 PST 2013
From: "Kirill A. Shutemov" <kirill at shutemov.name>
If address doesn't contain name we end up with " wrote:" as a reply
header. It doesn't look nice.
Let's use addr.local + "@" if name is not defined. If addr.local is not
defined too, let's just use "somebody".
Signed-off-by: Kirill A. Shutemov <kirill at shutemov.name>
---
notmuch-ruby.vim | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/notmuch-ruby.vim b/notmuch-ruby.vim
index 761c87f..d8a9878 100644
--- a/notmuch-ruby.vim
+++ b/notmuch-ruby.vim
@@ -492,7 +492,11 @@ ruby << EOF
lines << ''
body_lines = []
- body_lines << "%s wrote:" % Mail::Address.new(orig[:from].value).name
+ addr = Mail::Address.new(orig[:from].value)
+ name = addr.name
+ name = addr.local + "@" if name.nil? && !addr.local.nil?
+ name = "somebody" if name.nil?
+ body_lines << "%s wrote:" % name
part = orig.find_first_text
part.convert.each_line do |l|
body_lines << "> %s" % l.chomp
--
1.7.10.4
More information about the notmuch
mailing list