]> git.notmuchmail.org Git - notmuch/commitdiff
vim: parse 'from' address
authorFelipe Contreras <felipe.contreras@gmail.com>
Sun, 6 Feb 2011 12:53:58 +0000 (14:53 +0200)
committerFelipe Contreras <felipe.contreras@gmail.com>
Wed, 4 May 2011 20:38:38 +0000 (23:38 +0300)
In order to pass it to sendmail.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
vim/plugin/notmuch.vim

index 6b82abedbfe2b9a655021bd6e7d99735f25356fa..98ddb00ec46aa6b676c9254c958eb9394fc09f57 100644 (file)
@@ -962,7 +962,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