Patch 7.2.025 and periodic execution

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

Patch 7.2.025 and periodic execution

iler.ml
Hello Bram,

Patch 7.2.025 broke periodic execution idiom [1], it seems.

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

Can the ability to do perioc execution via CursorHold be restored ?

Periodic execution is possible in GUI-enabled vim via spawning
expernal subprocess that sends remote events to the vim.

In console vim, the idiom [1] is  was the only possible means to
do periodic execution. 'updatetime' value served as a guarantee
to not get 100%cpu, so it seemed clean, no ? It was used in several
plugin, notably in "timetable" plugin that highlighted time-based lines of
file based on current time.

Thanks
Yakov

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


*** ../vim-7.2.024/src/normal.c Sat Sep  6 16:44:06 2008
--- src/normal.c        Sat Sep 27 13:03:34 2008
***************
*** 1132,1138 ****
       out_flush();
 #endif
 #ifdef FEAT_AUTOCMD
!     did_cursorhold = FALSE;
 #endif

     State = NORMAL;
--- 1132,1139 ----
       out_flush();
 #endif
 #ifdef FEAT_AUTOCMD
!     if (ca.cmdchar != K_IGNORE)
!       did_cursorhold = FALSE;
 #endif

     State = NORMAL;
*** ../vim-7.2.024/src/version.c        Thu Oct  2 22:48:01 2008
--- src/version.c       Thu Oct  2 22:54:41 2008
***************
*** 678,679 ****
--- 678,681 ----
 {   /* Add new patch number below this line */
+ /**/
+     25,
 /**/

--


--
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
 
To unsubscribe from this group, send email to vim_dev+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Reply | Threaded
Open this post in threaded view
|

Re: Patch 7.2.025 and periodic execution

Ingo Karkat
On 27-Mar-2010 16:45, Yakov Lerner wrote:

> Hello Bram,
>
> Patch 7.2.025 broke periodic execution idiom [1], it seems.
>
> [1] http://vim.wikia.com/wiki/Timer_to_execute_commands_periodically
>
> Can the ability to do perioc execution via CursorHold be restored ?
>
> Periodic execution is possible in GUI-enabled vim via spawning
> expernal subprocess that sends remote events to the vim.
>
> In console vim, the idiom [1] is  was the only possible means to
> do periodic execution. 'updatetime' value served as a guarantee
> to not get 100%cpu, so it seemed clean, no ? It was used in several
> plugin, notably in "timetable" plugin that highlighted time-based lines of
> file based on current time.

The mentioned idiom is a difficult to understand hack, and - when applied more
widely by plugins - will lead to congestion over the 'updatetime' value, among
other things.

There seems to be a real need for single-deferred and periodic scheduling (I
remember multple occasions for a "call me again in 2 seconds to clean something
up" function where I ended up misusing a variety of
CursorHold,WinLeave,InsertLeave events with a self-removing autocmd); how about
adding such functionality and discussing a possible interface for that instead?!

I can think of two alternatives:
a) setTimer({time}, {funcref}) function
b) autocmd with special event 'TimerNNN' where NNN is the timespan

-- regards, ingo
--
   -- Ingo Karkat -- /^-- /^-- /^-- /^-- /^-- /^-- http://ingo-karkat.de/ --
   --      http://vim.sourceforge.net/account/profile.php?user_id=9713    --

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

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

Re: Patch 7.2.025 and periodic execution

John Little-4

On Mar 28, 8:42 am, Ingo Karkat <[hidden email]> wrote:

> The mentioned idiom is a difficult to understand hack...

I agree.

> There seems to be a real need for single-deferred and periodic scheduling...

I agree.  I suspect that this has been avoided because scheduling is
what operating systems do, and "Vim is not a shell or an Operating
System."  However, there are tasks properly in the domain of a
powerful text editor that need this stuff; a syntax-colouring tail -f
has been my experience of this.

Regards, John

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

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

Re: Patch 7.2.025 and periodic execution

Christian Brabandt
On Tue, March 30, 2010 4:32 am, John Little wrote:
> However, there are tasks properly in the domain of a
> powerful text editor that need this stuff; a syntax-colouring tail -f
> has been my experience of this.

It's not, that the workaround is not working anymore. You still can
use any other key in combination with feedkeys(). It's just K_IGNORE
that has been disabled.

regards,
Christian

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

To unsubscribe from this group, send email to vim_dev+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.