* Task time limit
@ 2007-11-18 23:43 Sebastjan Trepca
2007-11-19 13:03 ` Bastien
0 siblings, 1 reply; 6+ messages in thread
From: Sebastjan Trepca @ 2007-11-18 23:43 UTC (permalink / raw)
To: emacs-orgmode
Hi,
another idea for a feature (if it's not already possible) that would
definitely come handy. I have few tasks that should only take a
limited amount of my time each day.
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.
Is this possible with current version?
Thanks, Sebastjan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Task time limit
2007-11-18 23:43 Task time limit Sebastjan Trepca
@ 2007-11-19 13:03 ` Bastien
2008-02-10 17:39 ` Sebastjan Trepca
0 siblings, 1 reply; 6+ messages in thread
From: Bastien @ 2007-11-19 13:03 UTC (permalink / raw)
To: emacs-orgmode
"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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Task time limit
2007-11-19 13:03 ` Bastien
@ 2008-02-10 17:39 ` Sebastjan Trepca
2008-02-10 18:57 ` Bastien Guerry
0 siblings, 1 reply; 6+ messages in thread
From: Sebastjan Trepca @ 2008-02-10 17:39 UTC (permalink / raw)
To: emacs-orgmode
I finally got time to try this code :)
Copied into my .emacs file, changed the time to 1 minute, clocked in a
task, waited a minute and nothing happened :)
What could I be doing wrong?
Thanks, Sebastjan
On Nov 19, 2007 2:03 PM, Bastien <bzg@altern.org> wrote:
> "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
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Task time limit
2008-02-10 17:39 ` Sebastjan Trepca
@ 2008-02-10 18:57 ` Bastien Guerry
2008-02-10 19:18 ` Sebastjan Trepca
0 siblings, 1 reply; 6+ messages in thread
From: Bastien Guerry @ 2008-02-10 18:57 UTC (permalink / raw)
To: Sebastjan Trepca; +Cc: emacs-orgmode
"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."
(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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Task time limit
2008-02-10 18:57 ` Bastien Guerry
@ 2008-02-10 19:18 ` Sebastjan Trepca
2008-02-10 19:47 ` Bastien Guerry
0 siblings, 1 reply; 6+ messages in thread
From: Sebastjan Trepca @ 2008-02-10 19:18 UTC (permalink / raw)
To: Bastien Guerry; +Cc: emacs-orgmode
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Task time limit
2008-02-10 19:18 ` Sebastjan Trepca
@ 2008-02-10 19:47 ` Bastien Guerry
0 siblings, 0 replies; 6+ messages in thread
From: Bastien Guerry @ 2008-02-10 19:47 UTC (permalink / raw)
To: emacs-orgmode
"Sebastjan Trepca" <trepca@gmail.com> writes:
> Anyway, this new version works! :)
Be careful about clocking out from agenda views if you're also advising
org-clock-out. It doesn't work, I can't see why for now.
> Thank you very much, this will be very useful. Btw, why not integrate
> it with org-mode?
I don't think this has to be part of org-mode.
I'm not using it myself and I would be surprised if many people are
using it. This is a strange way of using appointments as "reminders".
And most of the times you will clock the task out before the appt will
pop up -- which means you really relies on `appt-message-warning-time'
to tell you that you're about to reach the "appointment"...
Anyway, I opened a page named org-adhoc-code.org on Worg:
http://www.cognition.ens.fr/~guerry/worg/org-adhoc-code.html
We could put other tiny pieces of code here in the future.
--
Bastien
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-02-10 19:47 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2008-02-10 19:18 ` Sebastjan Trepca
2008-02-10 19:47 ` Bastien Guerry
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).