emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] org-show-notification will use todochiku.el if available
@ 2009-07-22 18:43 Jason F. McBrayer
  2009-07-23 15:41 ` Bastien
  0 siblings, 1 reply; 3+ messages in thread
From: Jason F. McBrayer @ 2009-07-22 18:43 UTC (permalink / raw)
  To: org-mode list


This is a little patch to let org-show-notification (in org-clock.el)
use the package [todochiku.el] if available.  This means that if
todochiku has been set up correctly, org-show-notification will work
with Growl (on MacOS) or Snarl (on MSWindows), as well as libnotify (on
*ix). 

[todochiku.el] http://www.emacswiki.org/emacs-se/ToDoChiKu
---
 lisp/org-clock.el |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 594d3cf..5428aa1 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -440,9 +440,12 @@ Notification is shown only once."
 	(setq org-clock-notification-was-shown nil)))))
 
 (defun org-show-notification (notification)
-  "Show notification. Use libnotify, if available."
-  (if (org-program-exists "notify-send")
-      (start-process "emacs-timer-notification" nil "notify-send" notification))
+  "Show notification. Use todochiku.el or libnotify, if available."
+  (if (fboundp 'todochiku-message)
+      (todochiku-message "org-mode notification" notification
+                         (todochiku-icon 'emacs))
+    (if (org-program-exists "notify-send")
+        (start-process "emacs-timer-notification" nil "notify-send" notification)))
   ;; In any case, show in message area
   (message notification))
 
-- 
1.6.1.2


-- 
+-----------------------------------------------------------+  
| Jason F. McBrayer                    jmcbray@carcosa.net  |  
| If someone conquers a thousand times a thousand others in |  
| battle, and someone else conquers himself, the latter one |  
| is the greatest of all conquerors.  --- The Dhammapada    |  

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] org-show-notification will use todochiku.el if available
  2009-07-22 18:43 [PATCH] org-show-notification will use todochiku.el if available Jason F. McBrayer
@ 2009-07-23 15:41 ` Bastien
  2009-07-23 18:27   ` Jason F. McBrayer
  0 siblings, 1 reply; 3+ messages in thread
From: Bastien @ 2009-07-23 15:41 UTC (permalink / raw)
  To: Jason F. McBrayer; +Cc: org-mode list

Hi Jason,

thanks a lot for the idea.  I have generalized this approach a bit by
adding a new option: org-show-notification-handler.  

The value of this new variable can either be an elisp function or a
program.  The function/program will be called with the notification 
string as an argument.

So for example:

(setq org-show-notification-handler
      '(lambda (notification)
	 (todochiku-message "org-mode notification" notification
			    (todochiku-icon 'emacs))))

should do what you want.

If this variable is nil, the notification mechanism falls back on
notify-send (if available) and the elisp message otherwise.

Thanks again!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] org-show-notification will use todochiku.el if available
  2009-07-23 15:41 ` Bastien
@ 2009-07-23 18:27   ` Jason F. McBrayer
  0 siblings, 0 replies; 3+ messages in thread
From: Jason F. McBrayer @ 2009-07-23 18:27 UTC (permalink / raw)
  To: Bastien; +Cc: org-mode list

Bastien <bastienguerry@googlemail.com> writes:

> thanks a lot for the idea.  I have generalized this approach a bit by
> adding a new option: org-show-notification-handler.  

That certainly does the job.  For me it means configuring notification
method in two places (org and todochiku), but that's not unreasonable,
given that not very many people will have todochiku installed.  Thanks
for including the feature if not the patch.

-- 
+-----------------------------------------------------------+  
| Jason F. McBrayer                    jmcbray@carcosa.net  |  
| If someone conquers a thousand times a thousand others in |  
| battle, and someone else conquers himself, the latter one |  
| is the greatest of all conquerors.  --- The Dhammapada    |  

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-07-23 18:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-22 18:43 [PATCH] org-show-notification will use todochiku.el if available Jason F. McBrayer
2009-07-23 15:41 ` Bastien
2009-07-23 18:27   ` Jason F. McBrayer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).