From 309296545cf0c8556d82f81703eef4cdc7e539d3 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Wed, 31 Jul 2019 21:42:47 -0400 Subject: vim-patch:8.1.1780: warning for file no longer available is repeated Problem: Warning for file no longer available is repeated every time Vim is focused. (Brian Armstrong) Solution: Only give the message once. (closes vim/vim#4748) https://github.com/vim/vim/commit/674e2bde6e7b0c468f304713aa8f97a45e1fcc89 --- src/nvim/fileio.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 907e6c978a..82cf79722e 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -4840,6 +4840,8 @@ buf_check_timestamp( || time_differs(file_info.stat.st_mtim.tv_sec, buf->b_mtime) || (int)file_info.stat.st_mode != buf->b_orig_mode )) { + const long prev_b_mtime = buf->b_mtime; + retval = 1; // set b_mtime to stop further warnings (e.g., when executing @@ -4903,9 +4905,12 @@ buf_check_timestamp( return 2; } if (!n) { - if (*reason == 'd') - mesg = _("E211: File \"%s\" no longer available"); - else { + if (*reason == 'd') { + // Only give the message once. + if (prev_b_mtime != -1) { + mesg = _("E211: File \"%s\" no longer available"); + } + } else { helpmesg = TRUE; can_reload = TRUE; /* -- cgit