mirror of
https://github.com/soywod/himalaya.git
synced 2024-07-08 18:45:13 +00:00
refresh email list on load buffer (#125)
This commit is contained in:
parent
15c635eb1d
commit
2d299e1d42
|
@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Plain logger with `env_logger` [#126]
|
- Plain logger with `env_logger` [#126]
|
||||||
|
- Refresh email list on load buffer [#125]
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
@ -197,4 +198,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
[#89]: https://github.com/soywod/himalaya/issues/89
|
[#89]: https://github.com/soywod/himalaya/issues/89
|
||||||
[#96]: https://github.com/soywod/himalaya/issues/96
|
[#96]: https://github.com/soywod/himalaya/issues/96
|
||||||
[#100]: https://github.com/soywod/himalaya/issues/100
|
[#100]: https://github.com/soywod/himalaya/issues/100
|
||||||
|
[#125]: https://github.com/soywod/himalaya/issues/125
|
||||||
[#126]: https://github.com/soywod/himalaya/issues/126
|
[#126]: https://github.com/soywod/himalaya/issues/126
|
||||||
|
|
|
@ -19,6 +19,7 @@ function! s:format_msg_for_list(msg)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! himalaya#msg#list_with(mbox, page, should_throw)
|
function! himalaya#msg#list_with(mbox, page, should_throw)
|
||||||
|
let pos = getpos(".")
|
||||||
let msgs = s:cli("--mailbox %s list --page %d", [shellescape(a:mbox), a:page], printf("Fetching %s messages", a:mbox), a:should_throw)
|
let msgs = s:cli("--mailbox %s list --page %d", [shellescape(a:mbox), a:page], printf("Fetching %s messages", a:mbox), a:should_throw)
|
||||||
let msgs = map(msgs, "s:format_msg_for_list(v:val)")
|
let msgs = map(msgs, "s:format_msg_for_list(v:val)")
|
||||||
let buftype = stridx(bufname("%"), "Himalaya messages") == 0 ? "file" : "edit"
|
let buftype = stridx(bufname("%"), "Himalaya messages") == 0 ? "file" : "edit"
|
||||||
|
@ -30,22 +31,24 @@ function! himalaya#msg#list_with(mbox, page, should_throw)
|
||||||
setlocal filetype=himalaya-msg-list
|
setlocal filetype=himalaya-msg-list
|
||||||
let &modified = 0
|
let &modified = 0
|
||||||
execute 0
|
execute 0
|
||||||
|
call setpos('.', pos)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! himalaya#msg#list()
|
function! himalaya#msg#list()
|
||||||
" try
|
try
|
||||||
let mbox = himalaya#mbox#curr_mbox()
|
let mbox = himalaya#mbox#curr_mbox()
|
||||||
let page = himalaya#mbox#curr_page()
|
let page = himalaya#mbox#curr_page()
|
||||||
call himalaya#msg#list_with(mbox, page, 0)
|
call himalaya#msg#list_with(mbox, page, 0)
|
||||||
" catch
|
catch
|
||||||
" if !empty(v:exception)
|
if !empty(v:exception)
|
||||||
" redraw | call himalaya#shared#log#err(v:exception)
|
redraw | call himalaya#shared#log#err(v:exception)
|
||||||
" endif
|
endif
|
||||||
" endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! himalaya#msg#read()
|
function! himalaya#msg#read()
|
||||||
try
|
try
|
||||||
|
let pos = getpos(".")
|
||||||
let s:msg_id = s:get_focused_msg_id()
|
let s:msg_id = s:get_focused_msg_id()
|
||||||
let mbox = himalaya#mbox#curr_mbox()
|
let mbox = himalaya#mbox#curr_mbox()
|
||||||
let msg = s:cli("--mailbox %s read %d", [shellescape(mbox), s:msg_id], printf("Fetching message %d", s:msg_id), 0)
|
let msg = s:cli("--mailbox %s read %d", [shellescape(mbox), s:msg_id], printf("Fetching message %d", s:msg_id), 0)
|
||||||
|
@ -58,6 +61,7 @@ function! himalaya#msg#read()
|
||||||
setlocal filetype=himalaya-msg-read
|
setlocal filetype=himalaya-msg-read
|
||||||
let &modified = 0
|
let &modified = 0
|
||||||
execute 0
|
execute 0
|
||||||
|
call setpos('.', pos)
|
||||||
catch
|
catch
|
||||||
if !empty(v:exception)
|
if !empty(v:exception)
|
||||||
redraw | call himalaya#shared#log#err(v:exception)
|
redraw | call himalaya#shared#log#err(v:exception)
|
||||||
|
@ -67,6 +71,7 @@ endfunction
|
||||||
|
|
||||||
function! himalaya#msg#write()
|
function! himalaya#msg#write()
|
||||||
try
|
try
|
||||||
|
let pos = getpos(".")
|
||||||
let msg = s:cli("template new", [], "Fetching new template", 0)
|
let msg = s:cli("template new", [], "Fetching new template", 0)
|
||||||
silent! edit Himalaya write
|
silent! edit Himalaya write
|
||||||
call append(0, split(substitute(msg.template, "\r", "", "g"), "\n"))
|
call append(0, split(substitute(msg.template, "\r", "", "g"), "\n"))
|
||||||
|
@ -74,6 +79,7 @@ function! himalaya#msg#write()
|
||||||
setlocal filetype=himalaya-msg-write
|
setlocal filetype=himalaya-msg-write
|
||||||
let &modified = 0
|
let &modified = 0
|
||||||
execute 0
|
execute 0
|
||||||
|
call setpos('.', pos)
|
||||||
catch
|
catch
|
||||||
if !empty(v:exception)
|
if !empty(v:exception)
|
||||||
redraw | call himalaya#shared#log#err(v:exception)
|
redraw | call himalaya#shared#log#err(v:exception)
|
||||||
|
@ -83,6 +89,7 @@ endfunction
|
||||||
|
|
||||||
function! himalaya#msg#reply()
|
function! himalaya#msg#reply()
|
||||||
try
|
try
|
||||||
|
let pos = getpos(".")
|
||||||
let mbox = himalaya#mbox#curr_mbox()
|
let mbox = himalaya#mbox#curr_mbox()
|
||||||
let msg_id = stridx(bufname("%"), "Himalaya messages") == 0 ? s:get_focused_msg_id() : s:msg_id
|
let msg_id = stridx(bufname("%"), "Himalaya messages") == 0 ? s:get_focused_msg_id() : s:msg_id
|
||||||
let msg = s:cli("--mailbox %s template reply %d", [shellescape(mbox), msg_id], "Fetching reply template", 0)
|
let msg = s:cli("--mailbox %s template reply %d", [shellescape(mbox), msg_id], "Fetching reply template", 0)
|
||||||
|
@ -92,6 +99,7 @@ function! himalaya#msg#reply()
|
||||||
setlocal filetype=himalaya-msg-write
|
setlocal filetype=himalaya-msg-write
|
||||||
let &modified = 0
|
let &modified = 0
|
||||||
execute 0
|
execute 0
|
||||||
|
call setpos('.', pos)
|
||||||
catch
|
catch
|
||||||
if !empty(v:exception)
|
if !empty(v:exception)
|
||||||
redraw | call himalaya#shared#log#err(v:exception)
|
redraw | call himalaya#shared#log#err(v:exception)
|
||||||
|
@ -101,6 +109,7 @@ endfunction
|
||||||
|
|
||||||
function! himalaya#msg#reply_all()
|
function! himalaya#msg#reply_all()
|
||||||
try
|
try
|
||||||
|
let pos = getpos(".")
|
||||||
let mbox = himalaya#mbox#curr_mbox()
|
let mbox = himalaya#mbox#curr_mbox()
|
||||||
let msg_id = stridx(bufname("%"), "Himalaya messages") == 0 ? s:get_focused_msg_id() : s:msg_id
|
let msg_id = stridx(bufname("%"), "Himalaya messages") == 0 ? s:get_focused_msg_id() : s:msg_id
|
||||||
let msg = s:cli("--mailbox %s template reply %d --all", [shellescape(mbox), msg_id], "Fetching reply all template", 0)
|
let msg = s:cli("--mailbox %s template reply %d --all", [shellescape(mbox), msg_id], "Fetching reply all template", 0)
|
||||||
|
@ -110,6 +119,7 @@ function! himalaya#msg#reply_all()
|
||||||
setlocal filetype=himalaya-msg-write
|
setlocal filetype=himalaya-msg-write
|
||||||
let &modified = 0
|
let &modified = 0
|
||||||
execute 0
|
execute 0
|
||||||
|
call setpos('.', pos)
|
||||||
catch
|
catch
|
||||||
if !empty(v:exception)
|
if !empty(v:exception)
|
||||||
redraw | call himalaya#shared#log#err(v:exception)
|
redraw | call himalaya#shared#log#err(v:exception)
|
||||||
|
@ -119,6 +129,7 @@ endfunction
|
||||||
|
|
||||||
function! himalaya#msg#forward()
|
function! himalaya#msg#forward()
|
||||||
try
|
try
|
||||||
|
let pos = getpos(".")
|
||||||
let mbox = himalaya#mbox#curr_mbox()
|
let mbox = himalaya#mbox#curr_mbox()
|
||||||
let msg_id = stridx(bufname("%"), "Himalaya messages") == 0 ? s:get_focused_msg_id() : s:msg_id
|
let msg_id = stridx(bufname("%"), "Himalaya messages") == 0 ? s:get_focused_msg_id() : s:msg_id
|
||||||
let msg = s:cli("--mailbox %s template forward %d", [shellescape(mbox), msg_id], "Fetching forward template", 0)
|
let msg = s:cli("--mailbox %s template forward %d", [shellescape(mbox), msg_id], "Fetching forward template", 0)
|
||||||
|
@ -128,6 +139,7 @@ function! himalaya#msg#forward()
|
||||||
setlocal filetype=himalaya-msg-write
|
setlocal filetype=himalaya-msg-write
|
||||||
let &modified = 0
|
let &modified = 0
|
||||||
execute 0
|
execute 0
|
||||||
|
call setpos('.', pos)
|
||||||
catch
|
catch
|
||||||
if !empty(v:exception)
|
if !empty(v:exception)
|
||||||
redraw | call himalaya#shared#log#err(v:exception)
|
redraw | call himalaya#shared#log#err(v:exception)
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
setlocal bufhidden=wipe
|
||||||
setlocal buftype=nofile
|
setlocal buftype=nofile
|
||||||
setlocal cursorline
|
setlocal cursorline
|
||||||
setlocal nomodifiable
|
setlocal nomodifiable
|
||||||
setlocal nowrap
|
setlocal nowrap
|
||||||
setlocal startofline
|
|
||||||
|
|
||||||
call himalaya#shared#bindings#define([
|
call himalaya#shared#bindings#define([
|
||||||
\["n", "gm" , "mbox#input" ],
|
\["n", "gm" , "mbox#input" ],
|
||||||
|
|
|
@ -4,7 +4,6 @@ setlocal cursorline
|
||||||
setlocal foldexpr=himalaya#shared#thread#fold(v:lnum)
|
setlocal foldexpr=himalaya#shared#thread#fold(v:lnum)
|
||||||
setlocal foldmethod=expr
|
setlocal foldmethod=expr
|
||||||
setlocal nomodifiable
|
setlocal nomodifiable
|
||||||
setlocal startofline
|
|
||||||
|
|
||||||
call himalaya#shared#bindings#define([
|
call himalaya#shared#bindings#define([
|
||||||
\["n", "gw", "msg#write" ],
|
\["n", "gw", "msg#write" ],
|
||||||
|
|
Loading…
Reference in a new issue