[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
automatic reminders in Emacs as pop ups [was: Re: [Orgmode] Survey resul
From: |
Nick Dokos |
Subject: |
automatic reminders in Emacs as pop ups [was: Re: [Orgmode] Survey results ] |
Date: |
Sun, 27 Jan 2008 17:11:08 -0500 |
One answer to question 5 on the survey was another question: automatic
reminders in Emacs as pop ups?
Here is how I do it, using very little machinery. As part of org-mode
initialization, I add appointments from the diary to the agenda at
startup and I also make org-agenda-redo rescan the appt list:
-----------------------------------
(require 'appt)
(setq org-agenda-include-diary t)
(setq appt-time-msg-list nil)
(org-agenda-to-appt)
(defadvice org-agenda-redo (after org-agenda-redo-add-appts)
"Pressing `r' on the agenda will also add appointments."
(progn
(setq appt-time-msg-list nil)
(org-agenda-to-appt)))
(ad-activate 'org-agenda-redo)
-----------------------------------
I enable appt reminders, set the format to 'window and provide
a display function that calls a python program to do the popup:
-----------------------------------
(progn
(appt-activate 1)
(setq appt-display-format 'window)
(setq appt-disp-window-function (function my-appt-disp-window))
(defun my-appt-disp-window (min-to-app new-time msg)
(call-process "/home/nick/bin/popup.py" nil 0 nil min-to-app msg new-time)))
-----------------------------------
Finally, the popup.py program is trivial:
-----------------------------------
#!/usr/bin/env python
""" Simple dialog popup example similar to the GTK+ Tutorials one """
import gtk
import sys
mins = sys.argv[1]
text = ' '.join(sys.argv[2:])
dialog = gtk.MessageDialog(None,
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
gtk.MESSAGE_INFO, gtk.BUTTONS_OK,
"Appt in %s mins: %s" % (mins, text))
dialog.run()
dialog.destroy()
-----------------------------------
HTH,
Nick