emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bastien <bzg@altern.org>
To: emacs-orgmode@gnu.org
Subject: Re: Task time limit
Date: Mon, 19 Nov 2007 13:03:55 +0000	[thread overview]
Message-ID: <87zlxal744.fsf@bzg.ath.cx> (raw)
In-Reply-To: <cd329af80711181543l37d4e68ey4c3a4c70a2d1e908@mail.gmail.com> (Sebastjan Trepca's message of "Mon, 19 Nov 2007 00:43:03 +0100")

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

  reply	other threads:[~2007-11-19 13:04 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 [this message]
2008-02-10 17:39   ` Sebastjan Trepca
2008-02-10 18:57     ` Bastien Guerry
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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  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=87zlxal744.fsf@bzg.ath.cx \
    --to=bzg@altern.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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).