From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Sebastjan Trepca" Subject: Re: Task time limit Date: Sun, 10 Feb 2008 20:18:05 +0100 Message-ID: References: <87zlxal744.fsf@bzg.ath.cx> <87abm8od14.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 1JOHgm-0007hS-K1 for emacs-orgmode@gnu.org; Sun, 10 Feb 2008 14:18:08 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JOHgl-0007gk-4R for emacs-orgmode@gnu.org; Sun, 10 Feb 2008 14:18:08 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JOHgk-0007gh-Rx for emacs-orgmode@gnu.org; Sun, 10 Feb 2008 14:18:06 -0500 Received: from py-out-1112.google.com ([64.233.166.178]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JOHgk-0002jP-Ol for emacs-orgmode@gnu.org; Sun, 10 Feb 2008 14:18:06 -0500 Received: by py-out-1112.google.com with SMTP id u52so4677019pyb.1 for ; Sun, 10 Feb 2008 11:18:06 -0800 (PST) In-Reply-To: <87abm8od14.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: Bastien Guerry Cc: emacs-orgmode@gnu.org > This is just 84 days old :) Hehe, I guess I have a long queue ;) Anyway, this new version works! :) Thank you very much, this will be very useful. Btw, why not integrate it with org-mode? Sebastjan > > 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 > -- Sebastjan