This permits plugins which use writefile()
to write to a buffer, to also update the buffer's mtime
, so future :write
s won't then think there's been a change to the file outside of vim
https://github.com/vim/vim/pull/15857
(8 files)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
@bobrippling pushed 2 commits.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.
@bobrippling pushed 2 commits.
You are receiving this because you are subscribed to this thread.
Test failure appears to be unrelated:
From test_popupwin.vim:
Found errors in Test_popup_beval():
Run 1, 18:00:10 - 18:00:23:
command line
..script /Users/runner/work/vim/vim/src/testdir/runtest.vim[607]
..function RunTheTest[57]
..Test_popup_beval[39]
..VerifyScreenDump
line 67: See dump file difference: call term_dumpdiff("testdir/failed/Test_popupwin_beval_3.dump", "testdir/dumps/Test_popupwin_beval_3.dump");
difference in line 4: "|4| @10|t+0#0000001#ffd7ff255|e|x|t| +0#0000000#ffffff0@58"
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
@zeertzjq commented on this pull request.
> @@ -12417,6 +12417,10 @@ writefile({object}, {fname} [, {flags}]) *writefile()* When {flags} does not contain "S" or "s" then fsync() is called if the 'fsync' option is set. + 't' if the {fname} corresponds to a buffer, update that buffer's + modified time so future writes to the buffer don't think there's + changes outside of vim.⬇️ Suggested change
- changes outside of vim. + changes outside of Vim.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@bobrippling pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@bobrippling commented on this pull request.
> @@ -12417,6 +12417,10 @@ writefile({object}, {fname} [, {flags}]) *writefile()* When {flags} does not contain "S" or "s" then fsync() is called if the 'fsync' option is set. + 't' if the {fname} corresponds to a buffer, update that buffer's + modified time so future writes to the buffer don't think there's + changes outside of vim.
Thanks - sorted
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Thanks. Can you plesae add a test? I suppose you could use :let mess=execute(':w')
after using writefile()
and then check, that mess
does not contain the warning. Or perhaps use :checktime
and check that W11
isn't returned.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.
On testing this, I'm not convinced it's that useful - my initial usecase was to do a background write to a slow filesystem, without locking up Vim's UI, but writefile
is still called synchronously (even from a timer).
I need to find a different approach to write the file and then update vim's mtime
, I'll put this into draft for now
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.
you may want to consider disabling the 'fsync' option.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.
Ah thank you, I'll see how well that helps
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.
@k-takata commented on this pull request.
> +#ifdef UNIX +buf_T *buflist_findname_stat(char_u *ffname, stat_T *stp); +#endif
This file is generated by the cproto command. The #ifdef
and #endif
lines are not needed:
-#ifdef UNIX -buf_T *buflist_findname_stat(char_u *ffname, stat_T *stp); -#endif +buf_T *buflist_findname_stat(char_u *ffname, stat_T *stp);
However, the definitions of buflist_findname()
and buflist_findname_stat()
need to be adjusted to make cproto work. E.g.:
buf_T * buflist_findname(char_u *ffname) { #ifdef UNIX stat_T st; if (mch_stat((char *)ffname, &st) < 0) st.st_dev = (dev_T)-1; return buflist_findname_stat(ffname, &st); #else return buflist_findname_stat(ffname, NULL); #endif } /* * Same as buflist_findname(), but pass the stat structure to avoid getting it * twice for the same file. * Returns NULL if not found. */ buf_T * buflist_findname_stat( char_u *ffname, stat_T *stp) { buf_T *buf; // Start at the last buffer, expect to find a match sooner. FOR_ALL_BUFS_FROM_LAST(buf) if ((buf->b_flags & BF_DUMMY) == 0 && !otherfile_buf(buf, ffname #ifdef UNIX , stp #endif )) return buf; return NULL; }
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.
Closed #15857.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.
Thanks for the review and comments - 'fsync'
seems to have alleviated this so I'll close the PR (don't think there's further use in providing the ability to update a buffer's mtime
for now)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.