Posts: 45 | Thanked: 30 times | Joined on Feb 2010 @ Germany
#1
Hello all,

I finally found out how to do alarms in emacs org-mode (the only decent PIM application I am aware of)

I found the easiest way is to completely replace appt-display-message by my own function. Be aware that some of the appt related setting are not obeyed by my own function. It does an alarm, period.

So I first define my own alarm function
Code:
(defun org-alarm (txt)
  (call-process "/usr/bin/dbus-send" nil nil nil
                "--type=method_call"
                "--dest=org.freedesktop.Notifications"
                "/org/freedesktop/Notifications"
                "org.freedesktop.Notifications.SystemNoteDialog"
                (concat "string:" txt)
                "uint32:0"
                "string:Ok"
                )
  (sit-for 1)
  (start-process "org-alarm" nil "play-sound" "/usr/share/sounds/call-ringtone01.wav")
)
It pops up a notification and plays a ringtone.

Then I let appt-display-message use it

Code:
(defun appt-display-message (string mins)
  "appointmentg reminder for maemo"
  (org-alarm (format "%s \nin  %d min" string mins)))
Finally I want my alarms to be updated whenever I refresh the agenda.

Code:
(add-hook 'org-agenda-mode-hook
          '(lambda nil (org-agenda-to-appt 'refresh "!")))
(appt-activate)
This creates an appointment (which will ring the alarm) for all entries which contain an exclamation mark. I created an agenda template which puts an exclamation mark in front of all DEADLINE marked entries. For SCHEDULED it does not, but I am free to just type in an exclamation mark if I want an alarm.


The time-related alarm settings all work. You can ask for alarms starting 10 minutes before the event with reminders every 4 minutes and stuff.

So just putting the above code snippets into your .emacs file should do the trick.
 

The Following 2 Users Say Thank You to drautzburg For This Useful Post:
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 06:17.