Christian Brabandt wrote:

> Hi Nikolay!
> 
> On Fr, 05 Aug 2016, Nikolay Aleksandrovich Pavlov wrote:
> 
> > 2016-08-05 0:09 GMT+03:00 Christian Brabandt <[email protected]>:
> > > Hi Bram!
> > >
> > > On Do, 04 Aug 2016, Bram Moolenaar wrote:
> > >
> > >> Christian Brabandt wrote:
> > >> > Hi,
> > >> > we have a timer_start() and a timer_stop() function.
> > >> > Shouldn't we also have a function that returns the status of a timer?
> > >> > And perhaps a way to query all active timers? Something like
> > >> > timer_get([id])? And perhaps a way to modify an active timer, like
> > >> > timer_modify(id)?
> > >>
> > >> Are there examples of practical use?
> > >
> > > I have been writing a plugin that uses timers. And among the thing
> > > I would like to have are:
> > >
> > > - Disable a particular timer temporarily
> > > - Modify the time parameter for a particular timer
> > > - Find out, what timers are currently active (helps for debugging in
> > >   case of problems)
> > > - Change the callback function or repeat parameter depending on the
> > >   users configuration
> > 
> > Disable/modify/change can be implemented on top of
> > timer_start()/timer_stop(): just remove the timer and readd for
> > modify/change or when it needs to be enabled. I do not find
> > timer_modify() useful enough to have it coded in C.
> 
> yeah, that's my current workaround.

I think it's usually find to stop a timer and start a new one, instead
of trying to change the existing timer.

> > Function that gets a list of all timers would be useful.
> 
> Yes, and perhaps a timer_stop('ALL'), so the user can, just in case 
> something went wrong, disable all active timers. But then we would also 
> need the possibility to check, whether a timer is still active...

I think we need a timer_info() function, which returns a list with all
timers.  Should be enough to recognize a timer so you can stop the one
that's causing trouble.  And timer_info(id) the info about one timer.
Would mostly be for debugging.

Otherwise, a ":call timer_stop_all()" would be useful if something is
going haywire.  Or perhaps "timer_stopall()".

-- 
Friends?  I have lots of friends!  In fact, I have all episodes ever made.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
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/d/optout.

Raspunde prin e-mail lui