Skip to content

Commit

Permalink
Prompt for confirmation in [search,folders]_tag_all
Browse files Browse the repository at this point in the history
This should prevent accidental tagging, like hitting "A" while the
cursor is on the inbox in folder.

fixes felipec#7
  • Loading branch information
ff2000 committed Dec 22, 2014
1 parent 971dd6c commit 68c1c07
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions plugin/notmuch.vim
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,16 @@ function! s:search_tag(intags)
endfunction

function! s:search_tag_all(intags)
if empty(a:intags)
let tags = input('tags: ')
else
let tags = a:intags
let choice = confirm('Do you really want to tag all messages in this search?', "&yes\n&no", 1)
if choice == 1
if empty(a:intags)
let tags = input('tags: ')
else
let tags = a:intags
endif
ruby do_tag($cur_search, VIM::evaluate('l:tags'))
echo 'Tagged all search results with '.a:intags
endif
ruby do_tag($cur_search, VIM::evaluate('l:tags'))
echo 'Tagged all search results with '.a:intags
endfunction

function! s:folders_search_prompt()
Expand Down Expand Up @@ -357,13 +360,16 @@ EOF
endfunction

function! s:folders_tag_all(tags)
let choice = confirm('Do you really want to tag all messages in this folder?', "&yes\n&no", 1)
if choice == 1
ruby << EOF
n = $curbuf.line_number
s = $searches[n - 1]
t = VIM::evaluate('a:tags')
do_tag(s, t)
n = $curbuf.line_number
s = $searches[n - 1]
t = VIM::evaluate('a:tags')
do_tag(s, t)
EOF
call s:folders_refresh()
call s:folders_refresh()
endif
endfunction

function! s:folders()
Expand Down

0 comments on commit 68c1c07

Please sign in to comment.