emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bastien Guerry <bzg@altern.org>
To: Sebastjan Trepca <trepca@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Task time limit
Date: Sun, 10 Feb 2008 18:57:11 +0000	[thread overview]
Message-ID: <87abm8od14.fsf@bzg.ath.cx> (raw)
In-Reply-To: <cd329af80802100939j706b2668oa8fb128aa954e5e2@mail.gmail.com> (Sebastjan Trepca's message of "Sun, 10 Feb 2008 18:39:41 +0100")

"Sebastjan Trepca" <trepca@gmail.com> 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."
    (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."

(defun bzg-org-clock-out-delete-appt nil
  "When clocking out, delete any associated appointment."
    (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 
		     (lambda (appt)
		       (if (not (string-match (regexp-quote msg) 
					      (cadr appt))) appt))

(defadvice org-clock-out (before org-clock-out-delete-appt activate)
  "Delete an appointment when clocking a task out."


  reply	other threads:[~2008-02-10 18:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-18 23:43 Task time limit Sebastjan Trepca
2007-11-19 13:03 ` Bastien
2008-02-10 17:39   ` Sebastjan Trepca
2008-02-10 18:57     ` Bastien Guerry [this message]
2008-02-10 19:18       ` Sebastjan Trepca
2008-02-10 19:47         ` Bastien Guerry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87abm8od14.fsf@bzg.ath.cx \
    --to=bzg@altern.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=trepca@gmail.com \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).