It is done on Vim version : VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Sep 2 2016 18:06:46) MS-Windows 64-bit GUI version with OLE support Included patches: 1-2305 Compiled by marsupilami@DESKTOP-NPML03D
It failed on vim7.4.2290. On Friday, September 2, 2016 at 5:03:45 PM UTC+2, Ni Va wrote: > On Friday, September 2, 2016 at 4:21:02 PM UTC+2, Ni Va wrote: > > Hi, > > > > I'am starting a job and then starting a FunRef by timer_start in order to > > check when job is dead to to next job. > > It appears that timer_stop( from inside the callback Func is not working > > meanwhile it works when called from the main block code just after the > > timer_start. > > > > > > > > > > fu! g:jobsManager.SequencingCallBack(timer) "{{{ > > " if self.GetCurrentJobStatus()=='dead' > > if 1 > > echo "Sequence Handler stopped " . strftime("%T") > > call timer_stop(self.sequenceTimer) " THAT DOES NOT WORK :( :( > > > > endif > > endf"}}} > > fu! g:jobsManager.SequencingJobs() "{{{ > > echo "Sequence Launched " . strftime("%T") > > " Launching Current Job > > call self.StartCurrentJob() > > " Launching Callback Function to check for next job > > let FuncRef = self.SequencingCallBack > > let self.sequenceTimer = timer_start(1000,FuncRef, {'repeat': 15}) > > " call timer_stop(self.sequenceTimer) " THAT WORKS :( :( > > " echo self.GetCurrentJobHandle() > > " echo self.GetCurrentJobStatus() > > endfu > > "}}} > > > > > > > > Notice that self.sequenceTimer is just set/let from the SequencingJobs func > > that is a member of a g:jobManager dict/class and it is not initialized at > > instance. > > let g:BaseClass = {} "{{{ > > fu! g:BaseClass.New(...) "{{{ > > let newObj = copy(self) > > > > if a:0 && type(a:1) == type({}) > > let newObj._attributes = deepcopy(a:1) > > endif > > if exists('*BaseClassProcess') > > let newObj._process = function('BaseClassProcess') > > else > > let newObj._process = function('s:_process_default') > > endif > > > > return newObj > > endfu > > "}}} > > fu! g:BaseClass.setMember(name,val) dict "{{{ > > if !has_key(self, '_attributes') > > echomsg "Creating attributes dict" > > let self._attributes = {} > > endif > > let self._attributes[a:name] = a:val > > " echomsg "BaseClass::setMember: Adding attribute named ".a:name." with > > following content:".string(a:val) > > " echo a:val > > endfu > > "}}} > > fu! g:BaseClass.getMember(name) dict "{{{ > > return get(get(self, '_attributes', {}), a:name) > > " return get(get(self, '_attributes', {}), ''.string(a:name)) > > endfu > > "}}} > > fu! g:BaseClass.process() dict "{{{ > > call self._process() > > endfu > > "}}} > > fu! s:_process_default() "{{{ > > echomsg 'nothing to see here, define BaseClassProcess() to make me > > interesting' > > endfu > > "}}} > > "}}} > > let g:jobsManager = copy(g:BaseClass) > > > > > > > > Thanks for help > > More simple example : > > fu! MyHandler(timer) "{{{ > if 1 > echo "Sequence Handler stopped " . strftime("%T") > call timer_stop(g:sequenceTimer) " THAT DOES NOT WORK :( :( > endif > endf"}}} > let g:sequenceTimer = timer_start(1000,'MyHandler', {'repeat': 15}) > > Don't stop timer at first time execution -- -- You received this message from the "vim_use" 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_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.