Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / d9 / 0db79788943353c101a589c0fc7920fd00806b
1 Return-Path: <rharper@shake.ath.cx>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 92AEE429E26\r
6         for <notmuch@notmuchmail.org>; Fri, 16 Sep 2011 19:28:16 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id 94XC+X46AAIP for <notmuch@notmuchmail.org>;\r
16         Fri, 16 Sep 2011 19:28:15 -0700 (PDT)\r
17 Received: from mail-gw0-f43.google.com (mail-gw0-f43.google.com\r
18  [74.125.83.43])        (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
19  certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
20  C0D7C429E27    for <notmuch@notmuchmail.org>; Fri, 16 Sep 2011 19:28:13 -0700\r
21  (PDT)\r
22 Received: by gwm11 with SMTP id 11so9581531gwm.2\r
23         for <notmuch@notmuchmail.org>; Fri, 16 Sep 2011 19:28:13 -0700 (PDT)\r
24 Received: by 10.236.77.133 with SMTP id d5mr380794yhe.75.1316226493151;\r
25         Fri, 16 Sep 2011 19:28:13 -0700 (PDT)\r
26 Received: from localhost.localdomain\r
27         (r74-193-78-30.pfvlcmta01.grtntx.tl.dh.suddenlink.net [74.193.78.30])\r
28         by mx.google.com with ESMTPS id u13sm27862929anf.14.2011.09.16.19.28.11\r
29         (version=TLSv1/SSLv3 cipher=OTHER);\r
30         Fri, 16 Sep 2011 19:28:12 -0700 (PDT)\r
31 From: Ryan Harper <rharper@shake.ath.cx>\r
32 To: notmuch@notmuchmail.org\r
33 Subject: [PATCH 1/2] vim plugin: Implement show_view_all_mime_parts\r
34 Date: Fri, 16 Sep 2011 21:27:49 -0500\r
35 Message-Id: <1316226470-30001-2-git-send-email-rharper@shake.ath.cx>\r
36 X-Mailer: git-send-email 1.7.1\r
37 In-Reply-To: <1316226470-30001-1-git-send-email-rharper@shake.ath.cx>\r
38 References: <1316226470-30001-1-git-send-email-rharper@shake.ath.cx>\r
39 X-BeenThere: notmuch@notmuchmail.org\r
40 X-Mailman-Version: 2.1.13\r
41 Precedence: list\r
42 List-Id: "Use and development of the notmuch mail system."\r
43         <notmuch.notmuchmail.org>\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
45         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
47 List-Post: <mailto:notmuch@notmuchmail.org>\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
50         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
51 X-List-Received-Date: Sat, 17 Sep 2011 02:28:17 -0000\r
52 \r
53 Implement mime attachment viewing in the vim plugin via\r
54 notmuch show --format=text parsing for attachment segments.\r
55 Extract the part ID, filename, and content-type.\r
56 \r
57 Storing this in a dictionary for use later when implementing\r
58 attachment saving.\r
59 \r
60 Signed-off-by: Ryan Harper <rharper@shake.ath.cx>\r
61 ---\r
62  vim/plugin/notmuch.vim |   50 +++++++++++++++++++++++++++++++++++++++++++++++-\r
63  1 files changed, 49 insertions(+), 1 deletions(-)\r
64 \r
65 diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim\r
66 index 21985c7..cbc5b51 100644\r
67 --- a/vim/plugin/notmuch.vim\r
68 +++ b/vim/plugin/notmuch.vim\r
69 @@ -556,7 +556,55 @@ function! s:NM_show_reply()\r
70  endfunction\r
71  \r
72  function! s:NM_show_view_all_mime_parts()\r
73 -        echo 'not implemented'\r
74 +        let info = b:nm_raw_info\r
75 +        let words = b:nm_search_words\r
76 +        let cmd = ['show', '--format=text']\r
77 +        let mid = <SID>NM_show_message_id()\r
78 +        call add(cmd, <SID>NM_show_message_id())\r
79 +        call add(cmd, 'AND')\r
80 +        call extend(cmd, <SID>NM_get_search_words())\r
81 +        let data = <SID>NM_run(cmd)\r
82 +        let lines = split(data, "\n")\r
83 +        let attachments = []\r
84 +        let bufflines = []\r
85 +\r
86 +        for line in lines\r
87 +                if match(line, g:notmuch_show_attachment_begin_regexp) != -1\r
88 +                        let m = matchlist(line, 'ID: \(\d\+\), Filename: \(.*\), Content-type: \(\S\+\)')\r
89 +                        if len(m)\r
90 +                                " create a attachment dict (id, filename, type, str)\r
91 +                                " id - message id\r
92 +                                " filename - filename from MIME attachment\r
93 +                                " type - Content-type \r
94 +                                " str - displayable string for the buffer\r
95 +                                let att = {}\r
96 +                                let att['id'] = m[1]\r
97 +                                let att['filename']=m[2]\r
98 +                                let att['type']=m[3]\r
99 +                                let att['mid']=mid\r
100 +                                let id = att['id']\r
101 +                                let fn = att['filename']\r
102 +                                let ty = att['type']\r
103 +                                let att['str']=printf('%d %-60s[%s]', id, fn, ty)\r
104 +                                call add(attachments, att)\r
105 +                                call add(bufflines, att['str'])\r
106 +                        endif\r
107 +                endif\r
108 +\r
109 +        endfor\r
110 +        if len(attachments) == 0\r
111 +                echo 'No attachments'\r
112 +        endif\r
113 +\r
114 +        let prev_bufnr = bufnr('%')\r
115 +        setlocal bufhidden=hide\r
116 +        call <SID>NM_newBuffer('', 'show', bufflines)\r
117 +        setlocal bufhidden=delete\r
118 +        let b:attachments = attachments\r
119 +        let b:nm_prev_bufnr = prev_bufnr\r
120 +        let b:nm_raw_info = info\r
121 +        let b:nm_search_words = words\r
122 +        call <SID>NM_set_map('n', g:notmuch_show_maps)\r
123  endfunction\r
124  \r
125  function! s:NM_show_view_raw_message()\r
126 -- \r
127 1.7.6\r
128 \r