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