summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernt Hansen <bernt@norang.ca>2009-06-09 16:27:56 -0400
committerCarsten Dominik <carsten.dominik@gmail.com>2009-06-09 23:02:01 +0200
commite0f9c00f10fe82ef51cd8fb83b61c2d59ecdcd7a (patch)
tree681098aec13466c360843e9a602c10699c7fef64
parent7f9e53d6b179278e969f30bd9599faeebad62293 (diff)
downloadorg-mode-e0f9c00f10fe82ef51cd8fb83b61c2d59ecdcd7a.tar.gz
Do not issue the 'task should be finished by now' message if the clock is stopped
This patch prevents the org-clock-sound notification and the "Task'BLAH' should be finished by now." message when the termination time is reached and the clock is not running. Before this patch spurious notifications and messages were generated when clocking in a task with estimated effort time remaining. After clocking out the task the remaining minutes would tick by and then the sound and message that the task should be finished were generated - even though you are not working on it anymore.
-rw-r--r--lisp/org-clock.el21
1 files changed, 11 insertions, 10 deletions
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 57f1a6f..ace7792 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -369,16 +369,17 @@ previous clocking intervals."
(defun org-clock-notify-once-if-expired ()
"Show notification if we spent more time then we estimated before.
Notification is shown only once."
- (let ((effort-in-minutes (org-hh:mm-string-to-minutes org-clock-effort))
- (clocked-time (org-clock-get-clocked-time)))
- (if (>= clocked-time effort-in-minutes)
- (unless org-clock-notification-was-shown
- (setq org-clock-notification-was-shown t)
- (org-clock-play-sound)
- (org-show-notification
- (format "Task '%s' should be finished by now. (%s)"
- org-clock-heading org-clock-effort)))
- (setq org-clock-notification-was-shown nil))))
+ (when (marker-buffer org-clock-marker)
+ (let ((effort-in-minutes (org-hh:mm-string-to-minutes org-clock-effort))
+ (clocked-time (org-clock-get-clocked-time)))
+ (if (>= clocked-time effort-in-minutes)
+ (unless org-clock-notification-was-shown
+ (setq org-clock-notification-was-shown t)
+ (org-clock-play-sound)
+ (org-show-notification
+ (format "Task '%s' should be finished by now. (%s)"
+ org-clock-heading org-clock-effort)))
+ (setq org-clock-notification-was-shown nil)))))
(defun org-show-notification (notification)
"Show notification. Use libnotify, if available."