2

In org-mode when a task is overrun - when the clocked time is bigger than the effort, there is a visual feedback in the mode-line. I am looking for a way to get an audible one as well.

I couldn't find any hook for this event. As for the implementation of org-clock it appears to be only providing an extra string to display on the mode-line.

"Extra mode line text to indicate that the clock is overrun. The can be nil to indicate that instead of adding text, the clock time should get a different face (org-mode-line-clock-overrun'). When this is a string, it is prepended to the clock string as an indication, also using the face org-mode-line-clock-overrun'." (from org-clock-task-overrun-text)

Has anyone managed to find a way to get an audio feedback when the clock has just overrun?

3

As Tyler's answer suggests, org-clock-sound will help org to make an audible feedback for this scenario.

However, it is highly probable that lost in the init file there is this line of code preventing this feedback to happen:

(setq ring-bell-function 'ignore)

Solution

  • Make sure to not have set to ignore ring-bell-function or that you have provided a function like this:

    (setq ring-bell-function (lambda ()
                              (play-sound-file "/this/is/my/errorsound.au")))
    

    (from emacsWiki alarm bell)

  • Set the org-clock-sound to t or your favorite sound see this answer for examples.

If you happen to be on a emacs version without the sound binaries on OSX, you may want to look at https://github.com/leoliu/play-sound-osx for a quick fix.

2

The function org-clock-notify-once-if-expired appears to play a sound, if you have a sound configured in the variable org-clock-sound. That would give you a single audible notification after you first go over-time on a task:

...
  (if (setq org-clock-task-overrun
    (if (or (null effort-in-minutes) (zerop effort-in-minutes))
        nil
      (>= clocked-time effort-in-minutes)))
    (unless org-clock-notification-was-shown
      (setq org-clock-notification-was-shown t)
    (org-notify
     (format-message "Task `%s' should be finished by now. (%s)"
                         org-clock-heading org-clock-effort)
         org-clock-sound))
...
  • Thank you for your insights, it really helped me figuring out this out! – asiegfried Aug 11 '17 at 9:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.