unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Ian Main <imain@stemwinder.org>
To: notmuch@notmuchmail.org
Subject: RE: [PATCH] Improve moving between messages in a thread
Date: Mon, 06 Oct 2014 10:25:07 -0700	[thread overview]
Message-ID: <5432d073a9fc2_20301203e8c95@ovo.mains.priv.notmuch> (raw)
In-Reply-To: <1412579537-7921-1-git-send-email-imain@stemwinder.org>

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()',
> +	\ '<S-Tab>':	'show_prev_msg()',
>  	\ '<Tab>':	'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

  reply	other threads:[~2014-10-06 17:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-06  7:12 [PATCH] Improve moving between messages in a thread Ian Main
2014-10-06 17:25 ` Ian Main [this message]
2014-10-06 17:55 ` [PATCH] VIM: " Ian Main
2014-10-10  9:21   ` Franz Fellner
2014-10-10 18:21     ` Ian Main
2014-10-18 20:30       ` Franz Fellner
2014-10-19  9:51         ` Tomi Ollila
2014-10-20 18:01   ` [PATCH v3] " Ian Main
2015-01-12 23:47     ` Bartosz Telenczuk
2015-01-21 18:53       ` Franz Fellner
2015-02-02 23:44         ` Bartosz Telenczuk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5432d073a9fc2_20301203e8c95@ovo.mains.priv.notmuch \
    --to=imain@stemwinder.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).