* notify, when something to do
@ 2011-10-23 10:07 Peter Münster
2011-10-23 16:20 ` Tassilo Horn
2011-10-24 15:01 ` Christopher Allan Webber
0 siblings, 2 replies; 12+ messages in thread
From: Peter Münster @ 2011-10-23 10:07 UTC (permalink / raw)
To: emacs-orgmode
Hello,
I would like to be notified[1], when a todo item enters the warning
period, scheduled time, or deadline.
I can imagine writing a function, that executes every 5 minutes, that
scans all agenda files calling `org-get-[scheduled,deadline]-time', but
I hope, that there is already something, that I can use more easily.
TIA for any help,
Peter
Footnotes:
[1] For notifying, I'll use an external program, for example
"notify-send", because the emacs window is not always visible.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: notify, when something to do
2011-10-23 10:07 notify, when something to do Peter Münster
@ 2011-10-23 16:20 ` Tassilo Horn
2011-10-23 16:30 ` Tassilo Horn
2011-10-23 18:17 ` Peter Münster
2011-10-24 15:01 ` Christopher Allan Webber
1 sibling, 2 replies; 12+ messages in thread
From: Tassilo Horn @ 2011-10-23 16:20 UTC (permalink / raw)
To: emacs-orgmode
pmlists@free.fr (Peter Münster) writes:
Hi Peter,
> I would like to be notified[1], when a todo item enters the warning
> period, scheduled time, or deadline.
I export my org entries as appt alarms, so that I get system
notifications 15 minutes before meetings (every 1 minute until I
discard them). Here's the code:
--8<---------------cut here---------------start------------->8---
(defvar th-notify-title-to-id-map (make-hash-table :test 'string=)
"Maps TITLE values of notifications to the last notification ID.
If ID is -1, then any further notifications with that body will
be skipped.")
(defun th-notify (&rest args)
"Create a notification popup.
For ARGS, see `notifications-notify'.
There's some new default behavior over the function above:
- Notifications with same :body replace each other. :body,
because my notifications are usually something like
:title \"Meeting with Hugo\"
:body \"In 15 Minutes\"
where each minute a similar notification with decreasing
minutes in the :body is triggered.
- If a notification was dismissed, then don't show any
notifications with that :title anymore (the next 15 minutes).
- Use unlimited timeout."
(require 'notifications)
(let* ((title (plist-get args :body))
(body (plist-get args :body))
(replaces-id (or (plist-get args :replaces-id)
(gethash title th-notify-title-to-id-map)))
(on-close (or (plist-get args :on-close)
`(lambda (id reason)
(when (eq reason 'dismissed)
;; Mark as "don't show again!"
(puthash ,title -1 th-notify-title-to-id-map)
;; But clear that "dont-show-mark" after 15 minutes
(run-with-timer (* 15 60) nil
(lambda ()
(remhash ,title th-notify-title-to-id-map)))))))
;; 0 means, it should not expire at all
(timeout (or (plist-get args :timeout) 0)))
(unless (eql replaces-id -1)
(puthash title (apply 'notifications-notify
(th-plist-put-many args
:timeout timeout
:replaces-id replaces-id
:on-close on-close))
th-notify-title-to-id-map))))
(defun th-appt-alarm (mins time text)
"Show a notification popup (or update the current one) for the
appt with TEXT in MINS minutes (a string)."
(let ((body (substring-no-properties text)))
(th-notify
:title text
:body (concat "Appointment "
(if (string= mins "0")
"NOW:"
(concat "in " mins " minutes:"))))))
(setq appt-display-format 'window
appt-disp-window-function 'th-appt-alarm
appt-display-interval 1
appt-display-duration 60)
(defun th-org-agenda-to-appt ()
(require 'org-agenda)
(org-agenda-to-appt t)
(appt-activate 1))
(th-org-agenda-to-appt)
(add-hook 'org-finalize-agenda-hook 'th-org-agenda-to-appt)
--8<---------------cut here---------------end--------------->8---
Bye,
Tassilo
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: notify, when something to do
2011-10-23 16:20 ` Tassilo Horn
@ 2011-10-23 16:30 ` Tassilo Horn
2011-10-23 18:17 ` Peter Münster
1 sibling, 0 replies; 12+ messages in thread
From: Tassilo Horn @ 2011-10-23 16:30 UTC (permalink / raw)
To: emacs-orgmode
Tassilo Horn <tassilo@member.fsf.org> writes:
> (defvar th-notify-title-to-id-map (make-hash-table :test 'string=)
> "Maps TITLE values of notifications to the last notification ID.
> If ID is -1, then any further notifications with that body will
> be skipped.")
>
> (defun th-notify (&rest args)
> "Create a notification popup.
> For ARGS, see `notifications-notify'.
> There's some new default behavior over the function above:
>
> - Notifications with same :body replace each other. :body,
> because my notifications are usually something like
>
> :title \"Meeting with Hugo\"
> :body \"In 15 Minutes\"
>
> where each minute a similar notification with decreasing
> minutes in the :body is triggered.
This comment is obviously outdated. The notifications with equal :title
now replace each other.
Bye,
Tassilo
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: notify, when something to do
2011-10-23 16:20 ` Tassilo Horn
2011-10-23 16:30 ` Tassilo Horn
@ 2011-10-23 18:17 ` Peter Münster
2011-10-23 19:09 ` Tassilo Horn
2011-10-23 21:29 ` Bastien
1 sibling, 2 replies; 12+ messages in thread
From: Peter Münster @ 2011-10-23 18:17 UTC (permalink / raw)
To: emacs-orgmode
On Sun, Oct 23 2011, Tassilo Horn wrote:
> pmlists@free.fr (Peter Münster) writes:
>
>> I would like to be notified[1], when a todo item enters the warning
>> period, scheduled time, or deadline.
>
> I export my org entries as appt alarms, so that I get system
> notifications 15 minutes before meetings (every 1 minute until I
> discard them). Here's the code:
Hello Tassilo,
First, I took a look at the lines
--8<---------------cut here---------------start------------->8---
(org-agenda-to-appt t)
(appt-activate 1)
--8<---------------cut here---------------end--------------->8---
This is already a good starting point, just 3 remarks:
- I think, I'll need a filter for org-agenda-to-appt, because I only
want TODO items. Should be no problem.
- How to distinguish between SCHEDULED and DEADLINE? I'll
investigate...
- Perhaps the main problem: appt does not know about warning periods.
There are items with "-3d", other with "-5M"[1]. There is only one
universal appt-message-warning-time. Would it be possible, to have a
individual warning-time for each todo-item, directly computed from the
warning time in the org-timestamp?
In the meantime, I'll take a look at your th-appt-alarm.
Thanks for your code!
Peter
Footnotes:
[1] That means "warn 5 minutes before". I don't know, if org-mode
supports this. "-2H" for hours would be useful too.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: notify, when something to do
2011-10-23 18:17 ` Peter Münster
@ 2011-10-23 19:09 ` Tassilo Horn
2011-10-23 21:23 ` Bastien
2011-10-23 21:29 ` Bastien
1 sibling, 1 reply; 12+ messages in thread
From: Tassilo Horn @ 2011-10-23 19:09 UTC (permalink / raw)
To: emacs-orgmode
pmlists@free.fr (Peter Münster) writes:
Hi Peter,
> First, I took a look at the lines
>
> (org-agenda-to-appt t)
> (appt-activate 1)
>
> This is already a good starting point, just 3 remarks:
> - I think, I'll need a filter for org-agenda-to-appt, because I only
> want TODO items. Should be no problem.
Yep.
> - How to distinguish between SCHEDULED and DEADLINE? I'll
> investigate...
> - Perhaps the main problem: appt does not know about warning periods.
> There are items with "-3d", other with "-5M"[1]. There is only one
> universal appt-message-warning-time. Would it be possible, to have a
> individual warning-time for each todo-item, directly computed from the
> warning time in the org-timestamp?
Not sure about the last two. But maybe one could change
`org-agenda-to-appt' to accept also a function as filter.
Bye,
Tassilo
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: notify, when something to do
2011-10-23 19:09 ` Tassilo Horn
@ 2011-10-23 21:23 ` Bastien
2011-10-24 5:14 ` Tassilo Horn
0 siblings, 1 reply; 12+ messages in thread
From: Bastien @ 2011-10-23 21:23 UTC (permalink / raw)
To: Tassilo Horn; +Cc: emacs-orgmode
Hi Tassilo,
Tassilo Horn <tassilo@member.fsf.org> writes:
> But maybe one could change
> `org-agenda-to-appt' to accept also a function as filter.
Done. You can now use a fonction as a filter. It will
filter through entries. the only mandatory argument for
this function will be an entry, i.e. something similar
to what `org-agenda-get-day-entries' outputs.
Thanks for this idea!
--
Bastien
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: notify, when something to do
2011-10-23 18:17 ` Peter Münster
2011-10-23 19:09 ` Tassilo Horn
@ 2011-10-23 21:29 ` Bastien
2011-10-24 9:29 ` Sebastien Vauban
2011-11-01 23:01 ` Peter Münster
1 sibling, 2 replies; 12+ messages in thread
From: Bastien @ 2011-10-23 21:29 UTC (permalink / raw)
To: Peter Münster; +Cc: emacs-orgmode
Hi Peter,
pmlists@free.fr (Peter Münster) writes:
> - I think, I'll need a filter for org-agenda-to-appt, because I only
> want TODO items. Should be no problem.
Yes -- just use a function who tries to match the TODO keyword
against the entry.
> - How to distinguish between SCHEDULED and DEADLINE? I'll
> investigate...
I introduced the ability to use
(org-agenda-to-appt nil t :scheduled)
if you just want to get scheduled appointments. This might
speeds things and make them more flexible.
> - Perhaps the main problem: appt does not know about warning periods.
> There are items with "-3d", other with "-5M"[1]. There is only one
> universal appt-message-warning-time. Would it be possible, to have a
> individual warning-time for each todo-item, directly computed from the
> warning time in the org-timestamp?
Check what info is available as text properties in the agenda
(with `C-u C-x =') and see if you can use this information in
a filter function.
HTH,
--
Bastien
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: notify, when something to do
2011-10-23 21:23 ` Bastien
@ 2011-10-24 5:14 ` Tassilo Horn
0 siblings, 0 replies; 12+ messages in thread
From: Tassilo Horn @ 2011-10-24 5:14 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode
Bastien <bzg@altern.org> wrote:
> Hi Tassilo,
>
> Tassilo Horn <tassilo@member.fsf.org> writes:
>
> > But maybe one could change
> > `org-agenda-to-appt' to accept also a function as filter.
>
> Done. You can now use a fonction as a filter. It will
> filter through entries. the only mandatory argument for
> this function will be an entry, i.e. something similar
> to what `org-agenda-get-day-entries' outputs.
>
> Thanks for this idea!
>
> --
> Bastien
Hey Bastien,
This is awesome. Thanks a lot.
Tassilo
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: notify, when something to do
2011-10-23 21:29 ` Bastien
@ 2011-10-24 9:29 ` Sebastien Vauban
2011-11-01 23:01 ` Peter Münster
1 sibling, 0 replies; 12+ messages in thread
From: Sebastien Vauban @ 2011-10-24 9:29 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Bastien,
Bastien wrote:
>> - How to distinguish between SCHEDULED and DEADLINE? I'll
>> investigate...
>
> I introduced the ability to use
>
> (org-agenda-to-appt nil t :scheduled)
>
> if you just want to get scheduled appointments. This might
> speeds things and make them more flexible.
I have the impression we use SCHEDULED here with a wrong semantics.
What about the idea (launched by Carsten) of introducing another keyword like
APPT or EVENT [1] for such events to be warned of?
Best regards,
Seb
Footnotes:
[1] http://www.mail-archive.com/emacs-orgmode-mXXj517/zsQ@public.gmane.org/msg45063.html
--
Sebastien Vauban
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: notify, when something to do
2011-10-23 10:07 notify, when something to do Peter Münster
2011-10-23 16:20 ` Tassilo Horn
@ 2011-10-24 15:01 ` Christopher Allan Webber
2011-10-25 18:56 ` Marcelo de Moraes Serpa
1 sibling, 1 reply; 12+ messages in thread
From: Christopher Allan Webber @ 2011-10-24 15:01 UTC (permalink / raw)
To: Peter Münster; +Cc: emacs-orgmode
Hey Peter,
I also do appointments with orgmode.. I have it hooked up so that it
sends me messages via XMPP/Jabber. Possibly useful to you:
http://dustycloud.org/blog/2010/11/21/emacs-appointment-notifications-via-xmpp
pmlists@free.fr (Peter Münster) writes:
> Hello,
>
> I would like to be notified[1], when a todo item enters the warning
> period, scheduled time, or deadline.
>
> I can imagine writing a function, that executes every 5 minutes, that
> scans all agenda files calling `org-get-[scheduled,deadline]-time', but
> I hope, that there is already something, that I can use more easily.
>
> TIA for any help,
> Peter
>
>
> Footnotes:
> [1] For notifying, I'll use an external program, for example
> "notify-send", because the emacs window is not always visible.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: notify, when something to do
2011-10-24 15:01 ` Christopher Allan Webber
@ 2011-10-25 18:56 ` Marcelo de Moraes Serpa
0 siblings, 0 replies; 12+ messages in thread
From: Marcelo de Moraes Serpa @ 2011-10-25 18:56 UTC (permalink / raw)
To: Christopher Allan Webber; +Cc: Peter Münster, emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1047 bytes --]
Ha, the XMPP idea really appeals to me, endless possibilities :D
Thanks for sharing.
On Mon, Oct 24, 2011 at 10:01 AM, Christopher Allan Webber <
cwebber@dustycloud.org> wrote:
> Hey Peter,
>
> I also do appointments with orgmode.. I have it hooked up so that it
> sends me messages via XMPP/Jabber. Possibly useful to you:
>
>
> http://dustycloud.org/blog/2010/11/21/emacs-appointment-notifications-via-xmpp
>
> pmlists@free.fr (Peter Münster) writes:
>
> > Hello,
> >
> > I would like to be notified[1], when a todo item enters the warning
> > period, scheduled time, or deadline.
> >
> > I can imagine writing a function, that executes every 5 minutes, that
> > scans all agenda files calling `org-get-[scheduled,deadline]-time', but
> > I hope, that there is already something, that I can use more easily.
> >
> > TIA for any help,
> > Peter
> >
> >
> > Footnotes:
> > [1] For notifying, I'll use an external program, for example
> > "notify-send", because the emacs window is not always visible.
>
>
[-- Attachment #2: Type: text/html, Size: 1615 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: notify, when something to do
2011-10-23 21:29 ` Bastien
2011-10-24 9:29 ` Sebastien Vauban
@ 2011-11-01 23:01 ` Peter Münster
1 sibling, 0 replies; 12+ messages in thread
From: Peter Münster @ 2011-11-01 23:01 UTC (permalink / raw)
To: emacs-orgmode
On Sun, Oct 23 2011, Bastien wrote:
>> - Perhaps the main problem: appt does not know about warning periods.
>> There are items with "-3d", other with "-5M"[1]. There is only one
>> universal appt-message-warning-time. Would it be possible, to have a
>> individual warning-time for each todo-item, directly computed from the
>> warning time in the org-timestamp?
>
> Check what info is available as text properties in the agenda
> (with `C-u C-x =') and see if you can use this information in
> a filter function.
There is `type = "upcoming-deadline"', so it should be doable.
Thanks for the filter-function and the scope-keywords!
--
Peter
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2011-11-01 23:02 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-23 10:07 notify, when something to do Peter Münster
2011-10-23 16:20 ` Tassilo Horn
2011-10-23 16:30 ` Tassilo Horn
2011-10-23 18:17 ` Peter Münster
2011-10-23 19:09 ` Tassilo Horn
2011-10-23 21:23 ` Bastien
2011-10-24 5:14 ` Tassilo Horn
2011-10-23 21:29 ` Bastien
2011-10-24 9:29 ` Sebastien Vauban
2011-11-01 23:01 ` Peter Münster
2011-10-24 15:01 ` Christopher Allan Webber
2011-10-25 18:56 ` Marcelo de Moraes Serpa
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).