make searching, updates and returning to folder view work

This commit is contained in:
Bart Trojanowski 2009-11-21 23:14:53 -05:00
parent 33c896dd71
commit 5a9d5fb200
2 changed files with 22 additions and 20 deletions

View file

@ -18,6 +18,8 @@ Buffer types:
Keybindings: Keybindings:
<Enter> - show the selected search <Enter> - show the selected search
s - enter search criteria
= - refresh display
[notmuch-search] [notmuch-search]
You are presented with the search results when you run :NotMuch. You are presented with the search results when you run :NotMuch.

View file

@ -82,9 +82,8 @@ let s:notmuch_folders_defaults = [
" --- --- bindings for folders mode {{{2 " --- --- bindings for folders mode {{{2
let g:notmuch_folders_maps = { let g:notmuch_folders_maps = {
\ 's': ':call <SID>NM_folders_notmuch_search()<CR>', \ 's': ':call <SID>NM_search_prompt()<CR>',
\ 'q': ':call <SID>NM_kill_this_buffer()<CR>', \ 'q': ':call <SID>NM_kill_this_buffer()<CR>',
\ '<': ':call <SID>NM_folders_beginning_of_buffer()<CR>',
\ '=': ':call <SID>NM_folders_refresh_view()<CR>', \ '=': ':call <SID>NM_folders_refresh_view()<CR>',
\ '<Enter>': ':call <SID>NM_folders_show_search()<CR>', \ '<Enter>': ':call <SID>NM_folders_show_search()<CR>',
\ } \ }
@ -163,20 +162,11 @@ endfunction
" --- --- folders screen action functions {{{2 " --- --- folders screen action functions {{{2
function! s:NM_folders_notmuch_search() function! s:NM_folders_refresh_view()
echo 'not implemented' let lno = line('.')
endfunction setlocal bufhidden=delete
call s:NM_cmd_folders([])
function! s:NM_kill_this_buffer() exec printf('norm %dG', lno)
echo 'not implemented'
endfunction
function! s:NM_folders_beginning_of_buffer()
echo 'not implemented'
endfunction
function! s:NM_folders_notmuch_folder()
echo 'not implemented'
endfunction endfunction
function! s:NM_folders_show_search() function! s:NM_folders_show_search()
@ -251,8 +241,17 @@ function! s:NM_search_prompt()
else else
let tags = s:notmuch_initial_search_words_defaults let tags = s:notmuch_initial_search_words_defaults
endif endif
let prev_bufnr = bufnr('%')
if b:nm_type == 'search'
" TODO: we intend to replace the current buffer,
" ... maybe we could just clear it
setlocal bufhidden=delete setlocal bufhidden=delete
else
setlocal bufhidden=hide
endif
call <SID>NM_cmd_search(tags) call <SID>NM_cmd_search(tags)
setlocal bufhidden=delete
let b:nm_prev_bufnr = prev_bufnr
endfunction endfunction
function! s:NM_search_edit() function! s:NM_search_edit()
@ -713,14 +712,15 @@ endfunction
" --- notmuch helper functions {{{1 " --- notmuch helper functions {{{1
function! s:NM_newBuffer(ft, content) function! s:NM_newBuffer(type, content)
enew enew
setlocal buftype=nofile readonly modifiable setlocal buftype=nofile readonly modifiable
silent put=a:content silent put=a:content
keepjumps 0d keepjumps 0d
setlocal nomodifiable setlocal nomodifiable
execute printf('set filetype=notmuch-%s', a:ft) execute printf('set filetype=notmuch-%s', a:type)
execute printf('set syntax=notmuch-%s', a:ft) execute printf('set syntax=notmuch-%s', a:type)
let b:nm_type = a:type
endfunction endfunction
function! s:NM_run(args) function! s:NM_run(args)