On Tuesday, September 3, 2013 10:31:59 AM UTC+9, Geoff Greer wrote:
> Tony,
> 
> Thanks for the feedback. I've attached a new patch with some basic comments 
> and non-ANSI C function definitions.
> 
> I'd really like to get feedback on the changes to gui_wait_for_chars() and 
> mch_inchar(). That's where the meat of this patch is.
> 
> Sincerely,
> 
> Geoff
> 
> On Monday, September 2, 2013 5:00:00 PM UTC-7, Tony Mechelynck wrote:
> > On 02/09/13 03:42, Geoff Greer wrote:
> > 
> > > This patch adds asynchronous functions to vimscript. If you want to 
> > > perform an action in 700ms, simply:
> > 
> > >
> > 
> > > let timeout_id = settimeout(700, 'echo("hello")')
> > 
> > >
> > 
> > > To cancel the timeout before it's fired:
> > 
> > >
> > 
> > > canceltimeout(timeout_id)
> > 
> > >
> > 
> > > setinterval() also returns an id that can be used with canceltimeout.
> > 
> > >
> > 
> > > The reason for this patch is simple: asynchronous functionality is needed 
> > > to implement real-time collaborative editing in Vim. This is one of the 
> > > most voted-for features (see http://www.vim.org/sponsor/vote_results.php).
> > 
> > >
> > 
> > > Along with Matt Kaniaris, I founded Floobits to build real-time 
> > > collaboration into every editor. We wrote a plugin for Vim, but we had to 
> > > use hacks to get async behavior (abusing feedkeys or client-server). 
> > > These methods had side-effects such as breaking leaderkeys or other 
> > > shortcuts. After a lot of experimenting, we decided to try patching Vim.
> > 
> > >
> > 
> > > Since Vim is character-driven, we had to munge some low-level input 
> > > functions to get the desired behavior. We changed gui_wait_for_chars() 
> > > and mch_inchar() so that call_timeouts() is run every ticktime 
> > > milliseconds. The default ticktime is 100ms.
> > 
> > >
> > 
> > > This patch isn't finished yet, but it works on unix-based OSes. If the 
> > > reaction is positive, our intention is to change mch_inchar() (or 
> > > something similar) in other OS-specific files. That will get async 
> > > functions working for everyone.
> > 
> > >
> > 
> > > Even if our patch isn't the best approach, we'd love to help get async 
> > > functions in Vim. Doing so will open the door to a lot of cool plugins.
> > 
> > >
> > 
> > > Oh, and this is the first time either myself or Matt have submitted a 
> > > patch to Vim, so please be gentle.
> > 
> > >
> > 
> > > Sincerely,
> > 
> > >
> > 
> > > Geoff Greer
> > 
> > >
> > 
> > Your patch is not in the approved coding style (see :help style-examples)
> > 
> > 
> > 
> > Wrong:
> > 
> > 
> > 
> >     void
> > 
> > insert_timeouts(timeout_T *to) {
> > 
> >     timeout_T *cur = timeouts
> > 
> >     timeout_T *prev = NULL
> > 
> > 
> > 
> > 
> > 
> > OK:
> > 
> > /*
> > 
> >   * Explanation of what the function is used for
> > 
> >   * and of how to call it
> > 
> >   */
> > 
> >     void
> > 
> > insert_timeouts(to)
> > 
> >     timeout_T *to;                  /* short comment about to */
> > 
> > {
> > 
> >     timeout_T *cur = timeouts;      /* short comment about cur */
> > 
> >     timeout_T *prev = NULL;         /* short comment about prev */
> > 
> > 
> > 
> > NOTE: Don't use ANSI style function declarations.  A few people still 
> > 
> > have to
> > 
> > use a compiler that doesn't support it.
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > Best regards,
> > 
> > Tony.
> > 
> > -- 
> > 
> > Consensus Terrorism:
> > 
> >     The process that decides in-office attitudes and behavior.
> > 
> >             -- Douglas Coupland, "Generation X: Tales for an Accelerated
> > 
> >                Culture"

I live this patch. Bram, we discused about this similar topic at several times. 
And you didn't answer whether vim will include this feature clearly.
However, I think this feature is extendable way which vim get modern software 
designs. Let's include this feature!

Thanks.

- Yasuhiro Matsumoto

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Raspunde prin e-mail lui