unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: notmuch@notmuchmail.org
Subject: [PATCH 1/5] open_reply: fallback to use addr.local if addr.name is nil
Date: Mon, 28 Jan 2013 17:52:16 +0200	[thread overview]
Message-ID: <1359388340-27136-2-git-send-email-kirill@shutemov.name> (raw)
In-Reply-To: <1359388340-27136-1-git-send-email-kirill@shutemov.name>

From: "Kirill A. Shutemov" <kirill@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@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

  reply	other threads:[~2013-01-28 15:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-28 15:52 [PATCH 0/5] Random patches for notmuch-vim-ruby Kirill A. Shutemov
2013-01-28 15:52 ` Kirill A. Shutemov [this message]
2013-04-02 19:31   ` [PATCH 1/5] open_reply: fallback to use addr.local if addr.name is nil Felipe Contreras
2013-01-28 15:52 ` [PATCH 2/5] rename g:notmuch_sendmail -> g:notmuch_rb_sendmail Kirill A. Shutemov
2013-04-02 19:21   ` Felipe Contreras
2013-01-28 15:52 ` [PATCH 3/5] /usr/sbin/sendmail as a default g:notmuch_rb_sendmail Kirill A. Shutemov
2013-04-02 19:33   ` Felipe Contreras
2013-01-28 15:52 ` [PATCH 4/5] Introduce g:notmuch_rb_folders_count_threads Kirill A. Shutemov
2013-04-02 19:39   ` Felipe Contreras
2013-01-28 15:52 ` [PATCH 5/5] Drop harmful reply buffer preparation Kirill A. Shutemov
2013-04-02 19:46   ` Felipe Contreras
2013-01-28 18:09 ` [PATCH 0/5] Random patches for notmuch-vim-ruby David Bremner
2013-04-02 19:52 ` Felipe Contreras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1359388340-27136-2-git-send-email-kirill@shutemov.name \
    --to=kirill@shutemov.name \
    --cc=felipe.contreras@gmail.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).