Xavier de Gaye wrote:

> It is not clear if netbeans "killed" events are correctly sent by Vim.
> 
> For example with 2 windows displaying each a different buffer,
> ':[N]bunload' will trigger a "killed" event, and ':quit' on this same
> buffer will not trigger the event, however both commands have the same
> effects.
> 
> "killed" events are sent by netbeans_file_closed().
> Below is the reverse call-graph of netbeans_file_closed() (in this
> graph, a function is called by all functions at the next indentation
> level):
> 
> netbeans_file_closed: (a)
>     close_buffer
>         set_curbuf
>         do_ecmd
>         ex_window
>         win_close
>         win_close_othertab
>         ...
>         do_buffer
>             goto_buffer
>             nb_do_cmd: (b) when processing "close" netbeans command
>             do_bufdel: (c)
>                 ex_bunload
>                 nb_do_cmd: (d) only if "netbeansBuffer", when
>                            processing "stopDocumentListen" netbeans
>                            command
> 
> The global variable netbeansCloseFile is only used in
> netbeans_file_closed() and do_bufdel().
> (a) pseudo code for netbeans_file_closed():
>     if netbeansCloseFile
>         send "killed" event and "forget" the reference to the Vim
>         buffer in the netbeans buffer structure
>     else
>         debug message: "Ignoring file_closed. File was closed from
>         IDE" and return
> (b) nb_do_cmd: does not trigger a "killed" event
> (c) do_bufdel: set netbeansCloseFile = 1 at start, reset to zero
>                  before function exit
> (d) nb_do_cmd: triggers a "killed" event only if the buffer is a
>                "netbeansBuffer"
> 
> Occurences of "killed" events:
> * Only bunload, bdelete and bwipeout Vim commands trigger a "killed"
>   event
> * In (d), why the netbeans application would want to receive a
>   "killed" event when it is the one that sets the buffer as a
>   "netbeansBuffer" and the one that is responsible for sending the
>   "stopDocumentListen" command that triggers this event ? This does
>   not make sense
> 
> Note also that when setting netbeans debug mode, the message "Ignoring
> file_closed. File was closed from IDE" is printed when a buffer is
> closed by any Vim command other than bunload, bdelete, bwipeout and
> this message is obviously wrong since it is closed from Vim, not from
> the IDE.
> 
> Conclusion:
> As it is, "killed" events are useless for the netbeans application
> (but they cannot be ignored as the bufno reference is not anymore
> valid after receiving the event).
> I would like to propose to remove the global netbeansCloseFile
> entirely from the code, expecting that this would cause a "killed"
> event whenever a buffer is not anymore visible in any window, but I
> don't know Vim code sufficiently to be sure that this is the case.

I think netbeans_file_closed() should be invoked whenever buf_freeall()
has been called and the buffer used there is still valid (autocommands
didn't get in the way).  It might even be possible to do it at the end
of buf_freeall().  Need to look very closely into what is being accessed
to be able to decide where it should be done.

Can you propose a patch for that?

-- 
hundred-and-one symptoms of being an internet addict:
226. You sit down at the computer right after dinner and your spouse
     says "See you in the morning."

 /// 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    ///

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui