On Sep 18, 2012, at 11:19 AM, Hans-Jörg Bibiko <bib...@eva.mpg.de> wrote:
> I know this is not the preferred way to send a change request but it's only > one entire file: Hopefully final version will be a real pull request :) > The idea is to find the front most OakTextView first and then to process > insert_text or insert_snippet. > If no OakTextView was found it creates a new untitled document before > inserting. Here I have a problem: How to know after invoking > newDocumentAndActivate: whether TM2 did load the new window entirely? I > solved it tentatively by using usleep(10000) to give TM2 a bit time but this > is _not_ elegant. The issue here is that it happened to me in 10% of all > trials that "insert_text" was faster then the initialization of the new doc, > i.e. I saw the inserted text for a few msecs before the initialization > routine replaced its content by @"". Try use performSelector:afterDelay: (with 0) — the problem is often that work is delayed until the end of the current iteration of the event loop. By using performSelector:afterDelay: you get your code executed on the next iteration of the event loop. _______________________________________________ textmate-dev mailing list textmate-dev@lists.macromates.com http://lists.macromates.com/listinfo/textmate-dev