Hi all, I'm working with a Vim that has been hacked so that you can get callbacks when data appears on a socket. Basically, our callback system works in pretty much the same way as the code in FEAT_SNIFF. We add the filedescriptors that we are interested in to the select/poll code in os_unix, if there is data pending on a socket then we callback a registered function, which should clear the data from the socket. In my particular case, the callback calls into Lisp code in our embedded Lisp interpreter, which writes data to buffers using ml_replace and ml_append.
Q1) Is using ml_append from (effectively) within RealWaitForChar a bad thing? At the moment it appears to work properly. At the moment, after the callback has run we call screen_update(NOT_VALID). However, from what I can see, calling screen_update may (does?) re-call RealWaitForChar, which can retrigger the callback, etc. Q2) Is this nesting of RealWaitForChar a bad thing? (I thing it may be) Q3) What is the correct way/place to trigger screen_update(NOT_VALID)? How should I trigger it from within RealWaitForChar? One other point to consider, although we may do callbacks, RealWaitForChar may not have keyboard input - what should RealWaitForChar return in this case? If the list would like to see this code, I can post a patch, or you can use Darcs to get a Vim+Callbacks+ECL from http://theclapp.org/repos/vim70+async+ecl/. Q4) Would this callback mechanism be more generally useful for other scripting engines? Cheers Brad