X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=vim%2Fplugin%2Fnotmuch.vim;h=98ddb00ec46aa6b676c9254c958eb9394fc09f57;hb=5659d422315ebd46f80db739e28a58b51590b64f;hp=3375a96c4bc4cfeeb582a3cad768db57ff77488e;hpb=ac9b9cf56a05f626dfa2c91e3c522df32565af70;p=notmuch
diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim
index 3375a96c..98ddb00e 100644
--- a/vim/plugin/notmuch.vim
+++ b/vim/plugin/notmuch.vim
@@ -18,12 +18,14 @@
" along with Notmuch. If not, see .
"
" Authors: Bart Trojanowski
-" Contributors: Peter Hartman
+" Contributors: Felipe Contreras ,
+" Peter Hartman
"
" --- configuration defaults {{{1
let s:notmuch_defaults = {
\ 'g:notmuch_cmd': 'notmuch' ,
+ \ 'g:notmuch_sendmail': 'sendmail' ,
\ 'g:notmuch_debug': 0 ,
\
\ 'g:notmuch_search_newest_first': 1 ,
@@ -948,18 +950,28 @@ function! s:NM_compose_send()
let line = getline(lnum)
let lst_hdr = ''
while match(line, '^$') == -1
- if match(line, '^Notmuch-Help:') == -1
+ if !exists("hdr_starts") && match(line, '^Notmuch-Help:') == -1
let hdr_starts = lnum - 1
- break
endif
let lnum = lnum + 1
let line = getline(lnum)
endwhile
+ let body_starts = lnum - 1
+ call append(body_starts, 'Date: ' . strftime('%a, %d %b %Y %H:%M:%S %z'))
exec printf(':0,%dd', hdr_starts)
write
- let cmdtxt = 'mailx -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