[PATCH v1 3/3] Test: Fix tests.
[notmuch-archives.git] / 23 / 8513a849f5982355b979858e9519dd8485b8c6
1 Return-Path: <imain@stemwinder.org>\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 A7666431FB6\r
6         for <notmuch@notmuchmail.org>; Mon,  6 Oct 2014 10:55:29 -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\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_NONE=-0.0001] 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 RpeyiyoK+nQI for <notmuch@notmuchmail.org>;\r
16         Mon,  6 Oct 2014 10:55:24 -0700 (PDT)\r
17 Received: from cmta13.telus.net (cmta13.telus.net [209.171.16.86])\r
18         by olra.theworths.org (Postfix) with ESMTP id 17959431FAE\r
19         for <notmuch@notmuchmail.org>; Mon,  6 Oct 2014 10:55:24 -0700 (PDT)\r
20 Received: from ovo.mains.priv ([207.102.88.62]) by cmta13.telus.net with TELUS\r
21         id ztvP1o0071LiWEf01tvP9v; Mon, 06 Oct 2014 11:55:23 -0600\r
22 X-Authority-Analysis: v=2.0 cv=OrmRPVDt c=1 sm=2\r
23         a=EcQDfIwDZEqJA1f7rVUV8Q==:17 a=S-IsBHyFrF4A:10 a=tsa3CZZnAAAA:8\r
24         a=S3gQTLpqa8hfpVGigeQA:9 a=EcQDfIwDZEqJA1f7rVUV8Q==:117\r
25 X-Telus-Outbound-IP: 207.102.88.62\r
26 From: Ian Main <imain@stemwinder.org>\r
27 To: notmuch@notmuchmail.org\r
28 Subject: [PATCH] VIM: Improve moving between messages in a thread\r
29 Date: Mon,  6 Oct 2014 10:55:16 -0700\r
30 Message-Id: <1412618116-27586-1-git-send-email-imain@stemwinder.org>\r
31 X-Mailer: git-send-email 1.9.3\r
32 In-Reply-To: <1412579537-7921-1-git-send-email-imain@stemwinder.org>\r
33 References: <1412579537-7921-1-git-send-email-imain@stemwinder.org>\r
34 X-BeenThere: notmuch@notmuchmail.org\r
35 X-Mailman-Version: 2.1.13\r
36 Precedence: list\r
37 List-Id: "Use and development of the notmuch mail system."\r
38         <notmuch.notmuchmail.org>\r
39 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
40         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
41 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
42 List-Post: <mailto:notmuch@notmuchmail.org>\r
43 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
44 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
45         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
46 X-List-Received-Date: Mon, 06 Oct 2014 17:55:29 -0000\r
47 \r
48 Add a few changes to moving between threads:\r
49 \r
50 - It supports 'scrolloff' so that if you have this set it will move the\r
51   buffer and cursor so the next/prev email starts at the top of the\r
52   screen.\r
53 - It adds the ability to use shift-tab to go to the previous msg in\r
54   the thread.\r
55 \r
56     Ian\r
57 ---\r
58 \r
59 This update fixes the commit message and removes vim_puts debugging.\r
60 \r
61  vim/notmuch.vim | 22 ++++++++++++++++++++--\r
62  1 file changed, 20 insertions(+), 2 deletions(-)\r
63 \r
64 diff --git a/vim/notmuch.vim b/vim/notmuch.vim\r
65 index 331e930..2124a8e 100644\r
66 --- a/vim/notmuch.vim\r
67 +++ b/vim/notmuch.vim\r
68 @@ -39,6 +39,7 @@ let g:notmuch_show_maps = {\r
69         \ 'p':          'show_save_patches()',\r
70         \ 'r':          'show_reply()',\r
71         \ '?':          'show_info()',\r
72 +       \ '<S-Tab>':    'show_prev_msg()',\r
73         \ '<Tab>':      'show_next_msg()',\r
74         \ 'c':          'compose()',\r
75         \ }\r
76 @@ -113,6 +114,22 @@ EOF\r
77         call s:kill_this_buffer()\r
78  endfunction\r
79  \r
80 +function! s:show_prev_msg()\r
81 +ruby << EOF\r
82 +       r, c = $curwin.cursor\r
83 +       n = $curbuf.line_number\r
84 +       i = $messages.index { |m| n >= m.start && n <= m.end }\r
85 +       m = $messages[i - 1] if i > 0\r
86 +       vim_puts ("messages index is #{i} and m is #{m}")\r
87 +       if m\r
88 +               r = m.body_start + 1\r
89 +               scrolloff = VIM::evaluate("&scrolloff")\r
90 +               VIM::command("normal #{m.start + scrolloff}zt")\r
91 +               $curwin.cursor = r + scrolloff, c\r
92 +       end\r
93 +EOF\r
94 +endfunction\r
95 +\r
96  function! s:show_next_msg()\r
97  ruby << EOF\r
98         r, c = $curwin.cursor\r
99 @@ -121,8 +138,9 @@ ruby << EOF\r
100         m = $messages[i + 1]\r
101         if m\r
102                 r = m.body_start + 1\r
103 -               VIM::command("normal #{m.start}zt")\r
104 -               $curwin.cursor = r, c\r
105 +               scrolloff = VIM::evaluate("&scrolloff")\r
106 +               VIM::command("normal #{m.start + scrolloff}zt")\r
107 +               $curwin.cursor = r + scrolloff, c\r
108         end\r
109  EOF\r
110  endfunction\r
111 -- \r
112 1.9.3\r
113 \r