A new major version of <ahref="http://www.gnu.org/software/emacs/">emacs</a> is out, and it includes dbus support. This is great, because it means we can do things like this:<br/><br/><blockquote><pre><br/>(require 'dbus)<br/>(defun send-desktop-notification (summary body timeout)<br/> "call notification-daemon method METHOD with ARGS over dbus"<br/> (dbus-call-method<br/> :session ; use the session (not system) bus<br/> "org.freedesktop.Notifications" ; service name<br/> "/org/freedesktop/Notifications" ; path name<br/> "org.freedesktop.Notifications" "Notify" ; Method<br/> "emacs"<br/> 0<br/> ""<br/> summary<br/> body<br/> '(:array)<br/> '(:array :signature "{sv}")<br/> ':int32 timeout))<br/><br/>(defun pw/compile-notify (buffer message)<br/> (send-desktop-notification "emacs compile" message 0))<br/><br/>(setq compilation-finish-function 'pw/compile-notify)<br/></pre></blockquote><br/><br/>Add this to your .emacs file and you will receive a libnotify popup when M-x compile completes. It will even give you the exit message, so you know whether the compile was successful.<br/><br/>So now you can let that long compile run, and work on <ahref="http://xkcd.com/303/">something else</a>. emacs will let you know when the compile finishes.<br/><br/>As written above, the notifications will stay on your screen until you dismiss them (by clicking on them). If you would like them to vanish after a preset time limit, change the 0 in the call to send-desktop-notification. Set it to the number of milliseconds the popup should remain on the screen.<br/><br/>[caption id="attachment_173" align="alignright" width="300" caption="Screenshot of libnotify popup showing a compiler error"]<ahref="http://stringofbits.files.wordpress.com/2009/08/compile_bad1.png"><imgsrc="http://stringofbits.files.wordpress.com/2009/08/compile_bad1.png?w=300"alt="Screenshot of libnotify popup showing a compiler error"title="compile_bad"width="300"height="99"class="size-medium wp-image-173"/></a>[/caption]<br/><br/>This is just the tip of the iceberg, of course. Any application that presents a dbus interface can be interacted with from emacs, which means that emacs can also integrate itself with the Linux desktop in <ahref="http://emacs-fu.blogspot.com/2009/01/using-d-bus-example.html">other interesting ways</a>.