Thursday, September 10, 2009

Making emacs growl

Roaring lion

I've always wished emacs could notify me of it's doings. For example the message function just pops up text in the minibuffer and is easy to miss, and impossible to see when the window is not in focus. So I was pleased when looking through the
twit.el code to find out about todochiku, and emacs interface to Growl.

Download Growl for windows and set it up. Send yourself a test growl at the command prompt like this:

"C:/Progra~1/Growlf~1/growlnotify.exe" /T:"title" "message"

Once that's working you can send notifications from emacs. todochiku is an emacs package for sending notifications to growl, snarl or whatever you have. In our case we have growl. Unfortunately the windows default is to use snarl, and there's no support for growl. I've made a few modifications to the original to get that working and uploaded the new file here. (Ideally I should make it so it searches both for windows and for growl or snarl being installed but for now the choice is made manually)

heyes-jones.com/todochiku.el

Download the elisp file into a directory in your emacs load-path (or add it) and add the (require 'todochiku) command to your .emacs file. Reload emacs, or just hit C-x e after the (require command in your .emacs)

You will need (require 'cl) somewhere before this is loaded (.emacs perhaps)

Customize the variables for the program using M-x customize-group todochiku

You'll need to set the `todochiku command' to something like this:

C:/Progra~1/Growlf~1/growlnotify.exe

Use "Dir /x *" in a folder to find out what the 8 character name is.

If you want icons that come with todochiku then download them from the todochiku wiki page and point to them with the variable `todochiku icons directory'. For example mine is set to:

~/localemacs/todochiku-icons

Finally you can do a growl... try this

(growl "Emacs" "Hello")



There's also `todochiku-message' which let's you specify an icon. This can be an image filename, and url, or an icon symbol from the built in list of icons you can find by the variable `todochiku-icons'.

(todochiku-message "Emacs" "You're growlingnow" 'social)

(todochiku-message "Emacs" "You're growlingnow" "http://www.growlforwindows.com/gfw/images/downloadlatest.gif")

(todochiku-message "Emacs" "You're growlingnow"
"c:/cygwin/home/Justin/localemacs/todochiku-icons/binary.png")

There's a command `todochiku-in' which will send you a notification from emacs in a set number of minutes.

(todochiku-in "hello" 3)


If you use twit.el you should find that todochiku automatically notifying you of tweets if you have called `show-recent-tweets'.

It's very simple to use todochiku and growl so you should find all kinds of applications for this. Have fun!



9 comments:

Jonnay said...

I am glad you like ToDoChiKu. :) The net version will have a better abstracted backend support, so that it will be much easier to swap backends.

It'll be posted to emacswiki when it's done.

Cheers!

Justin said...

Cool! Let me know if you want it test driven; or want any assistance with it.

brian dunnington said...

nice! i posted a link to your instructions from the main Growl for Windows Apps page:

http://www.growlforwindows.com/gfw/apps.aspx

Justin said...

Thanks Brian!

Diego said...
This comment has been removed by the author.
Diego said...

I got the following error on Emacs for Windows initialization after inserting (require 'todochiku) in .emacs :

Symbol's function definition is void: case

I could solve this problem inserting(require 'cl) before (require 'todochiku)

Justin said...

Thanks for noticing that. I think I require 'cl in my .emacs file so I didn't notice.

DuckPuppy said...

So, did you remap your Meta key from Alt to something else? For some reason whenever GfW is enabled (and by that I simply mean the switch in the preferences is set to "on"), "Alt-X" stops working in Emacs... but other Alt- combinations work. It drove me batty until I found that Growl was the culprit. I prefer Growl to Snarl, but Snarl works and Growl doesn't.

Justin said...

Yeah I found that problem and posted about it on the Growl google group with a solution here:

http://groups.google.com/group/growl-for-windows/browse_thread/thread/8f725c32b77aad26/b7779c381b02f780?lnk=gst&q=justinhj#b7779c381b02f780