emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bernt Hansen <bernt@norang.ca>
To: emacs-orgmode@gnu.org
Cc: Bernt Hansen <bernt@norang.ca>
Subject: [PATCH 2/2] Do not issue the 'task should be finished by now' message if the clock is stopped
Date: Tue,  9 Jun 2009 16:43:54 -0400	[thread overview]
Message-ID: <1244580234-25563-2-git-send-email-bernt@norang.ca> (raw)

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.
---
This patch series is available at git://git.norang.ca/org-mode for-carsten

 lisp/org-clock.el |   21 +++++++++++----------
 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."
-- 
1.6.3.2.198.g6096d

             reply	other threads:[~2009-06-09 20:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-09 20:43 Bernt Hansen [this message]
2009-06-09 21:45 ` [PATCH 2/2] Do not issue the 'task should be finished by now' message if the clock is stopped Carsten Dominik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1244580234-25563-2-git-send-email-bernt@norang.ca \
    --to=bernt@norang.ca \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).