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.
https://github.com/vim/vim/pull/1804
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
Copying here my message from the vim-dev ml:
Hm, here:
,----[ quickfix.c ]-
| 3428 #ifdef FEAT_AUTOCMD
| 3429 ++curbuf_lock;
| 3430 #endif
| 3431 set_option_value((char_u *)"ft", 0L, (char_u )"qf", OPT_LOCAL);
| 3432 curbuf->b_p_ma = FALSE;
| 3433
| 3434 #ifdef FEAT_AUTOCMD
| 3435 keep_filetype = TRUE; / don't detect 'filetype' */
`----
&& curbuf_locked())
&& (ea.addr_type && curbuf_locked()))
goto doend;
#endif
(Well, this seems to fix your case, while still preventing e.g.
au Filetype qf wincmd p)
Best,
Christian
—
Hello. I configure as moving help window by autocmd FileType help if &l:buftype ==# 'help' | wincmd K | endif
. It worked with no errors before but emits E788 error recently. I believe my issue is related to this.
Ken Hamada
I also have the same [new] E788 problem recently and still in 8.0.702 with this -
au FileType qf call AdjustWindowHeight(5, 10)
function! AdjustWindowHeight(minheight, maxheight)
let l = 1
let n_lines = 0
let w_width = winwidth(0)
while l <= line('$')
" number to float for division
let l_len = strlen(getline(l)) + 0.0
let line_width = l_len/w_width
let n_lines += float2nr(ceil(line_width))
let l += 2
endw
exe max([min([n_lines, a:maxheight]), a:minheight]) . "wincmd _"
endfunction
This ex_docmd.c change (from above):
&& curbuf_locked())
&& (ea.addr_type && curbuf_locked()))
resolves it.