From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Sebastjan Trepca" Subject: Re: Task time limit Date: Sun, 10 Feb 2008 18:39:41 +0100 Message-ID: References: <87zlxal744.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JOG9Z-0003wf-BD for emacs-orgmode@gnu.org; Sun, 10 Feb 2008 12:39:45 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JOG9X-0003wO-8H for emacs-orgmode@gnu.org; Sun, 10 Feb 2008 12:39:44 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JOG9X-0003wL-2b for emacs-orgmode@gnu.org; Sun, 10 Feb 2008 12:39:43 -0500 Received: from py-out-1112.google.com ([64.233.166.183]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JOG9X-0001IW-8M for emacs-orgmode@gnu.org; Sun, 10 Feb 2008 12:39:43 -0500 Received: by py-out-1112.google.com with SMTP id u52so4648250pyb.1 for ; Sun, 10 Feb 2008 09:39:41 -0800 (PST) In-Reply-To: <87zlxal744.fsf@bzg.ath.cx> Content-Disposition: inline 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 I finally got time to try this code :) Copied into my .emacs file, changed the time to 1 minute, clocked in a task, waited a minute and nothing happened :) What could I be doing wrong? Thanks, Sebastjan On Nov 19, 2007 2:03 PM, Bastien wrote: > "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 > > > _______________________________________________ > Emacs-orgmode mailing list > Remember: use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode >