Re: Tab autocommand inconsistencies?

2006-06-17 Thread Bram Moolenaar

Hari Krishna Dara wrote:

 I am observing what might be inconsistency in the order in which vim
 fires autocommands. First, ovserving the order of buffer and window events,
 
 - Using :new:
 
 WinLeave
 WinEnter
 BufLeave
 BufEnter
 
 - Using :wincmd w
 
 BufLeave
 WinLeave
 WinEnter
 BufEnter
 
 
 When combined with tab operations,
 
 - Using, :tabe:
 
 WinLeave
 TabLeave
 TabEnter
 WinEnter
 BufLeave
 BufEnter
 
 - Using :tabnext:
 
 BufLeave
 WinLeave
 TabLeave
 WinEnter
 TabEnter
 BufEnter
 
 Extrapolating the first two, I was expecting these to be
 
 - For tabe:
 
 TabLeave
 TabEnter
 WinLeave
 WinEnter
 BufLeave
 BufEnter
 
 - For :tabnext:
 
 BufLeave
 WinLeave
 TabLeave
 TabEnter
 WinEnter
 BufEnter
 
 Is the existing behavior expected? Does anyone agree that it is
 inconsistent? I am even surprised that they should differ between
 switching between the existing windows/tabs and creating new ones.

The problem with autocommands is that they must run in a valid
environment to avoid trouble (as in a crashing Vim).  This is quite
tricky, especially in combination with error handling (e.g., not being
able to abandon a buffer).

The order of autocommands changed at a late moment in 7.0 development to
work around problems (no valid window when TabEnter was triggered, if I
remember correctly).  I rather not change it again, it might introduce
bugs.

-- 
DINGO:   And after the spanking ... the oral sex.
GALAHAD: Oh, dear! Well, I...
GIRLS:   The oral sex ...  The oral sex.
GALAHAD: Well, I suppose I could stay a BIT longer.
 Monty Python and the Holy Grail PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\download, build and distribute -- http://www.A-A-P.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///


Re: Tab autocommand inconsistencies?

2006-05-16 Thread Eric Arnold

I'm not sure I fully get what's going on, but I think is has to do
with the window that is automatically cloned to start the tab, which
is then converted to an empty buffer window.



On 5/15/06, Hari Krishna Dara [EMAIL PROTECTED] wrote:


Just wanted to send the script that I used, in case anyone is interested
to repeat:

let g:auCount = 0
aug TT
  au!
  au WinEnter * :call Au('WinEnter')
  au WinLeave * :call Au('WinLeave')
  au TabEnter * :call Au('TabEnter')
  au TabLeave * :call Au('TabLeave')
  au BufEnter * :call Au('BufEnter')
  au BufLeave * :call Au('BufLeave')
aug END

function! Au(autype)
  let g:auCount = g:auCount + 1
  echomsg a:autype.' '.g:auCount
  call input(a:autype)
endfunction

--
Thanks,
Hari

On Mon, 15 May 2006 at 5:08pm, Hari Krishna Dara wrote:


 I am observing what might be inconsistency in the order in which vim
 fires autocommands. First, ovserving the order of buffer and window events,

 - Using :new:

 WinLeave
 WinEnter
 BufLeave
 BufEnter

 - Using :wincmd w

 BufLeave
 WinLeave
 WinEnter
 BufEnter


 When combined with tab operations,

 - Using, :tabe:

 WinLeave
 TabLeave
 TabEnter
 WinEnter
 BufLeave
 BufEnter

 - Using :tabnext:

 BufLeave
 WinLeave
 TabLeave
 WinEnter
 TabEnter
 BufEnter

 Extrapolating the first two, I was expecting these to be

 - For tabe:

 TabLeave
 TabEnter
 WinLeave
 WinEnter
 BufLeave
 BufEnter

 - For :tabnext:

 BufLeave
 WinLeave
 TabLeave
 TabEnter
 WinEnter
 BufEnter

 Is the existing behavior expected? Does anyone agree that it is
 inconsistent? I am even surprised that they should differ between
 switching between the existing windows/tabs and creating new ones.



__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com



Tab autocommand inconsistencies?

2006-05-15 Thread Hari Krishna Dara

I am observing what might be inconsistency in the order in which vim
fires autocommands. First, ovserving the order of buffer and window events,

- Using :new:

WinLeave
WinEnter
BufLeave
BufEnter

- Using :wincmd w

BufLeave
WinLeave
WinEnter
BufEnter


When combined with tab operations,

- Using, :tabe:

WinLeave
TabLeave
TabEnter
WinEnter
BufLeave
BufEnter

- Using :tabnext:

BufLeave
WinLeave
TabLeave
WinEnter
TabEnter
BufEnter

Extrapolating the first two, I was expecting these to be

- For tabe:

TabLeave
TabEnter
WinLeave
WinEnter
BufLeave
BufEnter

- For :tabnext:

BufLeave
WinLeave
TabLeave
TabEnter
WinEnter
BufEnter

Is the existing behavior expected? Does anyone agree that it is
inconsistent? I am even surprised that they should differ between
switching between the existing windows/tabs and creating new ones.

-- 
Thanks,
Hari

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


Re: Tab autocommand inconsistencies?

2006-05-15 Thread Hari Krishna Dara

Just wanted to send the script that I used, in case anyone is interested
to repeat:

let g:auCount = 0
aug TT
  au!
  au WinEnter * :call Au('WinEnter')
  au WinLeave * :call Au('WinLeave')
  au TabEnter * :call Au('TabEnter')
  au TabLeave * :call Au('TabLeave')
  au BufEnter * :call Au('BufEnter')
  au BufLeave * :call Au('BufLeave')
aug END

function! Au(autype)
  let g:auCount = g:auCount + 1
  echomsg a:autype.' '.g:auCount
  call input(a:autype)
endfunction

-- 
Thanks,
Hari

On Mon, 15 May 2006 at 5:08pm, Hari Krishna Dara wrote:


 I am observing what might be inconsistency in the order in which vim
 fires autocommands. First, ovserving the order of buffer and window events,

 - Using :new:

 WinLeave
 WinEnter
 BufLeave
 BufEnter

 - Using :wincmd w

 BufLeave
 WinLeave
 WinEnter
 BufEnter


 When combined with tab operations,

 - Using, :tabe:

 WinLeave
 TabLeave
 TabEnter
 WinEnter
 BufLeave
 BufEnter

 - Using :tabnext:

 BufLeave
 WinLeave
 TabLeave
 WinEnter
 TabEnter
 BufEnter

 Extrapolating the first two, I was expecting these to be

 - For tabe:

 TabLeave
 TabEnter
 WinLeave
 WinEnter
 BufLeave
 BufEnter

 - For :tabnext:

 BufLeave
 WinLeave
 TabLeave
 TabEnter
 WinEnter
 BufEnter

 Is the existing behavior expected? Does anyone agree that it is
 inconsistent? I am even surprised that they should differ between
 switching between the existing windows/tabs and creating new ones.



__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com