]> git.cworth.org Git - notmuch/blobdiff - vim/notmuch.vim
vim: make the html handler configurable
[notmuch] / vim / notmuch.vim
index fc9eaa24ecc8526a95bed6bc9a072c95e83b5477..0cb94f6c93b542812b0b3942ae77f1ee710c2e5c 100644 (file)
@@ -65,10 +65,9 @@ function! s:new_file_buffer(type, fname)
        execute printf('set filetype=notmuch-%s', a:type)
        execute printf('set syntax=notmuch-%s', a:type)
        ruby $curbuf.init(VIM::evaluate('a:type'))
-       ruby $buf_queue.push($curbuf.number)
 endfunction
 
-function! s:compose_unload()
+function! s:on_compose_delete()
        if b:compose_done
                return
        endif
@@ -127,7 +126,7 @@ function! s:show_reply()
        ruby open_reply get_message.mail
        let b:compose_done = 0
        call s:set_map(g:notmuch_compose_maps)
-       autocmd BufUnload <buffer> call s:compose_unload()
+       autocmd BufDelete <buffer> call s:on_compose_delete()
        startinsert!
 endfunction
 
@@ -135,7 +134,7 @@ function! s:compose()
        ruby open_compose
        let b:compose_done = 0
        call s:set_map(g:notmuch_compose_maps)
-       autocmd BufUnload <buffer> call s:compose_unload()
+       autocmd BufDelete <buffer> call s:on_compose_delete()
        startinsert!
 endfunction
 
@@ -268,13 +267,8 @@ endfunction
 
 function! s:kill_this_buffer()
 ruby << EOF
-       if $buf_queue.size > 1
-               $curbuf.close
-               VIM::command("bdelete!")
-               $buf_queue.pop
-               b = $buf_queue.last
-               VIM::command("buffer #{b}") if b
-       end
+       $curbuf.close
+       VIM::command("bdelete!")
 EOF
 endfunction
 
@@ -293,7 +287,6 @@ function! s:new_buffer(type)
        execute printf('set filetype=notmuch-%s', a:type)
        execute printf('set syntax=notmuch-%s', a:type)
        ruby $curbuf.init(VIM::evaluate('a:type'))
-       ruby $buf_queue.push($curbuf.number)
 endfunction
 
 function! s:set_menu_buffer()
@@ -471,7 +464,6 @@ ruby << EOF
        $db_name = nil
        $email = $email_name = $email_address = nil
        $searches = []
-       $buf_queue = []
        $threads = []
        $messages = []
        $config = {}
@@ -641,7 +633,7 @@ ruby << EOF
        def folders_render()
                $curbuf.render do |b|
                        folders = VIM::evaluate('g:notmuch_folders')
-                       count_threads = VIM::evaluate('g:notmuch_folders_count_threads')
+                       count_threads = VIM::evaluate('g:notmuch_folders_count_threads') == 1
                        $searches.clear
                        folders.each do |name, search|
                                q = $curbuf.query(search)
@@ -927,7 +919,8 @@ ruby << EOF
                                if mime_type != "text/html"
                                        text = decoded
                                else
-                                       IO.popen("elinks --dump", "w+") do |pipe|
+                                       IO.popen(VIM::evaluate('exists("g:notmuch_html_converter") ? ' +
+                                                       'g:notmuch_html_converter : "elinks --dump"'), "w+") do |pipe|
                                                pipe.write(decode_body)
                                                pipe.close_write
                                                text = pipe.read