mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-29 06:04:11 +01:00
added support for archive command
This commit is contained in:
parent
8826219274
commit
de85b4752d
2 changed files with 24 additions and 16 deletions
|
@ -18,6 +18,7 @@ Buffer types:
|
||||||
|
|
||||||
Keybindings:
|
Keybindings:
|
||||||
<Enter> - show the selected message
|
<Enter> - show the selected message
|
||||||
|
a - archive message (remove inbox tag)
|
||||||
s - enter search criteria
|
s - enter search criteria
|
||||||
S - alter search criteria
|
S - alter search criteria
|
||||||
+ - add tag(s) to selected message
|
+ - add tag(s) to selected message
|
||||||
|
|
|
@ -136,7 +136,10 @@ function! s:NM_search_edit()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:NM_search_archive_thread()
|
function! s:NM_search_archive_thread()
|
||||||
call <SID>NM_search_remove_tags('inbox')
|
call <SID>NM_add_remove_tags('-', ['inbox'])
|
||||||
|
setlocal modifiable
|
||||||
|
s/(\([^)]*\)\<inbox\>\([^)]*\))$/(\1\2)/
|
||||||
|
setlocal nomodifiable
|
||||||
norm j
|
norm j
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -190,23 +193,27 @@ function! s:NM_search_find_thread_id()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:NM_search_add_remove_tags(prompt, prefix, intags)
|
function! s:NM_search_add_remove_tags(prompt, prefix, intags)
|
||||||
let id = <SID>NM_search_find_thread_id()
|
if type(a:intags) != type([]) || len(a:intags) == 0
|
||||||
if id != ''
|
" TODO: input() can support completion
|
||||||
if type(a:intags) != type([]) || len(a:intags) == 0
|
let text = input(a:prompt)
|
||||||
" TODO: input() can support completion
|
if !strlen(text)
|
||||||
let text = input(a:prompt)
|
return
|
||||||
if !strlen(text)
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
let tags = split(text, ' ')
|
|
||||||
else
|
|
||||||
let tags = a:intags
|
|
||||||
endif
|
endif
|
||||||
call map(tags, 'a:prefix . v:val')
|
call <SID>NM_add_remove_tags(prefix, split(text, ' '))
|
||||||
" TODO: handle errors
|
else
|
||||||
call <SID>NM_run(['tag'] + tags + ['--', id])
|
call <SID>NM_add_remove_tags(prefix, a:intags)
|
||||||
call <SID>NM_search_refresh_view()
|
|
||||||
endif
|
endif
|
||||||
|
call <SID>NM_search_refresh_view()
|
||||||
|
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
|
endfunction
|
||||||
|
|
||||||
" --- implement show screen {{{1
|
" --- implement show screen {{{1
|
||||||
|
|
Loading…
Reference in a new issue