From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: Task time limit Date: Mon, 19 Nov 2007 13:03:55 +0000 Message-ID: <87zlxal744.fsf@bzg.ath.cx> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Iu6IG-0000jC-3V for emacs-orgmode@gnu.org; Mon, 19 Nov 2007 08:04:04 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Iu6IE-0000iy-Ja for emacs-orgmode@gnu.org; Mon, 19 Nov 2007 08:04:03 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Iu6IE-0000iv-GB for emacs-orgmode@gnu.org; Mon, 19 Nov 2007 08:04:02 -0500 Received: from ug-out-1314.google.com ([66.249.92.168]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Iu6ID-0000AZ-W6 for emacs-orgmode@gnu.org; Mon, 19 Nov 2007 08:04:02 -0500 Received: by ug-out-1314.google.com with SMTP id a2so998994ugf for ; Mon, 19 Nov 2007 05:04:01 -0800 (PST) In-Reply-To: (Sebastjan Trepca's message of "Mon, 19 Nov 2007 00:43:03 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org "Sebastjan Trepca" writes: > For example, "check the feed reader" would be set to 20 minutes. I > would clock-in the task, go and check the reader and after 20 mins, > alarm would go off, reminding me that I should start doing something > else. Nice idea, I gave it a shot. I advised `org-clock-in' so that each time I am clocking in a new task, a new appointment is triggered. `my-org-appt-add' can also be called interactively. ;; Make sure you have a sensible value for `appt-message-warning-time' (defun my-org-appt-add (&optional n) "Add an appointment for the Org entry at point in N minutes." (interactive) (save-excursion (org-back-to-heading t) (looking-at org-complex-heading-regexp) (let* ((msg (concat (match-string-no-properties 4) " *GAME OVER*")) (ct-time (decode-time)) (appt-min (+ (cadr ct-time) (or n 20))) (appt-time ; define the time for the appointment (progn (setf (cadr ct-time) appt-min) ct-time))) (appt-add (format-time-string "%H:%M" (apply 'encode-time appt-time)) msg) (if (interactive-p) (message "New appointment for %s" msg))))) (defadvice org-clock-in (after org-appt-add-after-clock-in activate) "Add an appointment after clocking in a task." (my-org-appt-add)) Maybe another idea is to bind (progn (org-clock-in) (my-org-appt-add)) to a key in org-agenda-mode-map, since advising `org-clock-in' is a bit too much IMO. Or we could use some kind of filtering to decide whether clockin in an entry should trigger a new appointment. Anyway, that's just a quickstart, let me know if this is useful. -- Bastien