Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 2632640AB4A for ; Sat, 5 Jun 2010 04:13:58 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.999 X-Spam-Level: X-Spam-Status: No, score=-1.999 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UfnbxJkQRLTt for ; Sat, 5 Jun 2010 04:13:47 -0700 (PDT) Received: from mail-fx0-f53.google.com (mail-fx0-f53.google.com [209.85.161.53]) by olra.theworths.org (Postfix) with ESMTP id A77AD417339 for ; Sat, 5 Jun 2010 04:13:06 -0700 (PDT) Received: by mail-fx0-f53.google.com with SMTP id 4so284086fxm.26 for ; Sat, 05 Jun 2010 04:13:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=Fqd/SA3Wt4NndYdiyfkpKNXQkOUmI/r520HlnKRpbfU=; b=mtfzm74bFklRno7ZerhiGG21/xdl+0a+aijCkxTXD4+wNXNl5wL5jkuzJUKkuC8h4y NSmAA58OjsWtE5w42IJfZa7E2ynYiKJtuQd7D0ZKc7oj/FrRlQOzaeaYkQna5J/x1MDA TQYY5Z2TOv0+9hnJPPUcB6052F7EHRhEg+ca0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=AWyG9SjS7FfkaSyALZYHfSnTpoKYYWrBpFZdIBWe6v2fq+pNEeMBsw0DHeh4f5p9qA z+/48AusKdgw83BhR9RnDtISIeuUa8OTIPj1o3EUh3pu+n+dSx6X2spob496pg2UI5eF iv84+Rh4L7OmAttOqHIf5d7/ClNd6Mt9RatFo= Received: by 10.204.151.78 with SMTP id b14mr4815886bkw.200.1275736386303; Sat, 05 Jun 2010 04:13:06 -0700 (PDT) Received: from localhost (a91-153-253-80.elisa-laajakaista.fi [91.153.253.80]) by mx.google.com with ESMTPS id v2sm9583793bkz.19.2010.06.05.04.13.04 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 05 Jun 2010 04:13:05 -0700 (PDT) From: Felipe Contreras To: notmuch@notmuchmail.org Subject: [PATCH 7/9] vim: use mailx for sending Date: Sat, 5 Jun 2010 14:12:40 +0300 Message-Id: <1275736362-22771-8-git-send-email-felipe.contreras@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1275736362-22771-1-git-send-email-felipe.contreras@gmail.com> References: <1275736362-22771-1-git-send-email-felipe.contreras@gmail.com> Cc: Bart Trojanowski X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 11:13:58 -0000 Possilby used by more systems, and besides the code wasn't really working properly anyway. Signed-off-by: Felipe Contreras --- vim/README | 4 +- vim/plugin/notmuch.vim | 61 ++++-------------------------------------------- 2 files changed, 7 insertions(+), 58 deletions(-) diff --git a/vim/README b/vim/README index 8cd3b1a..0807166 100644 --- a/vim/README +++ b/vim/README @@ -7,8 +7,8 @@ Dependencies: notmuch: Naturally, it expects you have notmuch installed and configured. - mail: - To send mail, notmuch.vim uses the UNIX mail command. + mailx: + To send mail, notmuch.vim uses the UNIX mailx command. git-diff: The vim interface makes use of the git-diff.vim syntax file diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim index 968c4c1..7b49015 100644 --- a/vim/plugin/notmuch.vim +++ b/vim/plugin/notmuch.vim @@ -941,71 +941,20 @@ function! s:NM_compose_send() let fname = expand('%') let lnum = 1 let line = getline(lnum) - let hdrs = {} let lst_hdr = '' while match(line, '^$') == -1 - if match(line, '^Notmuch-Help:') != -1 - " skip it - elseif strlen(lst_hdr) && match(line, '^\s') != -1 - let hdrs[lst_hdr][-1] = hdrs[lst_hdr][-1] . substitute(line, '^\s*', ' ', '') - else - let m = matchlist(line, '^\(\w[^:]*\):\s*\(.*\)\s*$') - if !len(m) - cursor(lnum, 0) - throw printf('Eeek! invalid header on line %d', lnum) - endif - let key = substitute(m[1], '\<\w', '\U&', 'g') - if strlen(m[2]) - if !has_key(hdrs, key) - let hdrs[key] = [] - endif - call add(hdrs[key], m[2]) - endif - let lst_hdr = key + if 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 - - "[-a header] [-b bcc-addr] [-c cc-addr] [-s subject] to-addr - let cmd = ['mail'] - let tos = [] - for [key, vals] in items(hdrs) - if key == 'To' - call extend(tos, vals) - elseif key == 'Bcc' - for adr in vals - call add(cmd, '-b') - call add(cmd, adr) - endfor - elseif key == 'Cc' - for adr in vals - call add(cmd, '-c') - call add(cmd, adr) - endfor - elseif key == 'Subject' - for txt in vals - call add(cmd, '-s') - call add(cmd, txt) - endfor - else - for val in vals - call add(cmd, '-a') - call add(cmd, key . ': ' . val) - endfor - endif - endfor - call extend(cmd, tos) - - " TODO: make sure we have at least one target - " TODO: ask about empty jubject, etc - exec printf('0,%dd', body_starts) + exec printf(':0,%dd', hdr_starts) write - call map(cmd, 's:NM_shell_escape(v:val)') - let cmdtxt = join(cmd) . '< ' . fname + let cmdtxt = 'mailx -t < ' . fname let out = system(cmdtxt) let err = v:shell_error if err -- 1.7.1