From 273358651af6b6d172944cd1b1b41a9869d53b10 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 29 Nov 2022 20:09:07 +0800 Subject: refactor: buffer_ensure_loaded() Cherry-picked from Vim patch 8.1.1612. --- src/nvim/eval/buffer.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/nvim/eval/buffer.c') diff --git a/src/nvim/eval/buffer.c b/src/nvim/eval/buffer.c index 4816a955a8..72eb0f8d67 100644 --- a/src/nvim/eval/buffer.c +++ b/src/nvim/eval/buffer.c @@ -302,13 +302,8 @@ void f_bufload(typval_T *argvars, typval_T *unused, EvalFuncData fptr) { buf_T *buf = get_buf_arg(&argvars[0]); - if (buf != NULL && buf->b_ml.ml_mfp == NULL) { - aco_save_T aco; - - aucmd_prepbuf(&aco, buf); - swap_exists_action = SEA_NONE; - open_buffer(false, NULL, 0); - aucmd_restbuf(&aco); + if (buf != NULL) { + buffer_ensure_loaded(buf); } } -- cgit From 3173d07564e7cdf0834099a379f0faf480c76224 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 29 Nov 2022 18:20:11 +0800 Subject: vim-patch:9.0.0965: using one window for executing autocommands is insufficient Problem: Using one window for executing autocommands is insufficient. Solution: Use up to five windows for executing autocommands. https://github.com/vim/vim/commit/e76062c078debed0df818f70e4db14ad7a7cb53a N/A patches for version.c: vim-patch:9.0.0966: some compilers don't allow a declaration after a label Problem: Some compilers don't allow a declaration after a label. Solution: Move the declaration to the start of the block. (John Marriott) https://github.com/vim/vim/commit/f86490ed4fdab213a28f667abd055c023a73d645 Co-authored-by: Bram Moolenaar --- src/nvim/eval/buffer.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/nvim/eval/buffer.c') diff --git a/src/nvim/eval/buffer.c b/src/nvim/eval/buffer.c index 72eb0f8d67..6ebf54ef0f 100644 --- a/src/nvim/eval/buffer.c +++ b/src/nvim/eval/buffer.c @@ -86,6 +86,8 @@ static void find_win_for_curbuf(void) /// /// Information is saved in "cob" and MUST be restored by calling /// change_other_buffer_restore(). +/// +/// If this fails then "curbuf" will not be equal to "buf". static void change_other_buffer_prepare(cob_T *cob, buf_T *buf) { CLEAR_POINTER(cob); @@ -103,7 +105,9 @@ static void change_other_buffer_prepare(cob_T *cob, buf_T *buf) // curwin->w_buffer differ from "curbuf", use the autocmd window. curbuf = curwin->w_buffer; aucmd_prepbuf(&cob->cob_aco, buf); - cob->cob_using_aco = true; + if (curbuf == buf) { + cob->cob_using_aco = true; + } } } -- cgit