BufDelete

29 views
Skip to first unread message

Marcin Szamotulski

unread,
Dec 3, 2012, 5:25:25 AM12/3/12
to Vim Dev
Dear vim_dev,

I think I have found a bug in BufDelete autocommand. When I delete
a buffer, load it (with the :buffer command) and then delete it again
(with :bdelete) the BufDelete autocommand group is not triggered.

I tested this with vim -u NONE --noplugin

:au BufDelete * :echom 'BufDelete' expand('<afile>')
:e /tmp/x
" Now in messages there is one buffer deleted - the [No Name] buffer
:bd
" Now in messages there is 'BufDelete /tmp/x'
:b1
" Next [No Name] buffer deleted, we are back in /tmp/x
:bd
" The BufDelete autocommand was not triggered

Regards,
Marcin

Andy Wokula

unread,
Dec 3, 2012, 1:20:06 PM12/3/12
to vim...@googlegroups.com
:bd makes buffers unlisted.
:h 'bl

BufDelete is not executed for unlisted buffers.
Should :b {buf} always make buffers listed again? I think "no".
Just set 'bl' manually, everything should be fine.

--
Andy

Note: Untested, you should re-check all statements.

Marcin Szamotulski

unread,
Dec 3, 2012, 1:43:05 PM12/3/12
to vim...@googlegroups.com
> --
> You received this message from the "vim_dev" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php

Thank you. I think I should use BufUnload autocommand group then, it is
triggered regardless the 'bl' setting. I also found that BufDelete is
triggered when "set nobl" is run.

Best,
Marcin
Reply all
Reply to author
Forward
0 new messages