automatic reminders in Emacs as pop ups [was: Re: [Orgmode] Survey results ]

2008-01-27 Thread Nick Dokos
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


___
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


Re: automatic reminders in Emacs as pop ups [was: Re: [Orgmode] Survey results ]

2008-01-27 Thread Piotr Zielinski
Also, debian/ubuntu package libnotify-bin contains a command-line
utility notify-send that you can use to display non-modal user
notifications, in the same way as popup.py.

Piotr

On Jan 27, 2008 10:11 PM, Nick Dokos [EMAIL PROTECTED] wrote:
 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


 ___
 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



___
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