K_IGNORE trick (periodic execution)

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

K_IGNORE trick (periodic execution)

iler.ml
There is trick for periodic execution, involving K_IGNORE and feedkeys
[1].
In the lastest vim 7.2.141, I cannot make it to work anymore.
Timer() is executed only once, as seen from 'echo strftime' printout.
Can anybody confirm this ? Am I missing some global setting ?
'updatetime' is set to 200.

autocmd CursorHold * call Timer()
function! Timer()
  let K_IGNORE = "\x80\xFD\x35"   " internal key code that is ignored
  call feedkeys(K_IGNORE)
  echo strftime("%c") " this for debugging
endfunction

[1] http://vim.wikia.com/wiki/Timer_to_execute_commands_periodically

--
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

To unsubscribe from this group, send email to vim_use+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Reply | Threaded
Open this post in threaded view
|

Re: K_IGNORE trick (periodic execution)

Tony Mechelynck
On 26/03/10 23:01, Yakov wrote:

> There is trick for periodic execution, involving K_IGNORE and feedkeys
> [1].
> In the lastest vim 7.2.141, I cannot make it to work anymore.
> Timer() is executed only once, as seen from 'echo strftime' printout.
> Can anybody confirm this ? Am I missing some global setting ?
> 'updatetime' is set to 200.
>
> autocmd CursorHold * call Timer()
> function! Timer()
>    let K_IGNORE = "\x80\xFD\x35"   " internal key code that is ignored
>    call feedkeys(K_IGNORE)
>    echo strftime("%c") " this for debugging
> endfunction
>
> [1] http://vim.wikia.com/wiki/Timer_to_execute_commands_periodically
>

I confirm as follows:

I tried

        :augroup clock
        :au CursorHold * call feedkeys("\x80\xFD\x35") | echon strftime('%c') " "
        :augroup END

both in gvim (with &enc == "utf-8") and in konsole (with &enc ==
"Latin1") and saw the datestamp displayed only once while I kept hands
off the keyboard & mouse.

In both cases, Huge version 7.2.411, compiled with GTK2/Gnome2 GUI;
'updatetime' is set to 4000 (the default).


Maybe I missed something too?


Best regards,
Tony.
--
All wars are civil wars, because all men are brothers ... Each one owes
infinitely more to the human race than to the particular country in
which he was born.
                -- Francois Fenelon

--
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

To unsubscribe from this group, send email to vim_use+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Reply | Threaded
Open this post in threaded view
|

Re: K_IGNORE trick (periodic execution)

Christian Brabandt
In reply to this post by iler.ml
Hi Yakov!

On Fr, 26 Mär 2010, Yakov wrote:

> There is trick for periodic execution, involving K_IGNORE and feedkeys
> [1].
> In the lastest vim 7.2.141, I cannot make it to work anymore.
> Timer() is executed only once, as seen from 'echo strftime' printout.
> Can anybody confirm this ? Am I missing some global setting ?
> 'updatetime' is set to 200.
>
> autocmd CursorHold * call Timer()
> function! Timer()
>   let K_IGNORE = "\x80\xFD\x35"   " internal key code that is ignored
>   call feedkeys(K_IGNORE)
>   echo strftime("%c") " this for debugging
> endfunction

I noticed that too when experimenting with this.
http://groups.google.com/group/vim_use/msg/34fafea1d489cc62
(and this with Windows vim vesion 7.2.330(?) not sure right now)

regards,
Christian

--
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

To unsubscribe from this group, send email to vim_use+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Reply | Threaded
Open this post in threaded view
|

Re: K_IGNORE trick (periodic execution)

Bram Moolenaar
In reply to this post by Tony Mechelynck

Tony Mechelynck wrote:

> On 26/03/10 23:01, Yakov wrote:
> > There is trick for periodic execution, involving K_IGNORE and feedkeys
> > [1].
> > In the lastest vim 7.2.141, I cannot make it to work anymore.
> > Timer() is executed only once, as seen from 'echo strftime' printout.
> > Can anybody confirm this ? Am I missing some global setting ?
> > 'updatetime' is set to 200.
> >
> > autocmd CursorHold * call Timer()
> > function! Timer()
> >    let K_IGNORE = "\x80\xFD\x35"   " internal key code that is ignored
> >    call feedkeys(K_IGNORE)
> >    echo strftime("%c") " this for debugging
> > endfunction
> >
> > [1] http://vim.wikia.com/wiki/Timer_to_execute_commands_periodically
> >
>
> I confirm as follows:
>
> I tried
>
> :augroup clock
> :au CursorHold * call feedkeys("\x80\xFD\x35") | echon strftime('%c') " "
> :augroup END
>
> both in gvim (with &enc == "utf-8") and in konsole (with &enc ==
> "Latin1") and saw the datestamp displayed only once while I kept hands
> off the keyboard & mouse.
>
> In both cases, Huge version 7.2.411, compiled with GTK2/Gnome2 GUI;
> 'updatetime' is set to 4000 (the default).
>
>
> Maybe I missed something too?

