+" --- --- search screen helper functions {{{2
+
+function! s:NM_search_find_thread_id()
+ if !exists('b:nm_raw_lines')
+ echoe 'no b:nm_raw_lines'
+ return ''
+ else
+ let line = line('.')
+ let info = b:nm_raw_lines[line-1]
+ let what = split(info, '\s\+')[0]
+ return what
+ endif
+endfunction
+
+function! s:NM_search_add_remove_tags(prompt, prefix, intags)
+ let id = <SID>NM_search_find_thread_id()
+ if id != ''
+ if type(a:intags) != type([]) || len(a:intags) == 0
+ " TODO: input() can support completion
+ let text = input(a:prompt)
+ if !strlen(text)
+ return
+ endif
+ let tags = split(text, ' ')
+ else
+ let tags = a:intags
+ endif
+ call map(tags, 'a:prefix . v:val')
+ " TODO: handle errors
+ call <SID>NM_run(['tag'] + tags + ['--', id])
+ call <SID>NM_search_refresh_view()
+ endif
+endfunction