mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-22 17:34:54 +01:00
avoid reloading search screen when we add/remove tags
This commit is contained in:
parent
f3d3e74b97
commit
3e4f9009ae
1 changed files with 30 additions and 17 deletions
|
@ -189,11 +189,8 @@ function! s:NM_search_edit()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:NM_search_archive_thread()
|
function! s:NM_search_archive_thread()
|
||||||
|
call <SID>NM_add_remove_tags_on_screen('-', ['inbox'])
|
||||||
call <SID>NM_add_remove_tags('-', ['inbox'])
|
call <SID>NM_add_remove_tags('-', ['inbox'])
|
||||||
" TODO: this could be made better and more generic
|
|
||||||
setlocal modifiable
|
|
||||||
s/(\([^)]*\)\<inbox\>\([^)]*\))$/(\1\2)/
|
|
||||||
setlocal nomodifiable
|
|
||||||
norm j
|
norm j
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -272,21 +269,12 @@ function! s:NM_search_add_remove_tags(prompt, prefix, intags)
|
||||||
if !strlen(text)
|
if !strlen(text)
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
call <SID>NM_add_remove_tags(a:prefix, split(text, ' '))
|
let tags = split(text, ' ')
|
||||||
else
|
else
|
||||||
call <SID>NM_add_remove_tags(a:prefix, a:intags)
|
let tags = a:intags
|
||||||
endif
|
endif
|
||||||
call <SID>NM_search_refresh_view()
|
call <SID>NM_add_remove_tags(a:prefix, tags)
|
||||||
endfunction
|
call <SID>NM_add_remove_tags_on_screen(a:prefix, tags)
|
||||||
|
|
||||||
function! s:NM_add_remove_tags(prefix, tags)
|
|
||||||
let id = <SID>NM_search_find_thread_id()
|
|
||||||
if id == ''
|
|
||||||
echoe 'Eeek! I couldn''t find the thead id!'
|
|
||||||
endif
|
|
||||||
call map(a:tags, 'a:prefix . v:val')
|
|
||||||
" TODO: handle errors
|
|
||||||
call <SID>NM_run(['tag'] + a:tags + ['--', id])
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" --- implement show screen {{{1
|
" --- implement show screen {{{1
|
||||||
|
@ -693,6 +681,31 @@ function! s:NM_kill_this_buffer()
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:NM_add_remove_tags(prefix, tags)
|
||||||
|
let id = <SID>NM_search_find_thread_id()
|
||||||
|
if id == ''
|
||||||
|
echoe 'Eeek! I couldn''t find the thead id!'
|
||||||
|
endif
|
||||||
|
call map(a:tags, 'a:prefix . v:val')
|
||||||
|
" TODO: handle errors
|
||||||
|
call <SID>NM_run(['tag'] + a:tags + ['--', id])
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:NM_add_remove_tags_on_screen(prefix, tags)
|
||||||
|
let online = ''
|
||||||
|
setlocal modifiable
|
||||||
|
if a:prefix == '-'
|
||||||
|
for tagname in a:tags
|
||||||
|
exec printf('silent %ss/(\([^)]*\)\<%s\>\([^)]*\))$/(\1\2)/', online, tagname)
|
||||||
|
endfor
|
||||||
|
else
|
||||||
|
for tagname in a:tags
|
||||||
|
exec printf('silent %ss/(\([^)]*\)\([^)]*\))$/(\1 %s)/', online, tagname)
|
||||||
|
endfor
|
||||||
|
endif
|
||||||
|
setlocal nomodifiable
|
||||||
|
endfunction
|
||||||
|
|
||||||
" --- process and set the defaults {{{1
|
" --- process and set the defaults {{{1
|
||||||
|
|
||||||
function! NM_set_defaults(force)
|
function! NM_set_defaults(force)
|
||||||
|
|
Loading…
Reference in a new issue