This was changed in patch 7.2.025:

Patch 7.2.025
Problem:    When a CursorHold event invokes system() it is retriggered over
            and over again.
Solution:   Don't reset did_cursorhold when getting K_IGNORE.
Files:    src/normal.c


You can use something like "f\e" instead:

 autocmd CursorHold * call Timer()
 function! Timer()
    call feedkeys("f\e")
    echo strftime("%c") " this for debugging
 endfunction

This starts a "f" command and then cancels it with Esc.
Does that have more side effects?  We could add something like CTRL-\
CTRL-N that doesn't do anything.  Much better than using an undocumented
key code.

--
You can be stopped by the police for biking over 65 miles per hour.
You are not allowed to walk across a street on your hands.
                [real standing laws in Connecticut, United States of America]

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--
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

To unsubscribe from this group, send email to vim_use+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Reply | Threaded
Open this post in threaded view
|

Re: K_IGNORE trick (periodic execution)

Matthew Kaniaris
On Saturday, March 27, 2010 9:14:21 AM UTC-7, Bram Moolenaar wrote:

> Tony Mechelynck wrote:
>
> > On 26/03/10 23:01, Yakov wrote:
> > > There is trick for periodic execution, involving K_IGNORE and feedkeys
> > > [1].
> > > In the lastest vim 7.2.141, I cannot make it to work anymore.
> > > Timer() is executed only once, as seen from 'echo strftime' printout.
> > > Can anybody confirm this ? Am I missing some global setting ?
> > > 'updatetime' is set to 200.
> > >
> > > autocmd CursorHold * call Timer()
> > > function! Timer()
> > >    let K_IGNORE = "\x80\xFD\x35"   " internal key code that is ignored
> > >    call feedkeys(K_IGNORE)
> > >    echo strftime("%c") " this for debugging
> > > endfunction
> > >
> > > [1] http://vim.wikia.com/wiki/Timer_to_execute_commands_periodically
> > >
> >
> > I confirm as follows:
> >
> > I tried
> >
> > :augroup clock
> > :au CursorHold * call feedkeys("\x80\xFD\x35") | echon strftime('%c') " "
> > :augroup END
> >
> > both in gvim (with &enc == "utf-8") and in konsole (with &enc ==
> > "Latin1") and saw the datestamp displayed only once while I kept hands
> > off the keyboard & mouse.
> >
> > In both cases, Huge version 7.2.411, compiled with GTK2/Gnome2 GUI;
> > 'updatetime' is set to 4000 (the default).
> >
> >
> > Maybe I missed something too?
>
> This was changed in patch 7.2.025:
>
> Patch 7.2.025
> Problem:    When a CursorHold event invokes system() it is retriggered over
>    and over again.
> Solution:   Don't reset did_cursorhold when getting K_IGNORE.
> Files:    src/normal.c
>
>
> You can use something like "f\e" instead:
>
>  autocmd CursorHold * call Timer()
>  function! Timer()
>     call feedkeys("f\e")
>     echo strftime("%c") " this for debugging
>  endfunction
>
> This starts a "f" command and then cancels it with Esc.
> Does that have more side effects?  We could add something like CTRL-\
> CTRL-N that doesn't do anything.  Much better than using an undocumented
> key code.
>
> --
> You can be stopped by the police for biking over 65 miles per hour.
> You are not allowed to walk across a street on your hands.
> [real standing laws in Connecticut, United States of America]
>
>  /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
> ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
> \\\        download, build and distribute -- http://www.A-A-P.org        ///
>  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

Unfortunately, calling \e will cancel any window command or map.  Worse yet, some commands are canceled and others are not depending on how fast the user types and when the sequence was started in relation to the periodic \e. Some other solution would be much appreciated.

--
--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.