Loading ...
Sorry, an error occurred while loading the content.

Re: BufDelete

Expand Messages
  • Andy Wokula
    ... BufDelete is not executed for unlisted buffers. Should :b {buf} always make buffers listed again? I think no . Just set bl manually, everything should
    Message 1 of 3 , Dec 3, 2012
    • 0 Attachment
      Am 03.12.2012 11:25, schrieb Marcin Szamotulski:
      > 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

      :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.

      --
      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
    • Marcin Szamotulski
      ... 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
      Message 2 of 3 , Dec 3, 2012
      • 0 Attachment
        On 19:20 Mon 03 Dec , Andy Wokula wrote:
        > Am 03.12.2012 11:25, schrieb Marcin Szamotulski:
        > > 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
        >
        > :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.
        >
        > --
        > 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

        --
        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
      Your message has been successfully submitted and would be delivered to recipients shortly.