unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: notmuch@notmuchmail.org
Subject: [PATCH 2/2] vim: parse 'from' address
Date: Sun,  6 Feb 2011 15:29:07 +0200	[thread overview]
Message-ID: <1296998947-13683-3-git-send-email-felipe.contreras@gmail.com> (raw)
In-Reply-To: <1296998947-13683-1-git-send-email-felipe.contreras@gmail.com>

In order to pass it to sendmail.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 vim/plugin/notmuch.vim |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim
index 002b771..08832cc 100644
--- a/vim/plugin/notmuch.vim
+++ b/vim/plugin/notmuch.vim
@@ -961,7 +961,16 @@ function! s:NM_compose_send()
         exec printf(':0,%dd', hdr_starts)
         write
 
-        let cmdtxt = g:notmuch_sendmail . ' -t < ' . fname
+        let line = getline(1)
+        let m = matchlist(line, '^From:\s*\(.*\)\s*<\(.*\)>$')
+        if (len(m) >= 2)
+                let from = m[2]
+        else
+                let m = matchlist(line, '^From:\s*\(.*\)$')
+                let from = m[1]
+        endif
+
+        let cmdtxt = g:notmuch_sendmail . ' -t -f ' . from . ' < ' . fname
         let out = system(cmdtxt)
         let err = v:shell_error
         if err
-- 
1.7.4.1.g4f7e4.dirty

      parent reply	other threads:[~2011-02-06 13:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-06 13:29 [PATCH 0/2] vim: improvements for sendmail Felipe Contreras
2011-02-06 13:29 ` [PATCH 1/2] vim: use sendmail directly Felipe Contreras
2011-02-06 13:29 ` Felipe Contreras [this message]

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=1296998947-13683-3-git-send-email-felipe.contreras@gmail.com \
    --to=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).