* [PATCH] vim: Ignore instead of erroring out when trying to perform an action on a non-existent thread.
@ 2019-03-22 16:05 Nicolas Lesser
0 siblings, 0 replies; only message in thread
From: Nicolas Lesser @ 2019-03-22 16:05 UTC (permalink / raw)
To: notmuch
---
vim/notmuch.vim | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index ad8b7c80..299405f4 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -237,7 +237,11 @@ function! s:search_tag(intags)
else
let tags = a:intags
endif
- ruby do_tag(get_thread_id, VIM::evaluate('l:tags'))
+ruby << EOF
+ if (id = get_thread_id)
+ do_tag(id, VIM::evaluate('l:tags'))
+ end
+EOF
norm j
endfunction
@@ -354,13 +358,14 @@ endfunction
function! s:search_show_thread(mode)
ruby << EOF
mode = VIM::evaluate('a:mode')
- id = get_thread_id
- case mode
- when 0;
- when 1; $cur_filter = nil
- when 2; $cur_filter = $cur_search
+ if (id = get_thread_id)
+ case mode
+ when 0;
+ when 1; $cur_filter = nil
+ when 2; $cur_filter = $cur_search
+ end
+ VIM::command("call s:show('#{id}')")
end
- VIM::command("call s:show('#{id}')")
EOF
endfunction
@@ -519,6 +524,7 @@ ruby << EOF
end
def get_thread_id
+ return nil if $threads.empty?
n = $curbuf.line_number - 1
return "thread:%s" % $threads[n]
end
--
2.21.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2019-03-22 16:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-22 16:05 [PATCH] vim: Ignore instead of erroring out when trying to perform an action on a non-existent thread Nicolas Lesser
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).