contrib/lisp/org-notify.el: Make `org-notify-start' interactive. Clean-up.

* org-notify.el (org-notify-start): Make interactive.
(org-notify-add, org-notify-start, org-notify-stop)
(org-notify-select-highest-window, default): Docstring and
indentation clean-up.
This commit is contained in:
Bastien Guerry 2012-08-25 10:06:55 +02:00
parent 2ecc210822
commit 9c3386567c
1 changed files with 27 additions and 21 deletions

View File

@ -35,6 +35,7 @@
;; (org-notify-start)
;; Example setup:
;;
;; (org-notify-add 'appt
;; '(:time "-1s" :period "20s" :duration 10
;; :actions (-message -ding))
@ -42,6 +43,7 @@
;; :actions -notify)
;; '(:time "2h" :period "5m" :actions -message)
;; '(:time "3d" :actions -email))
;;
;; This means for todo-items with `notify' property set to `appt': 3 days
;; before deadline, send a reminder-email, 2 hours before deadline, start to
;; send messages every 5 minutes, then 15 minutes before deadline, start to
@ -173,15 +175,18 @@ forgotten tasks."
(return)))))))
(defun org-notify-add (name &rest params)
"Add a new notification type. The NAME can be used in Org-mode property
`notify'. If NAME is `default', the notification type applies for todo items
without the `notify' property. This file predefines such a default
"Add a new notification type.
The NAME can be used in Org-mode property `notify'. If NAME is
`default', the notification type applies for todo items without
the `notify' property. This file predefines such a default
notification type.
Each element of PARAMS is a list with parameters for a given time
distance to the deadline. This distance must increase from one element to
the next.
distance to the deadline. This distance must increase from one
element to the next.
List of possible parameters:
:time Time distance to deadline, when this type of notification shall
start. It's a string: an integral value (positive or negative)
followed by a unit (s, m, h, d, w, M).
@ -189,8 +194,8 @@ List of possible parameters:
user. Instead of a function name, you can also supply a suffix
of one of the various predefined `org-notify-action-xxx'
functions.
:period Optional: can be used to repeat the actions periodically. Same
format as :time.
:period Optional: can be used to repeat the actions periodically.
Same format as :time.
:duration Some actions use this parameter to specify the duration of the
notification. It's an integral number in seconds.
:audible Overwrite the value of `org-notify-audible' for this action.
@ -200,11 +205,12 @@ ones, whose names are prefixed with `org-notify-action-'."
(setq org-notify-map (plist-put org-notify-map name params)))
(defun org-notify-start (&optional secs)
"Start the notification daemon. If SECS is positive, it's the
period in seconds for processing the notifications of one
org-agenda file, and if negative, notifications will be checked
only when emacs is idle for -SECS seconds. The default value for
SECS is 20."
"Start the notification daemon.
If SECS is positive, it's the period in seconds for processing
the notifications of one org-agenda file, and if negative,
notifications will be checked only when emacs is idle for -SECS
seconds. The default value for SECS is 20."
(interactive)
(if org-notify-timer
(org-notify-stop))
(setq secs (or secs 20)