ToDoChiKu is a notification package for emacs. It started life interfacing with Growl (OS X, http://growl.info/) and Snarl (Win 32, http://www.fullphat.net/) and libnotify (linux/unix). It can also do standard messages (in the minibuffer) and pop up a tooltip.
It also features icon sets for the external notifiers, so that different kinds of messages can have different kinds of icons.
You can customize it with customize-group todochiku.
Currently it notifies you on the following conditions:
The following packages also use ToDoChiKu features:
Fire todochiku on your load path, and then load it with:
Additionally you may want to add the iconset, which is available at http://bunny.jonnay.net/todochiku-icons.tar.gz
You may also need to add the following line before loading ToDoChiKu, if you are getting the error “Symbol’s function definition is void: case” when loading Emacs:
Once that is done, you will want to customize todochiku. If you already have a notification program (Growl or Snarl) set the variable Todochiku Command. The documentation string has a few suggestions for you, and the default should be filled in according to your os.
If you do not have an external notification program, figure out which way you wish to be notified (either by message on the minibufer, or by tool tip) and enable one or both. The message method is somewhat subtle and easy to miss. The tooltip is a bit obtrusive, but it seems to display whether or not emacs is in focus or not (at least on win32).
The other customization options are for setting up when a ToDoChiKu notification should fire (after compilation, when appt-message is displayed, etc.)
Until ToDoChiKu gets a little more widely used, I don’t think it is entirely apropos to require it as part of another package. It is probably far more useful to instead use featurep to see if todochiku is available, and if so, then notify:
(if (featurep 'todochiku) (add-hook 'cruisecontrol-post-build-hooks (lambda () (todochiku-message "Cruise Control" "build Started." (todochiku-icon 'compile)))))
todochiku-message is the meat of this package. It takes 3 arguments, a Title, a message, and an icon.
The todochiku-icon function takes a symbol, and returns (if available) an iocn for that symbol. The icon:symbol mapping is stored in the customizeable alist todochiku-icons. Below is a list of icons that are defined by default. If you want a new type of icon, just send JonathanArkell a message (via email or on the wiki) and I’ll do my best to add it.
The function todochiku-get-arguments is responsible for formatting the arguments into something that growl or snarl will understand.
I had to download snarl_command from http://www.darrenkitchen.net/temp/snarl_command.rar. snarl_command doesn’t appear to come with Snarl, and appears different from snarl_cmd.
The todochiku-icons link was broken as well, and I had to download them from http://github.com/jpenney/emacs-starter-kit/tree/b8bb2858a85fb3cbfaeeb795ce549490d545e790/jpenney/todochiku-icons
I can’t this to work OOTB. I get “File error: Searching for program, no such file or directory, notify-send”. What is “notify-send” and where might I find it? Is it part of some other software, or supposed to be part of this, or what?
notify-send is part of the package named libnotify, for linux systems. --Exal
Didn’t work for me out of the box. Setting todochiku-command to the full path (e.g. “/usr/local/bin/growlnotify”) and applying the following patch resolved all issues:
--- todochiku.el.1 2010-09-25 20:52:53.000000000 +0200 +++ todochiku.el 2011-02-14 18:17:02.000000000 +0100 @@ -252,7 +252,9 @@ (tooltip-show message))) (when (or (string= todochiku-command "") todochiku-message-too) - (message "%s" (propertize message 'face 'todochiku-message-face)))) + (case system-type + ('darwin (message "%s" message)) + (t (message "%s" (propertize message 'face 'todochiku-message-face)))))) (defun growl (title message) "Alias for `todochiku-message'." @@ -264,7 +266,10 @@ This would be better done through a customization probably." (case system-type ('windows-nt (list "/M" title message icon)) - ('darwin (list title (if sticky "-s" "") "-m" message "--image" icon )) + ('darwin + (if sticky + (list "-t" title "-s" "-m" message "-I" icon) + (list "-t" title "-m" message "-I" icon))) (t (list "-i" icon "-t" (if sticky "0" (int-to-string (* 1000 todochiku-timeout))) title message))))
To support Growl for Windows, and Snarl R2.5, I merged http://justinsboringpage.blogspot.jp/2009/09/making-emacs-growl.html .
--- todochiku.el 2012-06-18 22:21:24.000000000 +0900 +++ b/todochiku.el 2012-06-18 22:37:00.000000000 +0900 @@ -1,6 +1,6 @@ ;;; todochiku.el --- A mode for interfacing with Growl, Snarl, and the like. -(defconst todochiku-version "0.0.8") -;; Version: 0.0.8 +(defconst todochiku-version "0.8.0") +;; Version: 0.8.0 ;; Copyright (c)2008 Jonathan Arkell. (by)(nc)(sa) Some rights reserved. ;; Author: Jonathan Arkell <firstname.lastname@example.org> @@ -36,7 +36,7 @@ ;; ;; `todochiku-command' ;; Path to command for sending growl-like messages. -;; default = (case system-type (windows-nt "C:/Program Files/full phat/Snarl/exrras/sncmd/snarl_command.exe") (darwin "/usr/local/bin/growlnotify") (t "notify-send")) +;; default = (case system-type (windows-nt "C:/Program Files/full phat/Snarl/tools/heysnarl.exe") (darwin "/usr/local/bin/growlnotify") (t "notify-send")) ;; `todochiku-message-too' ;; Display todochiku as messages as well ;; default = nil @@ -61,6 +61,9 @@ ;; `todochiku-display-appts-in-window-too' ;; Whether or not pings from apt-disp-window should show up in emacs as well as growl. ;; default = (quote t) +;; `todochiku-appts-sticky' +;; Whether or not to make appt messages sticky. +;; default = (quote t) ;; This is more a smaller library package to start with. Maybe it will grow one day. @@ -98,6 +101,15 @@ ;; - Build better backend support. ;;; CHANGELOG: +;; V0.8.0 - Snarl R2.5.1 (comment-outed; see todochiku-get-arguments) +;; - better support for Growl for Windows +;; - Added todochiku-appts-sticky option. +;; V0.7.1 - Made growl interactive +;; - todochiku-icon can take an icon symbol (eg 'bell) as well as url +;; - or filename +;; - Fixed argument format so it works with Growl for windows +;; - (by Justin Heyes-Jones) +;; V0.7 - Added YaOddMuse interface ;; V0.0.8 - Fixed broken `todochiku-icons-directory' definition that made it impossible to change through Customize. ;; V0.0.7b - Added support for sticky messages for libnotify and growl. ;; V0.0.7 - Added YaOddMuse interface @@ -129,15 +141,13 @@ (defcustom todochiku-command (case system-type - (windows-nt "C:/Program Files/full phat/Snarl/exrras/sncmd/snarl_command.exe") + (windows-nt "C:/Program Files/full phat/Snarl/tools/heysnarl.exe") (darwin "/usr/local/bin/growlnotify") (t "notify-send")) "Path to command for sending growl-like messages. If you do not have an external notification program, leave this blank. For MacOS Growl: /usr/local/bin/growlnotify (a shot in the dark here) -For Win32 Snarl: C:/Program Files/full phat/Snarl/extras/sncmd/sncmd.exe - or - C:/Program Files/full phat/Snarl/extras/sncmd/snarl_command.exe +For Win32 Snarl: C:/Program Files/full phat/Snarl/tools/heysnarl.exe For Unix-like systems libnotify: notify-send (or /usr/bin/notify-send)" :type '(string) :group 'todochiku) @@ -209,6 +219,11 @@ :type '(boolean) :group 'todochiku) +(defcustom todochiku-appts-sticky 't + "Whether or not to make appt messages sticky." + :type '(boolean) + :group 'todochiku) + (defface todochiku-message-face '((default :forground "black" @@ -247,22 +262,45 @@ (defun growl (title message) "Alias for `todochiku-message'." - (todochiku-message title message "")) + (interactive "sTitle: \nsMessage: ") + (todochiku-message title message 'emacs)) ;;*JasonMcBrayer backend (defun todochiku-get-arguments (title message icon sticky) "Gets todochiku arguments. This would be better done through a customization probably." (case system-type - ('windows-nt (list "/M" title message icon)) - ('darwin (list title (if sticky "-s" "") "-m" message "--image" icon )) + ;('windows-nt (list "/M" title message icon)) ;; for old Snarl + ;;;; Growl for Windows + ('windows-nt (list "/a:Emacs" + (format "/ai:%s" (shell-quote-argument (todochiku-icon 'emacs))) + (format "/r:%s" (shell-quote-argument "General Notification")) + (format "/n:%s" (shell-quote-argument "General Notification")) + (format "/t:%s" (shell-quote-argument + (encode-coding-string title locale-coding-system))) + (format "/i:%s" (shell-quote-argument (todochiku-icon icon))) + (format "/s:%s" (if sticky "true" "false")) + (encode-coding-string message locale-coding-system))) + ;;;; Snarl R2.5.1 + ;; ('windows-nt (list (encode-coding-string + ;; (format "notify?icon=%s%s&title=%s&text=%s" + ;; (todochiku-icon icon) + ;; (if sticky "&timeout=0" "") + ;; title + ;; message) + ;; locale-coding-system))) + ('darwin + (if sticky (list "-n" "Emacs" "-a" "Emacs" "-t" title "-s" "-m" message "--image" icon) + (list "-n" "Emacs" "-a" "Emacs" "-t" title "-m" message "--image" icon))) (t (list "-i" icon "-t" (if sticky "0" (int-to-string (* 1000 todochiku-timeout))) title message)))) (defun todochiku-icon (icon) "Pull out an actual icon from the variable `todochiku-icons'." - (expand-file-name (concat todochiku-icons-directory "/" (cdr (assoc icon todochiku-icons))))) + (if (symbolp icon) + (expand-file-name (concat todochiku-icons-directory "/" (cdr (assoc icon todochiku-icons)))) + icon)) (defun todochiku-in (message mins) "Send a todochiku message in a set ammount of time. Can take a prefix arg for the number of mins to wait." @@ -278,7 +316,9 @@ "A helper function to interface with appt-disp-window-function." (todochiku-message (concat "Appt in " min-to-app) (concat appt-msg "\n" min-to-app " Mins\n" new-time) - (todochiku-icon 'alarm)) + (todochiku-icon 'alarm) + todochiku-appts-sticky + ) (if todochiku-display-appts-in-window-too (appt-disp-window min-to-app new-time appt-msg)))