* Why run-with-timer generates so many timers?
@ 2020-07-18 0:54 numbchild
2020-07-18 2:05 ` Michael Heerdegen
0 siblings, 1 reply; 3+ messages in thread
From: numbchild @ 2020-07-18 0:54 UTC (permalink / raw)
To: emacs-help
I write an extension rainbow-fart.el (
https://github.com/stardiviner/emacs-rainbow-fart)
Here is the code lines which running timer:
https://github.com/stardiviner/emacs-rainbow-fart/blob/master/rainbow-fart.el#L245
When I run command `list-timers`. I found many timers is generated by
rainbow-fart.el
#+begin_example
275.87 900.0 rainbow-fart--timing-remind
278.20 900.0 rainbow-fart--timing-remind
280.55 900.0 rainbow-fart--timing-remind
280.65 900.0 rainbow-fart--timing-remind
280.66 900.0 rainbow-fart--timing-remind
280.74 900.0 rainbow-fart--timing-remind
280.86 900.0 rainbow-fart--timing-remind
280.94 900.0 rainbow-fart--timing-remind
281.14 900.0 rainbow-fart--timing-remind
281.19 900.0 rainbow-fart--timing-remind
281.21 900.0 rainbow-fart--timing-remind
281.28 900.0 rainbow-fart--timing-remind
281.81 900.0 rainbow-fart--timing-remind
281.89 900.0 rainbow-fart--timing-remind
283.31 900.0 rainbow-fart--timing-remind
283.39 900.0 rainbow-fart--timing-remind
285.49 900.0 rainbow-fart--timing-remind
.....
#+end_example
Is my `run-with-timer` source code wrong? Or did I misunderstand this
function?
Hope experts like you can explain it for me, thanks very much.
[stardiviner] <Hack this world!> GPG key ID: 47C32433
IRC(freeenode): stardiviner Twitter: @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Why run-with-timer generates so many timers?
2020-07-18 0:54 Why run-with-timer generates so many timers? numbchild
@ 2020-07-18 2:05 ` Michael Heerdegen
2020-07-18 5:54 ` [SOLVED] " numbchild
0 siblings, 1 reply; 3+ messages in thread
From: Michael Heerdegen @ 2020-07-18 2:05 UTC (permalink / raw)
To: help-gnu-emacs
"numbchild@gmail.com" <numbchild@gmail.com> writes:
> Here is the code lines which running timer:
> https://github.com/stardiviner/emacs-rainbow-fart/blob/master/rainbow-fart.el#L245
Looks like you save the timer in a global variable; but your mode is
buffer local. In your implementation, enabling in any buffer starts a
new timer unconditionally and overwrites the global variable AUAIU.
Dunno whether this is the reason for all of the timers you see.
The question if you should use only one global timer for all buffers is
not trivial; if you can do that, it is preferable. Depends on things
like which buffers should be treated (all?, all visible?, only the
current buffer?). Haven't looked at your code that much.
Michael.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [SOLVED] Re: Why run-with-timer generates so many timers?
2020-07-18 2:05 ` Michael Heerdegen
@ 2020-07-18 5:54 ` numbchild
0 siblings, 0 replies; 3+ messages in thread
From: numbchild @ 2020-07-18 5:54 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: emacs-help
Thanks for your help, problem solved.
[stardiviner] <Hack this world!> GPG key ID: 47C32433
IRC(freeenode): stardiviner Twitter: @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/
On Sat, Jul 18, 2020 at 10:07 AM Michael Heerdegen <michael_heerdegen@web.de>
wrote:
> "numbchild@gmail.com" <numbchild@gmail.com> writes:
>
> > Here is the code lines which running timer:
> >
> https://github.com/stardiviner/emacs-rainbow-fart/blob/master/rainbow-fart.el#L245
>
> Looks like you save the timer in a global variable; but your mode is
> buffer local. In your implementation, enabling in any buffer starts a
> new timer unconditionally and overwrites the global variable AUAIU.
> Dunno whether this is the reason for all of the timers you see.
>
> The question if you should use only one global timer for all buffers is
> not trivial; if you can do that, it is preferable. Depends on things
> like which buffers should be treated (all?, all visible?, only the
> current buffer?). Haven't looked at your code that much.
>
> Michael.
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-07-18 5:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-18 0:54 Why run-with-timer generates so many timers? numbchild
2020-07-18 2:05 ` Michael Heerdegen
2020-07-18 5:54 ` [SOLVED] " numbchild
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.