[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] Task time limit

From: Bastien
Subject: Re: [Orgmode] Task time limit
Date: Mon, 19 Nov 2007 13:03:55 +0000
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.0 (gnu/linux)

"Sebastjan Trepca" <address@hidden> 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

;; 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."
    (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."

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]