comparison src/ex_cmds2.c @ 14642:96858d612aff v8.1.0334

patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written commit https://github.com/vim/vim/commit/8c9e7b00f6566dc41e794ef11c93d93b034c7134 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Aug 30 13:07:17 2018 +0200 patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written Problem: 'autowrite' takes effect when buffer is not to be written. Solution: Don't write buffers that are not supposed to be written. (Even Q Jones, closes #3391) Add tests for 'autowrite'.
author Christian Brabandt <cb@256bit.org>
date Thu, 30 Aug 2018 13:15:06 +0200
parents f761a55a8aed
children 0d5726f2913b
comparison
equal deleted inserted replaced
14641:cdd20c9fd5a4 14642:96858d612aff
2039 r = FAIL; 2039 r = FAIL;
2040 return r; 2040 return r;
2041 } 2041 }
2042 2042
2043 /* 2043 /*
2044 * flush all buffers, except the ones that are readonly 2044 * Flush all buffers, except the ones that are readonly or are never written.
2045 */ 2045 */
2046 void 2046 void
2047 autowrite_all(void) 2047 autowrite_all(void)
2048 { 2048 {
2049 buf_T *buf; 2049 buf_T *buf;
2050 2050
2051 if (!(p_aw || p_awa) || !p_write) 2051 if (!(p_aw || p_awa) || !p_write)
2052 return; 2052 return;
2053 FOR_ALL_BUFFERS(buf) 2053 FOR_ALL_BUFFERS(buf)
2054 if (bufIsChanged(buf) && !buf->b_p_ro) 2054 if (bufIsChanged(buf) && !buf->b_p_ro && !bt_dontwrite(buf))
2055 { 2055 {
2056 bufref_T bufref; 2056 bufref_T bufref;
2057 2057
2058 set_bufref(&bufref, buf); 2058 set_bufref(&bufref, buf);
2059 2059