session_write(): error msg instead of exception

References #174.
This commit is contained in:
Marco Hinz 2015-08-14 11:59:24 +02:00
parent a58f92e781
commit 7f76635fce

View file

@ -235,27 +235,31 @@ endfunction
" Function: #session_write {{{1
function! startify#session_write(spath)
let ssop = &sessionoptions
try
" if this function is called while being in the Startify buffer
" (by loading another session or running :SSave/:SLoad directly)
" switch back to the previous buffer before saving the session
if &filetype == 'startify'
let callingbuffer = bufnr('#')
if callingbuffer > 0
execute 'buffer' callingbuffer
endif
" if this function is called while being in the Startify buffer
" (by loading another session or running :SSave/:SLoad directly)
" switch back to the previous buffer before saving the session
if &filetype == 'startify'
let callingbuffer = bufnr('#')
if callingbuffer > 0
execute 'buffer' callingbuffer
endif
" prevent saving already deleted buffers that were in the arglist
for arg in argv()
if !buflisted(arg)
execute 'argdelete' fnameescape(arg)
endif
endfor
set sessionoptions-=options
endif
" prevent saving already deleted buffers that were in the arglist
for arg in argv()
if !buflisted(arg)
execute 'silent! argdelete' fnameescape(arg)
endif
endfor
let ssop = &sessionoptions
set sessionoptions-=options
try
execute 'mksession!' a:spath
catch
execute 'echoerr' string(v:exception)
echohl ErrorMsg
echomsg v:exception
echohl NONE
return
finally
let &sessionoptions = ssop
endtry