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.
Xavier
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---