diff options
Diffstat (limited to 'src/nvim/ex_cmds.c')
-rw-r--r-- | src/nvim/ex_cmds.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index b72d1941ec..44604b68c4 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -1648,11 +1648,13 @@ void write_viminfo(char_u *file, int forceit) if (fp_in != NULL) { fclose(fp_in); - /* - * In case of an error keep the original viminfo file. - * Otherwise rename the newly written file. - */ - if (viminfo_errcnt || vim_rename(tempname, fname) == -1) { + /* In case of an error keep the original viminfo file. Otherwise + * rename the newly written file. Give an error if that fails. */ + if (viminfo_errcnt == 0 && vim_rename(tempname, fname) == -1) { + viminfo_errcnt++; + EMSG2(_("E886: Can't rename viminfo file to %s!"), fname); + } + if (viminfo_errcnt > 0) { os_remove((char *)tempname); } } @@ -2960,13 +2962,10 @@ do_ecmd ( /* It's possible that all lines in the buffer changed. Need to update * automatic folding for all windows where it's used. */ - { - win_T *win; - tabpage_T *tp; - - FOR_ALL_TAB_WINDOWS(tp, win) - if (win->w_buffer == curbuf) + FOR_ALL_TAB_WINDOWS(tp, win) { + if (win->w_buffer == curbuf) { foldUpdateAll(win); + } } /* Change directories when the 'acd' option is set. */ |