Use org-notify to show a notification and possibly play a sound.

This commit is contained in:
Bastien Guerry 2009-08-24 02:44:29 +08:00
parent 486e807b1b
commit 754694dd4b
3 changed files with 15 additions and 5 deletions

View File

@ -1,5 +1,11 @@
2009-08-23 Bastien Guerry <bzg@altern.org>
* org-timer.el (org-timer-set-timer): Use `org-notify' and play a
sound when showing the notification.
* org-clock.el (org-notify): New function.
(org-clock-notify-once-if-expired): Use `org-notify'.
* org-gnus.el (org-gnus-store-link): Handle `gnus-summary-mode'
and `gnus-article-mode' separately.
(gnus-summary-article-header): Fix the declare-function.

View File

@ -439,12 +439,16 @@ Notification is shown only once."
(if (>= clocked-time effort-in-minutes)
(unless org-clock-notification-was-shown
(setq org-clock-notification-was-shown t)
(org-clock-play-sound)
(org-show-notification
(org-notify
(format "Task '%s' should be finished by now. (%s)"
org-clock-heading org-clock-effort)))
org-clock-heading org-clock-effort) t))
(setq org-clock-notification-was-shown nil)))))
(defun org-notify (notification &optional play-sound)
"Send a NOTIFICATION and maybe PLAY-SOUND."
(org-show-notification (notification))
(if play-sound (org-clock-play-sound)))
(defun org-show-notification (notification)
"Show notification.
Use `org-show-notification-handler' if defined,

View File

@ -317,8 +317,8 @@ VALUE can be `on', `off', or `pause'."
(if (not (or (eval timer) timer-set))
(setq timer-set t
timer
(run-with-timer secs nil 'org-show-notification
(format "%s: time out" hl))
(run-with-timer
secs nil 'org-notify (format "%s: time out" hl) t)
org-timer-last-timer timer)))
'(org-timer-timer1
org-timer-timer2