From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Guerry Subject: Re: Task time limit Date: Sun, 10 Feb 2008 18:57:11 +0000 Message-ID: <87abm8od14.fsf@bzg.ath.cx> References: <87zlxal744.fsf@bzg.ath.cx> 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 1JOHMd-0007Or-1v for emacs-orgmode@gnu.org; Sun, 10 Feb 2008 13:57:19 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JOHMa-0007M8-SS for emacs-orgmode@gnu.org; Sun, 10 Feb 2008 13:57:18 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JOHMa-0007Ls-JW for emacs-orgmode@gnu.org; Sun, 10 Feb 2008 13:57:16 -0500 Received: from wa-out-1112.google.com ([209.85.146.178]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JOHMa-00072t-46 for emacs-orgmode@gnu.org; Sun, 10 Feb 2008 13:57:16 -0500 Received: by wa-out-1112.google.com with SMTP id k34so1588310wah.10 for ; Sun, 10 Feb 2008 10:57:14 -0800 (PST) In-Reply-To: (Sebastjan Trepca's message of "Sun, 10 Feb 2008 18:39:41 +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: Sebastjan Trepca Cc: emacs-orgmode@gnu.org "Sebastjan Trepca" writes: > I finally got time to try this code :) This is just 84 days old :) > Copied into my .emacs file, changed the time to 1 minute, clocked in a > task, waited a minute and nothing happened :) Are you activating appointments with (appt-activate) somewhere? What is the output of M-x appt-delete RET ? Maybe you can try with a more realistic value of 20 minutes and check if the appt appears somewhere (with-x appt-delete RET) BTW, here is the last version I use, letting you to delete "appointments" if you clock out (only in the org-mode buffer): ;; Make sure you have a sensible value for `appt-message-warning-time' (defvar bzg-org-clock-in-appt-delay 100 "Number of minutes for setting an appointment by clocking-in") (defun bzg-org-clock-in-add-appt (&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 (match-string-no-properties 4)) (ct-time (decode-time)) (appt-min (+ (cadr ct-time) (or n bzg-org-clock-in-appt-delay))) (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-clock-in-add-appt activate) "Add an appointment when clocking a task in." (bzg-org-clock-in-add-appt)) (defun bzg-org-clock-out-delete-appt nil "When clocking out, delete any associated appointment." (interactive) (save-excursion (org-back-to-heading t) (looking-at org-complex-heading-regexp) (let* ((msg (match-string-no-properties 4))) (setq appt-time-msg-list (delete nil (mapcar (lambda (appt) (if (not (string-match (regexp-quote msg) (cadr appt))) appt)) appt-time-msg-list))) (appt-check)))) (defadvice org-clock-out (before org-clock-out-delete-appt activate) "Delete an appointment when clocking a task out." (bzg-org-clock-out-delete-appt)) -- Bastien