lib/vmail.vim in vmail-2.8.7 vs lib/vmail.vim in vmail-2.8.9
- old
+ new
@@ -280,11 +280,11 @@
let lnum += 1
endwhile
setlocal nomodifiable
write
redraw
- echom nummsgs ." conversation(s) have been marked as unread."
+ echom nummsgs ." conversation(s) have been marked as " . (a:read ? "read" : "unread") . "."
endfunction
function! s:toggle_star() range
let uid_set = s:collect_uids(a:firstline, a:lastline)
let nummsgs = len(uid_set)
@@ -681,9 +681,45 @@
call s:close_and_focus_list_window()
endif
echom substitute(res, '[\s\r\n]\+$', '', '')
redraw
endfunction
+
+" --------------------------------------------------------------------------------
+" Update message list with new emails.
+
+func! UPDATE_MESSAGE_LIST(filename)
+ if s:mailbox == 'INBOX'
+ if bufnr('%') == s:listbufnr
+ call s:update_and_redraw_message_list(a:filename)
+
+ " If current_message is open with message list in another split.
+ elseif bufname('%') == s:message_bufname && index(tabpagebuflist(), s:listbufnr) >= 0
+ let message_bufnr = bufnr('%')
+
+ " Switch to message list window and update it.
+ while bufnr('%') != s:listbufnr | wincmd w | endwhile
+ call s:update_and_redraw_message_list(a:filename)
+
+ while bufnr('%') != message_bufnr | wincmd w | endwhile
+ else
+ call s:update_message_list(a:filename)
+ endif
+ endif
+endfunc
+
+func! s:update_and_redraw_message_list(filename)
+ call s:update_message_list(a:filename)
+ edit!
+ redraw!
+endfunc
+
+func! s:update_message_list(filename)
+ let newer_contents = readfile(a:filename)
+ let older_contents = readfile(s:listbufname)
+ let updated_contents = extend(newer_contents, older_contents)
+ call writefile(updated_contents, s:listbufname)
+endfunc
" --------------------------------------------------------------------------------
" call from inside message window with <Leader>h
func! s:open_html_part()