On Sat, 7 Oct 2006 at 8:40pm, A.J.Mechelynck wrote:

> Hari Krishna Dara wrote:
> [...]
> > In the vimrc_example.vim, there is a common on this and part of it says:
> >
> >   " Don't do it when the position is invalid or when inside an event
handler
> >   " (happens when dropping a file on gvim).
> >
> > Any idea what it is exactly talking about? Is the "Don't do it" part
> > a comment on how the functionality of the autocommand or an instruction
> > to the user?
> >

[snip]

> "Inside an event handler" means that the autocommand is not defined as
> "nested", which means that the autocommand will not be triggered from within
> an autocommand for a different event (as when, IIUC, a file is drag-dropped
> onto an existing gvim window). I don't use drag-drop for Vim so this doesn't
> bother me. If you often encounter the problem, you might try adding the
> "nested" keyword to the autocommand (see ":help autocmd-nested") but there
> might be side-effects. I suppose Bram didn't lightly choose to add a comment
> rather than a keyword.

I don't know where you got the notion of "nested" in the above comment,
but I think you are actually wrong and that it is irrelevant here. When
you define an autocommand (call as parent), adding nested keyword allows
other autocommands (call as children) to be triggered from the actions
performed by the parent autocommand. If BufReadPost got triggered, it
means it either triggered as a parent autocommand (as a direct user
action), or as a child autocommand of another parent autocommand that
allowed nesting.

Given the above explanation, I still don't understand the comment. Is
there a different autocommand that gets triggered while dnding files? If
so which one is it? If that autocommand allows nesting, how are we
detecting that BufReadPost is being nested (or a child, in my terms)
here (I don't see any special condition). Last but not least, why is
setting a position in such a situation wrong?

In any case, I actually tried doing dnd of files on gvim with this
autocommand, and it seems to just work fine, preserving cursor
positions. Is the comment not relevant anymore? Would you care to
elaborate your earlier explanation? Sorry for being so finicky, I just
want to understand that's all.

-- 
Thanks,
Hari

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

Reply via email to