From 335df4d01f55ef0d8e620f4c483b01f56c2ee883 Mon Sep 17 00:00:00 2001 From: Ian Main Date: Tue, 7 Oct 2014 10:25:07 +1700 Subject: [PATCH] RE: [PATCH] Improve moving between messages in a thread --- 9f/a6589992b9d8078416e77ad99d29b13757982e | 106 ++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 9f/a6589992b9d8078416e77ad99d29b13757982e diff --git a/9f/a6589992b9d8078416e77ad99d29b13757982e b/9f/a6589992b9d8078416e77ad99d29b13757982e new file mode 100644 index 000000000..86830970b --- /dev/null +++ b/9f/a6589992b9d8078416e77ad99d29b13757982e @@ -0,0 +1,106 @@ +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 9F616431FAF + for ; Mon, 6 Oct 2014 10:25:24 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_NONE=-0.0001] autolearn=disabled +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 gLtGFxy8qEGk for ; + Mon, 6 Oct 2014 10:25:19 -0700 (PDT) +Received: from cmta8.telus.net (cmta8.telus.net [209.171.16.81]) + by olra.theworths.org (Postfix) with ESMTP id F2482431FAE + for ; Mon, 6 Oct 2014 10:25:18 -0700 (PDT) +Received: from ovo.mains.priv ([207.102.88.62]) by cmta8.telus.net with TELUS + id ztRG1o00U1LiWEf01tRHWi; Mon, 06 Oct 2014 11:25:18 -0600 +X-Authority-Analysis: v=2.0 cv=ffdzPTsF c=1 sm=2 + a=EcQDfIwDZEqJA1f7rVUV8Q==:17 a=S-IsBHyFrF4A:10 a=IkcTkHD0fZMA:10 + a=tsa3CZZnAAAA:8 a=iT6l_161Bv_4KwFna24A:9 a=QEXdDO2ut3YA:10 + a=EcQDfIwDZEqJA1f7rVUV8Q==:117 +X-Telus-Outbound-IP: 207.102.88.62 +Received: from ovo.mains.priv (localhost.localdomain [127.0.0.1]) + by ovo.mains.priv (8.14.8/8.14.8) with ESMTP id s96HPE2k025572 + for ; Mon, 6 Oct 2014 10:25:14 -0700 +Received: (from imain@localhost) + by ovo.mains.priv (8.14.8/8.14.8/Submit) id s96HP7bg025555; + Mon, 6 Oct 2014 10:25:07 -0700 +X-Authentication-Warning: ovo.mains.priv: imain set sender to imain@redhat.com + using -f +Date: Mon, 06 Oct 2014 10:25:07 -0700 +From: Ian Main +To: notmuch@notmuchmail.org +Message-ID: <5432d073a9fc2_20301203e8c95@ovo.mains.priv.notmuch> +In-Reply-To: <1412579537-7921-1-git-send-email-imain@stemwinder.org> +References: <1412579537-7921-1-git-send-email-imain@stemwinder.org> +Subject: RE: [PATCH] Improve moving between messages in a thread +Mime-Version: 1.0 +Content-Type: text/plain; + charset=utf-8 +Content-Transfer-Encoding: 7bit +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: Mon, 06 Oct 2014 17:25:24 -0000 + +Ian Main wrote: +> This patch adds a few changes to moving between threads: +> +> - It supports 'scrolloff' so that if you have this set it will move the +> buffer and cursor so the next/prev email starts at the top of the +> screen. +> - It adds the ability to use shift-tab to go to the previous msg in +> the thread. +> +> Ian +> --- +> vim/notmuch.vim | 24 ++++++++++++++++++++++-- +> 1 file changed, 22 insertions(+), 2 deletions(-) +> +> diff --git a/vim/notmuch.vim b/vim/notmuch.vim +> index 331e930..95e5c4b 100644 +> --- a/vim/notmuch.vim +> +++ b/vim/notmuch.vim +> @@ -39,6 +39,7 @@ let g:notmuch_show_maps = { +> \ 'p': 'show_save_patches()', +> \ 'r': 'show_reply()', +> \ '?': 'show_info()', +> + \ '': 'show_prev_msg()', +> \ '': 'show_next_msg()', +> \ 'c': 'compose()', +> \ } +> @@ -113,6 +114,23 @@ EOF +> call s:kill_this_buffer() +> endfunction +> +> +function! s:show_prev_msg() +> +ruby << EOF +> + r, c = $curwin.cursor +> + n = $curbuf.line_number +> + i = $messages.index { |m| n >= m.start && n <= m.end } +> + m = $messages[i - 1] if i > 0 +> + vim_puts ("messages index is #{i} and m is #{m}") +> + if m +> + r = m.body_start + 1 +> + scrolloff = VIM::evaluate("&scrolloff") +> + VIM::command("normal #{m.start + scrolloff}zt") +> + $curwin.cursor = r + scrolloff, c +> + vim_puts("moving to #{m.start + scrolloff}") + +Woops, forgot to remove the vim_puts debugging. + + Ian -- 2.26.2