Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop running org-pomodoro-tick in quick succession #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

telotortium
Copy link
Contributor

When Emacs is under load, the functions run by run-at-time can be delayed. This is particularly an issue for the org-pomodoro-tick function, because it runs every second. However, when the run-at-time functions are finally run, they're all run at once, right after another. Now that I've enabled playing tick sounds, this is particularly annoying, because running all these hooks at once causes the tick sounds to be played right after each other.

To alleviate this, I've done two things:

  1. Add a org-pomodoro-next-tick-time variable. This is set to the beginning of the following second whenever org-pomodoro-tick is run. If org-pomodoro-tick is run multiple times in quick succession, only the first time will run the contents of the function, including the tick sounds and the org-pomodoro-tick-hook functions, until the beginning of the next second.

  2. Update the mode line and play the tick sounds before running the hooks. This ensures that long hook functions don't cause the tick sounds to play out of rhythm.

When Emacs is under load, the functions run by `run-at-time` can be delayed. This is particularly an issue for the `org-pomodoro-tick` function, because it runs every second. However, when the `run-at-time` functions are finally run, they're all run at once, right after another. Now that I've enabled playing tick sounds, this is particularly annoying, because running all these hooks at once causes  the tick sounds to be played right after each other.

To alleviate this, I've done two things:

1. Add a `org-pomodoro-next-tick-time` variable. This is set to the beginning of the following second whenever `org-pomodoro-tick` is run. If `org-pomodoro-tick` is run multiple times in quick succession, only the first time will run the contents of the function, including the tick sounds and the `org-pomodoro-tick-hook` functions, until the beginning of the next second.

2. Update the mode line and play the tick sounds before running the hooks. This ensures that long hook functions don't cause the tick sounds to play out of rhythm.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant