<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>A Random String of Bits &#187; emacs</title>
	<atom:link href="http://stringofbits.net/tag/emacs/feed/" rel="self" type="application/rss+xml" />
	<link>http://stringofbits.net</link>
	<description>Sequences of bytes about Technology, Games, Programming, and more</description>
	<lastBuildDate>Thu, 25 Feb 2010 14:36:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>emacs 23, dbus, and libnotify</title>
		<link>http://stringofbits.net/2009/08/emacs-23-dbus-and-libnotify/</link>
		<comments>http://stringofbits.net/2009/08/emacs-23-dbus-and-libnotify/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 03:47:44 +0000</pubDate>
		<dc:creator>Patrick</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://stringofbits.net/?p=166</guid>
		<description><![CDATA[A new major version of emacs is out, and it includes dbus support. This is great, because it means we can do things like this: (require 'dbus) (defun send-desktop-notification (summary body timeout) "call notification-daemon method METHOD with ARGS over dbus" (dbus-call-method :session ; use the session (not system) bus "org.freedesktop.Notifications" ; service name "/org/freedesktop/Notifications" ; [...]]]></description>
			<content:encoded><![CDATA[<p>A new major version of <a href="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:</p>
<blockquote><pre>
(require 'dbus)
(defun send-desktop-notification (summary body timeout)
  "call notification-daemon method METHOD with ARGS over dbus"
  (dbus-call-method
    :session                        ; use the session (not system) bus
    "org.freedesktop.Notifications" ; service name
    "/org/freedesktop/Notifications"   ; path name
    "org.freedesktop.Notifications" "Notify" ; Method
    "emacs"
    0
    ""
    summary
    body
    '(:array)
    '(:array :signature "{sv}")
    ':int32 timeout))

(defun pw/compile-notify (buffer message)
  (send-desktop-notification "emacs compile" message 0))

(setq compilation-finish-function 'pw/compile-notify)
</pre>
</blockquote>
<p>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.</p>
<p>So now you can let that long compile run, and work on <a href="http://xkcd.com/303/">something else</a>.  emacs will let you know when the compile finishes.</p>
<p>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.</p>
<div id="attachment_173" class="wp-caption alignright" style="width: 310px"><a href="http://stringofbits.net/wp-content/compile_bad.png"><img src="http://stringofbits.net/wp-content/compile_bad-300x99.png" alt="Screenshot of libnotify popup showing a compiler error" title="compile_bad" width="300" height="99" class="size-medium wp-image-173" /></a><p class="wp-caption-text">Screenshot of libnotify popup showing a compiler error</p></div>
<p>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 <a href="http://emacs-fu.blogspot.com/2009/01/using-d-bus-example.html">other interesting ways</a>.</p>
 <img src="http://stringofbits.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=166" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://stringofbits.net/2009/08/emacs-23-dbus-and-libnotify/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
