To: vim-dev@vim.org Subject: Patch 6.2f.006 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.2f.006 Problem: When saving a file takes a while and Vim regains focus this can result in a "file changed outside of Vim" warning and ml_get() errors. (Mike Williams) Solution: Add the "b_saving" flag to avoid checking the timestamp while the buffer is being saved. (Michael Schaap) Files: src/fileio.c, src/structs.h *** ../vim-6.2f.005/src/fileio.c Mon May 26 22:15:06 2003 --- src/fileio.c Mon May 26 21:08:40 2003 *************** *** 2800,2805 **** --- 2800,2808 ---- prev_got_int = got_int; got_int = FALSE; + /* Mark the buffer as 'being saved' to prevent changed buffer warnings */ + buf->b_saving = TRUE; + /* * If we are not appending or filtering, the file exists, and the * 'writebackup', 'backup' or 'patchmode' option is set, need a backup. *************** *** 3960,3965 **** --- 3963,3971 ---- --no_wait_return; /* may wait for return now */ nofail: + /* Done saving, we accept changed buffer warnings again */ + buf->b_saving = FALSE; + vim_free(backup); if (buffer != smallbuf) vim_free(buffer); *************** *** 5387,5399 **** int save_mouse_correct = need_mouse_correct; #endif ! /* If there is no file name, the buffer is not loaded, or 'buftype' is ! * set: ignore this buffer. */ if (buf->b_ffname == NULL || buf->b_ml.ml_mfp == NULL #if defined(FEAT_QUICKFIX) || *buf->b_p_bt != NUL #endif ) return 0; --- 5393,5406 ---- int save_mouse_correct = need_mouse_correct; #endif ! /* If there is no file name, the buffer is not loaded, 'buftype' is ! * set, or we are in the middle of a save: ignore this buffer. */ if (buf->b_ffname == NULL || buf->b_ml.ml_mfp == NULL #if defined(FEAT_QUICKFIX) || *buf->b_p_bt != NUL #endif + || buf->b_saving ) return 0; *** ../vim-6.2f.005/src/structs.h Mon May 26 22:15:06 2003 --- src/structs.h Mon May 26 21:08:40 2003 *************** *** 904,909 **** --- 904,912 ---- file has been changed and not written out. */ int b_changedtick; /* incremented for each change, also for undo */ + int b_saving; /* Set to TRUE if we are in the middle of + saving the buffer. */ + /* * Changes to a buffer require updating of the display. To minimize the * work, remember changes made and update everything at once. *** ../vim-6.2f.005/src/version.c Mon May 26 23:00:43 2003 --- src/version.c Mon May 26 23:02:14 2003 *************** *** 632,633 **** --- 632,635 ---- { /* Add new patch number below this line */ + /**/ + 6, /**/ -- CRONE: Who sent you? ARTHUR: The Knights Who Say GNU! CRONE: Aaaagh! (she looks around in rear) No! We have no shrubberies here. "Monty Python and the Holy editor wars" PYTHON (MONTY) SOFTWARE LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///