Regression: :resize in :autocmd on :copen fails with E788 (after 8.0.677)#1804
Regression: :resize in :autocmd on :copen fails with E788 (after 8.0.677)#1804inkarkat wants to merge 1 commit intovim:mastervim/vim:masterfrom inkarkat:test-resize-from-copeninkarkat/vim:test-resize-from-copenCopy head branch name to clipboard
Conversation
…0677)
I have an :autocmd that adapts the height of the quickfix window if there are fewer entries in it than the window height (to save screen space). It boils down to this:
:autocmd BufRead quickfix resize [N]
Since Vim 8.0.0677 (setting 'filetype' may switch buffers; found through bisecting), this fails with "E788: Not allowed to edit another buffer now".
The patch locks the current buffer. However, I don't see why resizing the current window should be affected by the lock.
I tried following the call chain of :resize, but couldn't locate where this encounters the check of curbuf_lock. All I can offer is the following test (based on Test_cclose_from_copen()) that highlights the regression. It also uses ":autocmd FileType qf" instead of ":autocmd BufRead quickfix"; both show the issue.
|
Copying here my message from the vim-dev ml: ,----[ quickfix.c ]- we are setting curbuf_lock. set_option_value() triggers the FileType ,----[ ex_docmd.c ]- However it is not clear to me, why there is the check to curbuf_locked() diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index bdd152dfd..a7946d872 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -2468,7 +2468,7 @@ do_one_cmd(
&& ea.cmdidx != CMD_edit
&& ea.cmdidx != CMD_checktime
&& !IS_USER_CMDIDX(ea.cmdidx)
- && curbuf_locked())
+ && (ea.addr_type && curbuf_locked()))
goto doend;
#endif(Well, this seems to fix your case, while still preventing e.g. Best, |
|
Hello. I configure as moving help window by |
|
I also have the same [new] E788 problem recently and still in 8.0.702 with this - This ex_docmd.c change (from above): resolves it. |
Problem: Cannot resize the window in a FileType autocommand. (Ingo Karkat)
Solution: Add the CMDWIN flag to :resize. (test by Ingo Karkat,
closes vim#1804)
Problem: Problems with autocommands when opening help.
Solution: Avoid using invalid "varp" value. Allow using :wincmd if buffer
is locked. (closes vim/vim#1806, closes vim/vim#1804)
vim/vim@163095f
Problem: Cannot resize the window in a FileType autocommand. (Ingo Karkat)
Solution: Add the CMDWIN flag to :resize. (test by Ingo Karkat,
closes vim/vim#1804)
vim/vim@9c4feff
Problem: Cannot resize the window in a FileType autocommand. (Ingo Karkat)
Solution: Add the CMDWIN flag to :resize. (test by Ingo Karkat,
closes vim/vim#1804)
vim/vim@9c4feff
Problem: Cannot resize the window in a FileType autocommand. (Ingo Karkat)
Solution: Add the CMDWIN flag to :resize. (test by Ingo Karkat,
closes vim/vim#1804)
vim/vim@9c4feff
I have an
:autocmdthat adapts the height of the quickfix window if there are fewer entries in it than the window height (to save screen space). It boils down to this:Since Vim 8.0.0677 (setting 'filetype' may switch buffers; found through bisecting), this fails with
E788: Not allowed to edit another buffer now.The patch locks the current buffer. However, I don't see why resizing the current window should be affected by the lock.
I tried following the call chain of
:resize, but couldn't locate where this encounters the check ofcurbuf_lock. All I can offer is the following test (based onTest_cclose_from_copen()) that highlights the regression. It also uses:autocmd FileType qfinstead of:autocmd BufRead quickfix; both show the issue.