<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3992530807750384868</id><updated>2013-05-17T18:31:17.334+03:00</updated><category term='beamer'/><category term='mu4e'/><category term='meta'/><category term='interview'/><category term='updated'/><category term='erc'/><category term='basic'/><category term='web'/><category term='emacs24'/><category term='e-mail'/><category term='latex'/><category term='programming'/><category term='windows'/><category term='email'/><category term='new'/><category term='background'/><category term='emacs23'/><category term='org-mode'/><category term='wanderlust'/><category term='presentations'/><title type='text'>emacs-fu</title><subtitle type='html'>useful tricks for emacs</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default?start-index=26&amp;max-results=25'/><author><name>djcb</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_kGFGcbwevHE/R1Rgjkq0h3I/AAAAAAAAAMg/KLj-i9qWXGg/S220/rupert.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>137</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-5611080369015051953</id><published>2013-03-17T20:13:00.002+02:00</published><updated>2013-03-17T20:13:37.800+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><category scheme='http://www.blogger.com/atom/ns#' term='basic'/><title type='text'>editing with root-privileges -- once more</title><content type='html'>&lt;div class="outline-text-2" id="text-1"&gt;

&lt;p&gt;  
  We've already discussed editing root-owned files here a few times; it's one
  of those tasks where in a reflex I still open a terminal and use &lt;code&gt;vi&lt;/code&gt; to do
  the job&amp;hellip; the only way to overcome that seems to be to make it &lt;i&gt;really&lt;/i&gt;
  easy to do the same from within my running emacs:
&lt;/p&gt;



&lt;pre class="src src-elisp"&gt;  (&lt;span style="color: #bc8383; font-weight: bold;"&gt;defun&lt;/span&gt; &lt;span style="color: #8fb28f; font-weight: bold;"&gt;djcb-find-file-as-root&lt;/span&gt; ()
  &lt;span style="color: #8fb28f; font-style: italic;"&gt;"Like `ido-find-file, but automatically edit the file with&lt;/span&gt;
&lt;span style="color: #8fb28f; font-style: italic;"&gt;root-privileges (using tramp/sudo), if the file is not writable by&lt;/span&gt;
&lt;span style="color: #8fb28f; font-style: italic;"&gt;user."&lt;/span&gt;
  (interactive)
  (&lt;span style="color: #bc8383; font-weight: bold;"&gt;let&lt;/span&gt; ((file (ido-read-file-name &lt;span style="color: #6ca0a3;"&gt;"Edit as root: "&lt;/span&gt;)))
    (&lt;span style="color: #bc8383; font-weight: bold;"&gt;unless&lt;/span&gt; (file-writable-p file)
      (&lt;span style="color: #bc8383; font-weight: bold;"&gt;setq&lt;/span&gt; file (concat &lt;span style="color: #6ca0a3;"&gt;"/sudo:root@localhost:"&lt;/span&gt; file)))
    (find-file file)))
&lt;span style="color: #9fc59f;"&gt;;; &lt;/span&gt;&lt;span style="color: #7f9f7f; font-style: italic;"&gt;or some other keybinding...&lt;/span&gt;
(global-set-key (kbd &lt;span style="color: #6ca0a3;"&gt;"C-x F"&lt;/span&gt;) 'djcb-find-file-as-root)
&lt;/pre&gt;


&lt;p&gt;  
  We could take it one step further still – overload the normal
  &lt;code&gt;(ido-)find-file&lt;/code&gt; with a version that checks the permissions first, and if
  needed, use the above function to open it. But maybe that is &lt;i&gt;too&lt;/i&gt; easy; we
  should be careful with root-owned files after all.
&lt;/p&gt;&lt;/div&gt;

</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/5611080369015051953/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=5611080369015051953' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/5611080369015051953'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/5611080369015051953'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2013/03/editing-with-root-privileges-once-more.html' title='editing with root-privileges -- once more'/><author><name>djcb</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_kGFGcbwevHE/R1Rgjkq0h3I/AAAAAAAAAMg/KLj-i9qWXGg/S220/rupert.jpg'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-4103319572093770798</id><published>2012-10-15T11:46:00.000+03:00</published><updated>2012-10-15T11:46:19.872+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><category scheme='http://www.blogger.com/atom/ns#' term='email'/><category scheme='http://www.blogger.com/atom/ns#' term='mu4e'/><category scheme='http://www.blogger.com/atom/ns#' term='emacs24'/><category scheme='http://www.blogger.com/atom/ns#' term='emacs23'/><title type='text'>mu4e v0.9.9 is out!</title><content type='html'>&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div class="outline-text-2" id="text-1"&gt;


&lt;p&gt;   
  I few months ago, I introduced &lt;code&gt;mu4e&lt;/code&gt;, a modest little emacs mail client that
  I wrote. It seems many people picked it up, great!
&lt;/p&gt;

&lt;/div&gt;

&lt;div id="outline-container-1-1" class="outline-3"&gt;
&lt;h3 id="sec-1-1"&gt;what's new?&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1-1"&gt;


&lt;p&gt;
  I have just released &lt;a href="http://code.google.com/p/mu0/downloads/detail?name=mu-0.9.9.tar.gz"&gt;mu/mu4e version 0.9.9&lt;/a&gt;. There are quite a few changes,
  both user-visible and 'under-the-hood'. I've also spent some time on improving
  &lt;a href="http://code.google.com/p/mu0/downloads/detail?name=mu4e-manual-0.9.9.pdf"&gt;the manual&lt;/a&gt; (pdf), and I'm quite happy about it.
&lt;/p&gt;
&lt;p&gt;
  Some of the more visible new things in &lt;code&gt;mu4e&lt;/code&gt; are:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Support for crypto (decrypting messages, signing them)
&lt;/li&gt;
&lt;li&gt;Support for &lt;i&gt;refiling&lt;/i&gt; (like &lt;code&gt;mutt&lt;/code&gt;, Wanderlust)
&lt;/li&gt;
&lt;li&gt;Dynamic folders (instead of hard-coding the sent/draft/trash/refile folder,
    they can be &lt;i&gt;functions&lt;/i&gt; that return different folders based on the message
    we're dealing with, see the example below)
&lt;/li&gt;
&lt;li&gt;Same for the folder to save attachments
&lt;/li&gt;
&lt;li&gt;A lot of smaller and bigger UI improvements
&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;
  Also, the core &lt;code&gt;mu&lt;/code&gt; program has seen a lot of improvements (many of which
  directly improve &lt;code&gt;mu4e&lt;/code&gt; as well)
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Better support for non-ascii locales / character sets, such as &lt;code&gt;ISO-2022-JP&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Improved on-line help ('&lt;code&gt;mu help ...&lt;/code&gt;')
&lt;/li&gt;
&lt;li&gt;Performance improvements for threaded display  (~ 25% for 23K messages) 
&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt; 
  For a more complete list, see &lt;a href="https://github.com/djcb/mu/blob/master/NEWS"&gt;NEWS&lt;/a&gt;.   
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1-2" class="outline-3"&gt;
&lt;h3 id="sec-1-2"&gt;dynamic folders&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1-2"&gt;


&lt;p&gt;
   As mentioned, &lt;code&gt;mu4e&lt;/code&gt; now supports &lt;i&gt;dynamic folders&lt;/i&gt;. Before, you'd set your
   trash folder to some static string:
&lt;/p&gt;



&lt;pre class="src src-elisp"&gt;(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; mu4e-trash-folder &lt;span class="org-string"&gt;"/trash"&lt;/span&gt;)
&lt;/pre&gt;


&lt;p&gt;
   In some cases, you may want to have a bit more flexibility – for example,
   have a separate trash-folder (or sent-folder, drafts-folder, refile-folder)
   for private mail and work mail. You can now do something like:
&lt;/p&gt;



&lt;pre class="src src-elisp"&gt;(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; mu4e-trash-folder
  (&lt;span class="org-keyword"&gt;lambda&lt;/span&gt; (msg)
    (&lt;span class="org-keyword"&gt;if&lt;/span&gt; (and msg &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;msg may be nil&lt;/span&gt;
          (mu4e-message-contact-field-matches msg &lt;span class="org-builtin"&gt;:to&lt;/span&gt; &lt;span class="org-string"&gt;"me@work.com"&lt;/span&gt;))
      &lt;span class="org-string"&gt;"/trash-work"&lt;/span&gt;
      &lt;span class="org-string"&gt;"/trash"&lt;/span&gt;)))
&lt;/pre&gt;


&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1-3" class="outline-3"&gt;
&lt;h3 id="sec-1-3"&gt;refiling&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1-3"&gt;


&lt;p&gt;
   After I have dealt with some e-mail, I either delete it or move it to some
   archive folder – &lt;i&gt;refiling&lt;/i&gt;. For this, there is now the &lt;code&gt;r&lt;/code&gt; keybinding, and
   &lt;code&gt;mu4e-refile-folder&lt;/code&gt;; and a place where dynamic folders really shine:
&lt;/p&gt;



&lt;pre class="src src-elisp"&gt;(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; mu4e-refile-folder
  (&lt;span class="org-keyword"&gt;lambda&lt;/span&gt; (msg)
    (&lt;span class="org-keyword"&gt;cond&lt;/span&gt;
      &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;messages to the mu mailing list go to the /mu folder&lt;/span&gt;
      ((mu4e-message-contact-field-matches msg &lt;span class="org-builtin"&gt;:to&lt;/span&gt;
         &lt;span class="org-string"&gt;"mu-discuss@googlegroups.com"&lt;/span&gt;)
        &lt;span class="org-string"&gt;"/mu"&lt;/span&gt;)
      &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;messages sent directly to me go to /archive&lt;/span&gt;
      &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;also `&lt;/span&gt;&lt;span class="org-comment"&gt;&lt;span class="org-constant"&gt;mu4e-user-mail-address-regexp&lt;/span&gt;&lt;/span&gt;&lt;span class="org-comment"&gt;' can be used&lt;/span&gt;
      ((mu4e-message-contact-field-matches msg &lt;span class="org-builtin"&gt;:to&lt;/span&gt; &lt;span class="org-string"&gt;"me@example.com"&lt;/span&gt;)
        &lt;span class="org-string"&gt;"/private"&lt;/span&gt;)
      &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;messages with football or soccer in the subject go to /football&lt;/span&gt;
      ((string-match &lt;span class="org-string"&gt;"football&lt;/span&gt;&lt;span class="org-string"&gt;&lt;span class="org-regexp-grouping-backslash"&gt;\\&lt;/span&gt;&lt;/span&gt;&lt;span class="org-string"&gt;&lt;span class="org-regexp-grouping-construct"&gt;|&lt;/span&gt;&lt;/span&gt;&lt;span class="org-string"&gt;soccer"&lt;/span&gt; (or (mu4e-message-field msg &lt;span class="org-builtin"&gt;:subject&lt;/span&gt;) &lt;span class="org-string"&gt;""&lt;/span&gt;))
        &lt;span class="org-string"&gt;"/football"&lt;/span&gt;)
      &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;everything else goes to /archive&lt;/span&gt;
      &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;important to have a catch-all at the end!&lt;/span&gt;
      (t &lt;span class="org-string"&gt;"/archive"&lt;/span&gt;))))
&lt;/pre&gt;


&lt;p&gt;
   How cool is that? After reading my inbox folder, I select all messages (&lt;code&gt;C-x    h&lt;/code&gt;), press &lt;code&gt;r&lt;/code&gt;, and they're all moved to the right refiling folder.
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1-4" class="outline-3"&gt;
&lt;h3 id="sec-1-4"&gt;crypto support&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1-4"&gt;


&lt;p&gt;
   &lt;code&gt;mu4e&lt;/code&gt; already supported signing/encrypting messages, but now it supports
   decryption and verifying signatures as well. This was one of the most
   requested new features. I think it is still a bit rough, but it has been
   working very well for me.
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1-5" class="outline-3"&gt;
&lt;h3 id="sec-1-5"&gt;so&amp;hellip;&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1-5"&gt;


&lt;p&gt;
   I think version 0.9.9 is a great new step for &lt;code&gt;mu4e&lt;/code&gt;. It already goes far
   beyond I ever planned to do. I received a lot of suggestions for new
   features, which is great! I'm not planning to implement all of those, but I
   will try to make &lt;code&gt;mu4e&lt;/code&gt; even more programmable – it should be easy to augment
   &lt;code&gt;mu4e&lt;/code&gt; with your own little elisp-snippets – the &lt;i&gt;Barbapapa principle&lt;/i&gt; of
   software, already so clearly present in emacs itself.
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/4103319572093770798/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=4103319572093770798' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/4103319572093770798'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/4103319572093770798'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2012/10/mu4e-v099-is-out.html' title='mu4e v0.9.9 is out!'/><author><name>djcb</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_kGFGcbwevHE/R1Rgjkq0h3I/AAAAAAAAAMg/KLj-i9qWXGg/S220/rupert.jpg'/></author><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-4834923182031297599</id><published>2012-08-20T22:31:00.000+03:00</published><updated>2012-09-16T23:16:06.743+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='updated'/><category scheme='http://www.blogger.com/atom/ns#' term='email'/><category scheme='http://www.blogger.com/atom/ns#' term='background'/><category scheme='http://www.blogger.com/atom/ns#' term='emacs24'/><category scheme='http://www.blogger.com/atom/ns#' term='e-mail'/><category scheme='http://www.blogger.com/atom/ns#' term='emacs23'/><title type='text'>introducing mu4e, an e-mail client for emacs</title><content type='html'>&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div class="outline-text-2" id="text-1"&gt;
&lt;/div&gt;

&lt;div id="outline-container-1-1" class="outline-3"&gt;
&lt;h3 id="sec-1-1"&gt;background&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1-1"&gt;


&lt;p&gt;
   I've haven't written too much here lately. This is because I have spent most
   of my emacs hacking time on &lt;code&gt;mu4e&lt;/code&gt;, an emacs e-mail client. It's only
   slightly over six months old since its first release, but it has progressed
   rather quickly! So, I think it is time to give it an introduction to a wider
   audience. In future posts, I'll go into more detail.
&lt;/p&gt;
&lt;p&gt;   
   E-mail is a very important means of communication for me; and for purposes of
   integration, it prefer to do my e-mail with emacs. For a long time, I used
   &lt;code&gt;mutt&lt;/code&gt; with emacs as the editor; a few years back I switched to &lt;a href="http://www.gohome.org/wl/"&gt;Wanderlust&lt;/a&gt;,
   and wrote &lt;a href="http://emacs-fu.blogspot.fi/search/label/wanderlust"&gt;a few articles&lt;/a&gt; about it.
&lt;/p&gt;
&lt;p&gt;   
   There's a lot to like about Wanderlust: it's very featureful, and allows for
   a lot of customization. Still, there were a few things I was not fully happy
   with; the most important one was the speed of some operations; another
   annoyance was the fact that I got rather frequent cache-corruptions when
   using newer emacs versions.
&lt;/p&gt;
&lt;p&gt;   
   So, what was I to do? Well, a few years back, I had written an e-mail
   indexer/searcher, called &lt;a href="http://www.djcbsoftware.nl/code/mu"&gt;mu&lt;/a&gt;. It takes the messages in a maildir-folder, and
   allows you to query them. I wondered if I could use &lt;code&gt;mu&lt;/code&gt; as the backend for
   an emacs-based e-mail client. So, I fired up emacs, started writing some code
   and some later I had a first version of&amp;hellip; &lt;code&gt;mu4e&lt;/code&gt;.
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1-2" class="outline-3"&gt;
&lt;h3 id="sec-1-2"&gt;how does it work?&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1-2"&gt;


&lt;p&gt;
   &lt;code&gt;mu4e&lt;/code&gt; is an emacs front-end for &lt;code&gt;mu&lt;/code&gt;; when you start it, &lt;code&gt;mu4e&lt;/code&gt; connects to a
   &lt;code&gt;mu&lt;/code&gt; server process (started on-demand). It accepts simple commands, and
   responds with emacs &lt;i&gt;s-expressions&lt;/i&gt;, in asynchronous fashion. In practice, all
   the heavy work is done in this server process, and emacs shows the results
   when it is ready (usually almost instantly). Emacs does not need to &lt;i&gt;wait&lt;/i&gt; for
   the backend, and things stay snappy, even with tens of thousands (or more)
   e-mail messages. The only operation that may still require some waiting is
   &lt;i&gt;sending mail&lt;/i&gt;, since that uses the emacs built-in &lt;code&gt;smtpmail&lt;/code&gt;, which blocks
   during its operation.
&lt;/p&gt;
&lt;p&gt;
   &lt;code&gt;mu&lt;/code&gt; expects your e-mail messages to be stored in a &lt;a href="http://en.wikipedia.org/wiki/Maildir"&gt;maildir&lt;/a&gt; (a
   one-file-per-message system); you can get these mails there through tools
   like &lt;a href="http://offlineimap.org/"&gt;offlineimap&lt;/a&gt; or &lt;a href="http://www.fetchmail.info/"&gt;fetchmail&lt;/a&gt;. &lt;code&gt;mu&lt;/code&gt; periodically indexes the messages, and
   stores the results in a &lt;a href="http://xapian.org/"&gt;Xapian&lt;/a&gt; database. A lot of what &lt;code&gt;mu4e&lt;/code&gt; does is
   querying this database &amp;ndash; so for example, what you see as 'my inbox folder'
   in the &lt;code&gt;mu4e&lt;/code&gt;-frontend, is in fact just the result of a &lt;i&gt;query&lt;/i&gt; of all
   message that happen to live in that folder. You can query for many things –
   message sender, subject, date, words in the body and more.
&lt;/p&gt;
&lt;p&gt;   
   &lt;code&gt;mu4e&lt;/code&gt; does not just query messages; it can also move messages between
   folders, delete them, modify their flags and so on (and afterwards update the
   database). All 'state' is in the file system, and the database is just a quick
   way to get to it; if you delete the database and then re-index, nothing is
   lost, and changes made with other tools (e.g. &lt;code&gt;mutt&lt;/code&gt;) are picked up by &lt;code&gt;mu&lt;/code&gt; as
   well.
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1-3" class="outline-3"&gt;
&lt;h3 id="sec-1-3"&gt;trying mu4e&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1-3"&gt;


&lt;p&gt;   
   Some Linux distributions ship &lt;code&gt;mu4e&lt;/code&gt;, but not necessarily a very recent
   version; and because &lt;code&gt;mu4e&lt;/code&gt; is developing quickly, you may want to use the
   &lt;a href="http://code.google.com/p/mu0/downloads/list"&gt;latest official release&lt;/a&gt;, or (if you are more adventurous) check out the &lt;a href="https://github.com/djcb/mu"&gt;git repository&lt;/a&gt;. You'll need GNU/Emacs 23 or 24, GLib, GMime &amp;gt;= 2.4 and Xapian.
&lt;/p&gt;
&lt;p&gt;
   After installing &lt;code&gt;mu4e&lt;/code&gt;, you can check the &lt;a href="http://www.djcbsoftware.nl/code/mu/mu4e/index.html"&gt;mu4e manual&lt;/a&gt;, which should be
   fairly complete. In fact, one of the goals of &lt;code&gt;mu4e&lt;/code&gt; is to make it easy to
   set up; for that reason, the documentation includes complete examples of how
   to &lt;a href="http://www.djcbsoftware.nl/code/mu/mu4e/Example-configuration.html#Example-configuration"&gt;set things up&lt;/a&gt;. The &lt;a href="http://www.djcbsoftware.nl/code/mu/mu4e/Getting-started.html#Getting-started"&gt;Getting started&lt;/a&gt; chapter should get you up to speed
   quickly.
&lt;/p&gt;
&lt;p&gt;
   So, give it a try if you're interested; the &lt;code&gt;mu=/=mu4e&lt;/code&gt; project is very open
   to suggestions (and even bugs reports!), so feel free to put them here or
   subscribe to the &lt;a href="https://groups.google.com/forum/?fromgroups#!forum/mu-discuss"&gt;mu mailing list&lt;/a&gt;.
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1-4" class="outline-3"&gt;
&lt;h3 id="sec-1-4"&gt;a small tour&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1-4"&gt;


&lt;p&gt;
   I'll end this with a number of screenshots, to give you a rough idea of how
   things look.
&lt;/p&gt;

&lt;/div&gt;

&lt;div id="outline-container-1-4-1" class="outline-4"&gt;
&lt;h4 id="sec-1-4-1"&gt;The main screen&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-1-4-1"&gt;


&lt;p&gt;
    When you start &lt;code&gt;mu4e&lt;/code&gt; (&lt;code&gt;M-x mu4e&lt;/code&gt;), you're taken to the main screen, which
    list the things you can do. The entries should speak for themselves. Note
    that you can define you're own bookmarks. In general, &lt;code&gt;mu4e&lt;/code&gt; tries to make
    things as easy as possible, and provide auto-completions where possible.
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-irKZO6VAZbU/UDKPojIeGCI/AAAAAAAAAvA/vCValpxOFnE/s1600/mu4emain.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="387" width="400" src="http://1.bp.blogspot.com/-irKZO6VAZbU/UDKPojIeGCI/AAAAAAAAAvA/vCValpxOFnE/s400/mu4emain.png" /&gt;&lt;/a&gt;&lt;/div&gt;



&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1-4-2" class="outline-4"&gt;
&lt;h4 id="sec-1-4-2"&gt;The headers / view split-screen&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-1-4-2"&gt;


&lt;p&gt;
    The results of your queries are shown as a list of headers; if you click one
    of the headers, &lt;code&gt;mu4e&lt;/code&gt; splits the screen horizontally (optionally, you can
    split the screen vertically, or only show the message view). You can
    customize the headers shown, re-order them and so on.
&lt;/p&gt;
&lt;p&gt;    
    The message view supports html message, inline images, and has a mechanism
    to associate user-functions with messages and attachments (such as 'view in
    browser' or 'pipe through command'); see the manual for some examples.
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-bdlADBA62Qw/UDKPzJFOddI/AAAAAAAAAvM/mcIH1Q-x_rk/s1600/mu4eheaders.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="387" width="400" src="http://3.bp.blogspot.com/-bdlADBA62Qw/UDKPzJFOddI/AAAAAAAAAvM/mcIH1Q-x_rk/s400/mu4eheaders.png" /&gt;&lt;/a&gt;&lt;/div&gt;



&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1-4-3" class="outline-4"&gt;
&lt;h4 id="sec-1-4-3"&gt;The message composition view&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-1-4-3"&gt;


&lt;p&gt;
    Obviously, you can reply to messages, forward them, or compose a new
    message. For writing and sending messages, &lt;code&gt;mu4e&lt;/code&gt; reuses emacs' built-in
    &lt;code&gt;message-mode&lt;/code&gt;. There's support for auto-completing addresses (based on the
    e-mails you've sent/received before).
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-g9ApEUZjVM0/UDKP6VmrcZI/AAAAAAAAAvY/EyWCQGioKKo/s1600/mu4ecompose.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="292" width="400" src="http://1.bp.blogspot.com/-g9ApEUZjVM0/UDKP6VmrcZI/AAAAAAAAAvY/EyWCQGioKKo/s400/mu4ecompose.png" /&gt;&lt;/a&gt;&lt;/div&gt;



&lt;/p&gt;
&lt;p&gt;    
    There's even (experimental) support for writing you're messages using
    &lt;code&gt;org-mode&lt;/code&gt;, and then sending them as rich-text (html) messages.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1-5" class="outline-3"&gt;
&lt;h3 id="sec-1-5"&gt;parting thoughts&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1-5"&gt;


&lt;p&gt;
   So, this was a short introduction to &lt;code&gt;mu4e&lt;/code&gt;, barely scratching the surface,
   but hopefully conveying the main ideas. The manual discusses things in much
   more detail, and I'll write more about it in the future.
&lt;/p&gt;
&lt;p&gt;   
   &lt;code&gt;mu4e&lt;/code&gt; is still a young project, but, for what's it worth, I've been using it
   full-time for over six months, and a growing number of people are doing the
   same. So, if you're interested, give it try and let us know you think!
&lt;/p&gt;
&lt;p&gt;  
   Have fun!
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/4834923182031297599/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=4834923182031297599' title='21 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/4834923182031297599'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/4834923182031297599'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2012/08/introducing-mu4e-for-email.html' title='introducing mu4e, an e-mail client for emacs'/><author><name>djcb</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_kGFGcbwevHE/R1Rgjkq0h3I/AAAAAAAAAMg/KLj-i9qWXGg/S220/rupert.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-irKZO6VAZbU/UDKPojIeGCI/AAAAAAAAAvA/vCValpxOFnE/s72-c/mu4emain.png' height='72' width='72'/><thr:total>21</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-4023797284184291697</id><published>2012-08-10T18:03:00.000+03:00</published><updated>2012-08-10T18:03:10.948+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><title type='text'>file management with sunrise-commander</title><content type='html'>&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div class="outline-text-2" id="text-1"&gt;


&lt;p&gt;
  I tend to do a lot of file management from the shell (&lt;code&gt;zsh&lt;/code&gt;, in my case); this
  is very flexible / powerful and so on. But, for some things a bit more
  graphical approach is nicer.
&lt;/p&gt;
&lt;p&gt;
  There are fully graphical file-managers like &lt;i&gt;Nautilus&lt;/i&gt; or &lt;i&gt;Thunar&lt;/i&gt;, but for a
  bit more keyboard-friendly file-management, there are so-called &lt;i&gt;orthodox file   managers&lt;/i&gt; - the archetypical Norton Commander and its descendants, like
  &lt;a href="http://www.midnight-commander.org"&gt;midnight-commander&lt;/a&gt; (mc) and &lt;a href="http://www.nongnu.org/gcmd/"&gt;gnome commander&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
  Not surprisingly, emacs has its own incarnation - it is called the &lt;a href="http://www.emacswiki.org/emacs/Sunrise_Commander"&gt;sunrise commander&lt;/a&gt; and happily it's obtainable through &lt;a href="http://emacs-fu.blogspot.fi/2011/11/package-management-revisited.html"&gt;ELPA&lt;/a&gt;. It's become an important
  of my workflow. When you're used to Midnight Commander, you'll feel right at
  home.
&lt;/p&gt;
&lt;p&gt;
  If you want to use &lt;code&gt;emacs&lt;/code&gt; for &lt;i&gt;yet another&lt;/i&gt; of your computer-based
  activities, give it a try.
&lt;/p&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-7Mue1E8DQlE/UCUiXWepRWI/AAAAAAAAAuo/Dg53j8RZtYE/s1600/Screenshot%2Bfrom%2B2012-08-10%2B17%253A58%253A53.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="235" width="400" src="http://2.bp.blogspot.com/-7Mue1E8DQlE/UCUiXWepRWI/AAAAAAAAAuo/Dg53j8RZtYE/s400/Screenshot%2Bfrom%2B2012-08-10%2B17%253A58%253A53.png" /&gt;&lt;/a&gt;&lt;/div&gt;




&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/4023797284184291697/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=4023797284184291697' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/4023797284184291697'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/4023797284184291697'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2012/08/file-management-with-sunrise-commander.html' title='file management with sunrise-commander'/><author><name>djcb</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_kGFGcbwevHE/R1Rgjkq0h3I/AAAAAAAAAMg/KLj-i9qWXGg/S220/rupert.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-7Mue1E8DQlE/UCUiXWepRWI/AAAAAAAAAuo/Dg53j8RZtYE/s72-c/Screenshot%2Bfrom%2B2012-08-10%2B17%253A58%253A53.png' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-5939839926163380313</id><published>2012-07-09T11:36:00.001+03:00</published><updated>2012-07-14T17:42:44.181+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='updated'/><category scheme='http://www.blogger.com/atom/ns#' term='basic'/><title type='text'>replace-regexp and numbering lines</title><content type='html'>&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div class="outline-text-2" id="text-1"&gt;


&lt;p&gt;
  I saw the &lt;a href="http://emacsworld.blogspot.fi/2012/06/numbering-lines-and-lists-in-emacs.html?utm_source=feedburner&amp;amp;utm_medium=feed&amp;amp;utm_campaign=Feed:+GotEmacs+(Got+Emacs?)"&gt;Got Emacs? posting&lt;/a&gt; showing off the new emacs-24
  &lt;code&gt;rectangle-number-lines&lt;/code&gt; command, to number a bunch of lines in buffer,
  i.e..:
&lt;/p&gt;



&lt;pre class="example"&gt;foo
bar
cuux
&lt;/pre&gt;


&lt;p&gt;
  becomes:
&lt;/p&gt;



&lt;pre class="example"&gt;1 foo
2 bar
3 cuux
&lt;/pre&gt;


&lt;p&gt;
  Very cool! An alternative is to use &lt;code&gt;cua-mode&lt;/code&gt;, mark the column for the
  numbers with &lt;code&gt;cua-set-rectangle-mark&lt;/code&gt; (&lt;code&gt;C-RET&lt;/code&gt;), and then use &lt;code&gt;M-x   cua-sequence-rectangle&lt;/code&gt; (which takes you throught the steps, and has a lot of
  flexibility.
&lt;/p&gt;
&lt;p&gt;
  But let's look at yet another way: using &lt;code&gt;replace-regexp&lt;/code&gt;. If we select (mark)
  the list once more, we can do &lt;code&gt;M-x replace-regexp RET ^ RET \#. RET&lt;/code&gt; Note that
  the &lt;code&gt;#&lt;/code&gt; is a special meta-character that represents &lt;i&gt;the number of   replacements already made&lt;/i&gt;. This has the somewhat clumsy side-effect that your
  list be numbered, starting at 0 rather than 1, so you should add a
  dummy-element at the beginning. Clearly, &lt;code&gt;replace-regexp&lt;/code&gt; is inferior for
  simply adding some line numbers &amp;ndash; however, it has the flexibility to do some
  smarter things.
&lt;/p&gt;
&lt;p&gt;
  Smarter things? Yes! &lt;code&gt;replace-regexp&lt;/code&gt; allows you to use arbitrary
  Lisp-expressions in the replace strings. So, let's suppose that we want to use
  &lt;i&gt;letters&lt;/i&gt; instead of numbers for our lines. Easy &amp;ndash; again, select (mark) your
  lines, &lt;code&gt;M-x replace-regexp RET ^ RET \,(format "%c. " (+ ?a \#)) RET&lt;/code&gt;  and we get:
&lt;/p&gt;



&lt;pre class="example"&gt;a. foo
b. bar
c. cuux
&lt;/pre&gt;


&lt;p&gt;
  Admittedly, not the most world-shattering thing, but it does show the powers
  hidden in something as common as &lt;code&gt;replace-regexp&lt;/code&gt;.
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/5939839926163380313/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=5939839926163380313' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/5939839926163380313'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/5939839926163380313'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2012/07/replace-regexp-and-numbering-lines.html' title='replace-regexp and numbering lines'/><author><name>djcb</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_kGFGcbwevHE/R1Rgjkq0h3I/AAAAAAAAAMg/KLj-i9qWXGg/S220/rupert.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-2369075462762171577</id><published>2012-06-20T21:34:00.001+03:00</published><updated>2012-06-20T21:34:02.650+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><category scheme='http://www.blogger.com/atom/ns#' term='basic'/><title type='text'>who holds this value?</title><content type='html'>&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div class="outline-text-2" id="text-1"&gt;

&lt;p&gt;
  Something from the category of useful things hiding in emacs&amp;hellip; Suppose you
  are looking for the variable that holds a certain value. How to find it?
&lt;/p&gt;
&lt;p&gt;
  Easy: &lt;code&gt;M-x apropos-value&lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;
  So, for example, finding all variables that hold your e-mail address:
&lt;/p&gt;
&lt;p&gt;
  &lt;code&gt;M-x apropos-value RET me@example.com RET&lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;
  and you'll get all the matches in the &lt;code&gt;*Apropos*&lt;/code&gt;-buffer. HT: Stephen
  Eglen. 
&lt;/p&gt;
&lt;p&gt;
  Also check the various other &lt;code&gt;M-x apropos-...&lt;/code&gt; commands, they all help you
  find useful information if you can remember a word. Except for&amp;hellip; &lt;code&gt;M-x   apropos-zippy&lt;/code&gt;&amp;hellip; eh?
&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/2369075462762171577/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=2369075462762171577' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/2369075462762171577'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/2369075462762171577'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2012/06/who-holds-this-value.html' title='who holds this value?'/><author><name>djcb</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_kGFGcbwevHE/R1Rgjkq0h3I/AAAAAAAAAMg/KLj-i9qWXGg/S220/rupert.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-1162171093514663529</id><published>2012-06-06T07:42:00.001+03:00</published><updated>2012-06-06T19:11:08.939+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='org-mode'/><category scheme='http://www.blogger.com/atom/ns#' term='new'/><title type='text'>euro 2012 games in your org-mode agenda</title><content type='html'>&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div class="outline-text-2" id="text-1"&gt;


&lt;p&gt;  
  Things have been rather quiet at emacs-fu - reason for this is that most of my
  emacs hacking time has been spent on &lt;a href="http://www.djcbsoftware.nl/code/mu/"&gt;mu4e&lt;/a&gt;, the emacs e-mail client I
  wrote. It's been shaping up pretty nicely, I should probably write some
  emacs-fu posts about it :)
&lt;/p&gt;
&lt;p&gt;
  Another interesting pastime (esp. in Europe) is football/soccer, in particular
  the Euro2012 games; long-time readers will remember the &lt;a href="http://emacs-fu.blogspot.fi/2010/06/worldcup-games-in-your-org-mode-agenda.html"&gt;schedule for world cup games&lt;/a&gt;; I made a new one for Euro2012: &lt;a href="https://github.com/djcb/org-euro2012"&gt;https://github.com/djcb/org-euro2012&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
  In order to have the games show up in your agenda, make sure the file is in
  your org-agenda-files. If needed, you could add it with something like this in
  your org-mode settings (change the directory path to wherever you have put
  &lt;code&gt;euro2012.org&lt;/code&gt;):
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;(add-to-list 'org-agenda-files &lt;span class="org-string"&gt;"~/org/euro2012.org"&lt;/span&gt;)
&lt;/pre&gt;


&lt;p&gt;
  One small issue with the schedule is that it uses the central-european summer
  time (UTC+2), and there is no automatic way to adjust times for the local time
  zone. As a work-around, Juan Pechiar provided the following function which makes
  it easy to update all org-timestamps in a file:
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;(&lt;span class="org-keyword"&gt;defun&lt;/span&gt; &lt;span class="org-function-name"&gt;update-org-hours&lt;/span&gt; (n)
  &lt;span class="org-doc"&gt;"Change all org-mode timestamps in the current buffer by N hours."&lt;/span&gt;
  (interactive &lt;span class="org-string"&gt;"nAdd hours: "&lt;/span&gt;)
  (&lt;span class="org-keyword"&gt;save-excursion&lt;/span&gt;
    (goto-char (point-min))
    (&lt;span class="org-keyword"&gt;while&lt;/span&gt; (re-search-forward &lt;span class="org-string"&gt;"[[&amp;lt;]"&lt;/span&gt; nil t)
      (&lt;span class="org-keyword"&gt;when&lt;/span&gt; (org-at-timestamp-p t)
        (org-timestamp-change n 'hour)))))
&lt;/pre&gt;


&lt;p&gt;
  Evaluate this function. After that, you can go to the file with the schedule,
  and give an M-x update-org-hours, provide the offset for your timezone, compared to
  UTC+2.
&lt;/p&gt;
&lt;p&gt;
  Let the games begin!
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/1162171093514663529/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=1162171093514663529' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/1162171093514663529'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/1162171093514663529'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2012/06/euro-2012-games-in-your-org-mode-agenda.html' title='euro 2012 games in your org-mode agenda'/><author><name>djcb</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_kGFGcbwevHE/R1Rgjkq0h3I/AAAAAAAAAMg/KLj-i9qWXGg/S220/rupert.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-2807150241133610054</id><published>2012-03-16T18:44:00.001+02:00</published><updated>2012-03-18T19:18:20.043+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><category scheme='http://www.blogger.com/atom/ns#' term='erc'/><title type='text'>social networking with bitlbee and erc</title><content type='html'>&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div class="outline-text-2" id="text-1"&gt;


&lt;p&gt;
  Instant messaging (IM) is one of the great time sinks of our age. Emacs-users,
  social butterflies as we are, of course want to take part in that --
  preferrably from the comfort of our own environment.
&lt;/p&gt;
&lt;p&gt;
  There are various ways to use services like &lt;i&gt;MS Live Messenger&lt;/i&gt;, &lt;i&gt;Facebook   Chat&lt;/i&gt;, &lt;i&gt;GTalk&lt;/i&gt;, &lt;i&gt;Yahoo&lt;/i&gt; etc. from within emacs &amp;ndash; the one I use is called
  &lt;a href="http://www.bitlbee.org/"&gt;BitlBee&lt;/a&gt;. BitlBee is a program that presents all the various forms of IM as
  IRC-channels. In other words, while BitlBee knows all the details about
  communicating with these networks, all &lt;b&gt;you&lt;/b&gt; need is an IRC-client to connect
  to BitlBee. This IRC-client does not &lt;i&gt;have&lt;/i&gt; to be Emacs-based - any client can
  be used - but I am using &lt;a href="http://emacs-fu.blogspot.com/search/label/erc"&gt;ERC&lt;/a&gt;. Note, the below assumes you are somewhat
  familiar with it.
&lt;/p&gt;
&lt;p&gt;
  So, let's see how we can set up BitlBee on our system; there are public
  BitlBee-servers available online, but in the case of IM, I wouldn't
  necessarily want to trust them with my account data&amp;hellip; so I'm using my own.
&lt;/p&gt;

&lt;/div&gt;

&lt;div id="outline-container-1-1" class="outline-3"&gt;
&lt;h3 id="sec-1-1"&gt;Setting up Bitlbee&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1-1"&gt;


&lt;p&gt;
   So, how can we set this up? First, install BitlBee &amp;ndash; many distributions have
   ready-made packages, otherwise you can &lt;a href="http://www.bitlbee.org/main.php/download.html"&gt;build from source&lt;/a&gt;. In the examples
   below, I am assuming you are using &lt;b&gt;Bitlbee version 3&lt;/b&gt; or higher; if you use
   a different version, the details will vary a bit.
&lt;/p&gt;
&lt;p&gt;
   You can either run Bitlbee as a system-wide daemon, or just use it on your
   own. I am doing the former (for the latter, &lt;a href="http://www.emacswiki.org/emacs/bitlbee.el"&gt;bitlbee.el&lt;/a&gt; is useful).
&lt;/p&gt;
&lt;p&gt;
   To connect ERC to the Bitlbee daemon, you can use something like the
   following:
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;(&lt;span class="org-keyword"&gt;defun&lt;/span&gt; &lt;span class="org-function-name"&gt;i-wanna-be-social&lt;/span&gt; ()
  &lt;span class="org-doc"&gt;"Connect to IM networks using bitlbee."&lt;/span&gt;
  (interactive)
  (erc &lt;span class="org-builtin"&gt;:server&lt;/span&gt; &lt;span class="org-string"&gt;"localhost"&lt;/span&gt; &lt;span class="org-builtin"&gt;:port&lt;/span&gt; 6667 &lt;span class="org-builtin"&gt;:nick&lt;/span&gt; &lt;span class="org-string"&gt;"user"&lt;/span&gt;))
&lt;/pre&gt;


&lt;p&gt;
I'm sure you can come up with a better nick than &lt;code&gt;user&lt;/code&gt;&amp;hellip; Anyhow, with this
function in your &lt;code&gt;~/.emacs&lt;/code&gt;, we can connect to bitlbee with:
&lt;/p&gt;



&lt;pre class="example"&gt;M-x i-wanna-be-social RET
&lt;/pre&gt;


&lt;p&gt;
  This should connect us to BitlBee; when all goes well, this will look
  something like this:
&lt;/p&gt;



&lt;pre class="example"&gt;*** You have joined channel &amp;amp;bitlbee
*** mindcrime has changed mode for &amp;amp;bitlbee to +t
*** Users on &amp;amp;bitlbee: @user @root
*** Topic for &amp;amp;bitlbee: Welcome to the control channel. Type help for help
    information.
&amp;lt;root&amp;gt; Welcome to the BitlBee gateway!
&amp;lt;root&amp;gt;
&amp;lt;root&amp;gt; If you've never used BitlBee before, please do read the help
  information using the help command. Lots of FAQs are answered there.
&amp;lt;root&amp;gt; If you already have an account on this server, just use the identify
  command to identify yourself.
&amp;lt;root&amp;gt; The nick is (probably) not registered
*** &amp;amp;bitlbee modes: +t
&amp;lt;ERC&amp;gt;
&lt;/pre&gt;


&lt;p&gt;
  Now, this first time, you will need to &lt;b&gt;register&lt;/b&gt; yourself (this is only
  needed once); use the same nick (&lt;code&gt;user&lt;/code&gt; in the example) that you used before:
&lt;/p&gt;



&lt;pre class="example"&gt;&amp;lt;user&amp;gt; register user secretpassword
&amp;lt;root&amp;gt; Account successfully created
&lt;/pre&gt;


&lt;p&gt;
  We're registered! This means, that bitlbee knows about you, and will save your
  settings.
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1-2" class="outline-3"&gt;
&lt;h3 id="sec-1-2"&gt;Re-entering bitlbee&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1-2"&gt;


&lt;p&gt;
   Just to complete the bitlbee-connecting part: the next time you want to use
   &lt;code&gt;bitlbee&lt;/code&gt;, use &lt;code&gt;i-wanna-be-social&lt;/code&gt; as before. However, now you need to
   &lt;code&gt;identify&lt;/code&gt; yourself (rather than &lt;code&gt;register&lt;/code&gt;):
&lt;/p&gt;



&lt;pre class="example"&gt;&amp;lt;user&amp;gt; identify user secretpassword
&amp;lt;root&amp;gt; Password accepted, settings and accounts loaded
&lt;/pre&gt;


&lt;p&gt;
   This can be automated by adding something like the following to your config:
&lt;/p&gt;



&lt;pre class="src src-elisp"&gt;(&lt;span class="org-keyword"&gt;defun&lt;/span&gt; &lt;span class="org-function-name"&gt;bitlbee-identify&lt;/span&gt; ()
  (&lt;span class="org-keyword"&gt;when&lt;/span&gt; (and (string= &lt;span class="org-string"&gt;"localhost"&lt;/span&gt; erc-session-server)
          (string= &lt;span class="org-string"&gt;"&amp;amp;bitlbee"&lt;/span&gt; (buffer-name)))
    (erc-message &lt;span class="org-string"&gt;"PRIVMSG"&lt;/span&gt; (format &lt;span class="org-string"&gt;"%s identify user secretpassword"&lt;/span&gt;
                             (erc-default-target)
                             djcb-bitlbee-password))))

(&lt;span class="org-keyword"&gt;add-hook&lt;/span&gt; 'erc-join-hook 'bitlbee-identify)
&lt;/pre&gt;


&lt;p&gt;
  Modify &lt;code&gt;user&lt;/code&gt; and &lt;code&gt;secretpassword&lt;/code&gt; as desired. If you don't want write out
  your passwords in your emacs config files, take a look at &lt;a href="http://emacs-fu.blogspot.com/2011/02/keeping-your-secrets-secret.html"&gt;keeping your secrets secret&lt;/a&gt;.
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1-3" class="outline-3"&gt;
&lt;h3 id="sec-1-3"&gt;Adding accounts&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1-3"&gt;


&lt;p&gt;
  Now, let's add some IM-accounts (just some examples here; also see &lt;a href="http://wiki.bitlbee.org/quickstart"&gt;Bitlbee Quickstart&lt;/a&gt;. Note, add any point during this, you can see your accounts with
  the command:
&lt;/p&gt;



&lt;pre class="example"&gt;&amp;lt;user&amp;gt; account list
&lt;/pre&gt;


&lt;p&gt;
  and using the numbers (or the accounts 'tag') you can switch an account &lt;code&gt;on&lt;/code&gt;
  (and &lt;code&gt;off&lt;/code&gt;):
&lt;/p&gt;



&lt;pre class="example"&gt;&amp;lt;user&amp;gt; account 0 on
&lt;/pre&gt;


&lt;p&gt;
  There are many other commands &amp;ndash; use &lt;code&gt;help&lt;/code&gt; command the consult the built-in
  documentation.
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1-4" class="outline-3"&gt;
&lt;h3 id="sec-1-4"&gt;Connecting to IM networks&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1-4"&gt;


&lt;p&gt;
   To connect to IM networks, you have to add the accounts to BitlBee. It will
   save them, so you only need to do that once. Let's do it - in each case,
   replace user and password with whatever you use for those.
&lt;/p&gt;
&lt;p&gt;
   You can see your combined logged-in buddy list using &lt;code&gt;M-x erc-channel-names&lt;/code&gt;
   (or &lt;code&gt;C-c C-n&lt;/code&gt;). Or use the &lt;code&gt;blist&lt;/code&gt; command (see &lt;code&gt;help blist&lt;/code&gt;).
&lt;/p&gt;
&lt;p&gt;
   After adding an account, it's a good idea to issue the &lt;code&gt;save&lt;/code&gt; command, to
   ensure that bitlbee saves it.
&lt;/p&gt;

&lt;/div&gt;

&lt;div id="outline-container-1-4-1" class="outline-4"&gt;
&lt;h4 id="sec-1-4-1"&gt;Jabber&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-1-4-1"&gt;





&lt;pre class="example"&gt;&amp;lt;user&amp;gt; account add jabber foobar@jabber.org mypassword
&amp;lt;root&amp;gt; Account successfully added with tag jabber
&amp;lt;user&amp;gt; account jabber on
&amp;lt;root&amp;gt; jabber - Logging in: Connecting
&amp;lt;root&amp;gt; jabber - Logging in: Connected to server, logging in
&amp;lt;root&amp;gt; jabber - Logging in: Converting stream to TLS
&amp;lt;root&amp;gt; jabber - Logging in: Connected to server, logging in
&amp;lt;root&amp;gt; jabber - Logging in: Authentication finished
&amp;lt;root&amp;gt; jabber - Logging in: Authenticated, requesting buddy list
&amp;lt;root&amp;gt; jabber - Logging in: Logged in
&lt;/pre&gt;


&lt;p&gt;
    (and of course, you can use other servers beside &lt;code&gt;jabber.org&lt;/code&gt;)
&lt;/p&gt;

&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1-4-2" class="outline-4"&gt;
&lt;h4 id="sec-1-4-2"&gt;GoogleTalk&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-1-4-2"&gt;


&lt;p&gt;
    GoogleTalk (&lt;code&gt;gtalk&lt;/code&gt;) is implemented using XMPP (jabber), and it's
    recommended to use &lt;code&gt;oauth&lt;/code&gt; for authentication. Note, the &lt;code&gt;foobar&lt;/code&gt; below is
    just a placeholder (for a password); bitlbee wants us to put &lt;i&gt;something&lt;/i&gt;
    there, but since we'll be using &lt;code&gt;oauth&lt;/code&gt;, it's not actually used.
&lt;/p&gt;



&lt;pre class="example"&gt;&amp;lt;user&amp;gt; account add jabber myaccount@gmail.com foobar
&amp;lt;root&amp;gt; Account successfully added with tag gtalk
&amp;lt;user&amp;gt; account gtalk set oauth on
&amp;lt;root&amp;gt; oauth = `on'
&amp;lt;user&amp;gt; account gtalk set nick_source full_name
&amp;lt;root&amp;gt; nick_source = `full_name'
&amp;lt;user&amp;gt; account gtalk on
&amp;lt;root&amp;gt; gtalk - Logging in: Starting OAuth authentication
&lt;/pre&gt;


&lt;p&gt;
    Now, a second window will open with a URL:
&lt;/p&gt;



&lt;pre class="example"&gt;&amp;lt;jabber_oauth&amp;gt; Open this URL in your browser to authenticate:
https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.\
com/auth/googletalk&amp;amp;response_type=code&amp;amp;redirect_uri=urn:ietf:wg:oauth:2.0:oob&amp;amp;client_i\
d=78312399893489.apps.googleusercontent.com

&amp;lt;jabber_oauth&amp;gt; Respond to this message with the returned authorization
token.
&lt;/pre&gt;


&lt;p&gt;
    Follow this URL in your browser, and it will take you to some Google page
    for authentication. When that is completed, you will receive some string
    cookie, which you paste back into the newly opened window.
&lt;/p&gt;



&lt;pre class="example"&gt;&amp;lt;user&amp;gt; 4/sIns904fdlkP5nudjCF4mBHF7Go_-E0g8
*** jabber_oauth is AWAY: Offline
&lt;/pre&gt;


&lt;p&gt;
    Et voilà! We're connected to Gtalk (don't worry about the &lt;code&gt;Offline&lt;/code&gt;-warning).
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1-4-3" class="outline-4"&gt;
&lt;h4 id="sec-1-4-3"&gt;Facebook&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-1-4-3"&gt;


&lt;p&gt;
    Apart from being a social website, Facebook can also be used for IM. You can
    do this through the website, or you can use its jabber interface. It works
    very similar to &lt;code&gt;gtalk&lt;/code&gt;; only important thing is that you get yourself a
    &lt;a href="https://www.facebook.com/help/search/?q=username"&gt;Facebook username&lt;/a&gt;:
&lt;/p&gt;



&lt;pre class="example"&gt;&amp;lt;user&amp;gt; account add jabber myusername0@chat.facebook.com
&amp;lt;root&amp;gt; Account successfully added with tag fb
&amp;lt;root&amp;gt; You can now use the /OPER command to enter the password
&amp;lt;root&amp;gt; Alternatively, enable OAuth if the account supports it: account
  fb set oauth on
&amp;lt;user&amp;gt; account fb set oauth on
&amp;lt;root&amp;gt; oauth = `on'
&amp;lt;user&amp;gt; account gtalk set nick_source full_name
&amp;lt;root&amp;gt; nick_source = `full_name'
&amp;lt;user&amp;gt; account fb on
&amp;lt;root&amp;gt; fb - Logging in: Starting OAuth authentication
&lt;/pre&gt;


&lt;p&gt;
    Then, go through the &lt;code&gt;oath&lt;/code&gt;-authentication steps (see the discussion about
    adding Gtalk accounts above).
&lt;/p&gt;
&lt;p&gt;
    Once authenticated, you'll get something like this:
&lt;/p&gt;



&lt;pre class="example"&gt;&amp;lt;root&amp;gt; fb - Logging in: Requesting OAuth access token
&amp;lt;root&amp;gt; fb - Logging in: Connecting
&amp;lt;root&amp;gt; fb - Logging in: Connected to server, logging in
&amp;lt;root&amp;gt; fb - Logging in: Converting stream to TLS
&amp;lt;root&amp;gt; fb - Logging in: Connected to server, logging in
&amp;lt;root&amp;gt; fb - Logging in: Authentication finished
&amp;lt;root&amp;gt; fb - Logging in: Server claims your JID is
  `-748234518@chat.facebook.com' instead of
  `myusername0@chat.facebook.com'. This mismatch may cause problems with
  groupchats and possibly other things.
&amp;lt;root&amp;gt; fb - Logging in: Authenticated, requesting buddy list
&amp;lt;root&amp;gt; fb - Logging in: Logged in
&lt;/pre&gt;


&lt;p&gt;
    It's to now act upon the warning, so, we log out, change the user name and
    long back in:
&lt;/p&gt;



&lt;pre class="example"&gt;&amp;lt;user&amp;gt; account fb off
&amp;lt;root&amp;gt; fb - Signing off..
&amp;lt;user&amp;gt; account fb set username -748234518@chat.facebook.com
&amp;lt;root&amp;gt; username = `-748234518@chat.facebook.com'
&amp;lt;user&amp;gt; account fb on
&lt;/pre&gt;



&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1-4-4" class="outline-4"&gt;
&lt;h4 id="sec-1-4-4"&gt;MSN / Live Messenger&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-1-4-4"&gt;


&lt;p&gt;
    MSN uses its own protocol (although apparently they're also supporting XMPP
    ("jabber") now). Suppose you have an account there, user
    &lt;code&gt;partygirl89@hotmail.com&lt;/code&gt; with password &lt;code&gt;iamcute&lt;/code&gt;:
&lt;/p&gt;



&lt;pre class="example"&gt;&amp;lt;user&amp;gt; account add msn partygirl89@hotmail.com iamcute
&amp;lt;root&amp;gt; Account successfully added
&amp;lt;user&amp;gt; account msn on
&amp;lt;root&amp;gt; msn - Logging in: Connecting
&amp;lt;root&amp;gt; msn - Logging in: Connected to server, waiting for reply
&amp;lt;root&amp;gt; msn - Logging in: Transferring to other server
&amp;lt;root&amp;gt; msn - Logging in: Connected to server, waiting for reply
&amp;lt;root&amp;gt; msn - Logging in: Authenticated, getting buddy list
&amp;lt;root&amp;gt; msn - Login error: Error reported by MSN server: Invalid
       (non-existent) handle                                      [12:17]
&amp;lt;root&amp;gt; msn - Logging in: Logged in
&lt;/pre&gt;


&lt;p&gt;
    The 'Error reported' does not seem to matter.
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1-4-5" class="outline-4"&gt;
&lt;h4 id="sec-1-4-5"&gt;Other accounts&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-1-4-5"&gt;


&lt;p&gt;
    It's similarly easy to setup &lt;a href="http://wiki.bitlbee.org/HowtoTwitter"&gt;Twitter-accounts&lt;/a&gt; and &lt;a href="http://wiki.bitlbee.org/HowtoIdentica"&gt;Identi.ca-accounts&lt;/a&gt;; I've
    stopped using those though, as it turned out to be a little too easy for
    some typing in the wrong window to end op as a tweet&amp;hellip; The risk is less
    with &lt;a href="http://www.emacswiki.org/emacs/TwitteringMode"&gt;twittering-mode&lt;/a&gt; and &lt;a href="http://www.emacswiki.org/emacs/Identica-mode"&gt;identica-mode&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
    For ICQ/Yahoo/AIM see below &amp;ndash; replace the username/password with your
    own.
&lt;/p&gt;
&lt;ul&gt;
&lt;li id="sec-1-4-5-1"&gt;ICQ&lt;br/&gt;



&lt;pre class="example"&gt;&amp;lt;user&amp;gt; account add oscar ICQ-ID PASSWORD login.icq.com
&amp;lt;root&amp;gt; ...
&lt;/pre&gt;


&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li id="sec-1-4-5-2"&gt;AIM&lt;br/&gt;



&lt;pre class="example"&gt;&amp;lt;user&amp;gt; account add oscar AIM-NICK PASSWORD login.aol.oscar.com
&amp;lt;root&amp;gt; ...
&lt;/pre&gt;


&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li id="sec-1-4-5-3"&gt;Yahoo!&lt;br/&gt;



&lt;pre class="example"&gt;&amp;lt;user&amp;gt; account add yahoo YAHOO-NICK PASSWORD
&amp;lt;root&amp;gt; ...
&lt;/pre&gt;


&lt;p&gt;
     And I'm not even talking about combining bitlbee and Skype &amp;ndash; yes, that is
     possible, too.
&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1-5" class="outline-3"&gt;
&lt;h3 id="sec-1-5"&gt;Chatting&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1-5"&gt;


&lt;p&gt;
   Now, chatting is easy, following the normal ERC conventions (and
   settings). When people talk to you, a window opens (or a frame &amp;ndash; see
   &lt;code&gt;erc-auto-query&lt;/code&gt;. And you can initiate conversations with people by using
   &lt;code&gt;/msg nick&lt;/code&gt;, with &lt;code&gt;nick&lt;/code&gt; of course being the nickname of the person you want
   to talk to.
&lt;/p&gt;
&lt;p&gt;
   ERC/Bitlbee also work together nicely with &lt;a href="http://emacs-fu.blogspot.com/2011/12/sauron-keeping-eye-on-whats-going-on.html"&gt;Sauron&lt;/a&gt;, the emacs event tracker.
&lt;/p&gt;
&lt;p&gt;
   Have fun! I have only scratched the surface here - you now have the full
   arsenal of Elisp and &lt;a href="http://emacs-fu.blogspot.com/2009/06/erc-emacs-irc-client.html"&gt;ERC power&lt;/a&gt; available for your chatting.
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/2807150241133610054/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=2807150241133610054' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/2807150241133610054'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/2807150241133610054'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2012/03/social-networking-with-bitlbee-and-erc.html' title='social networking with bitlbee and erc'/><author><name>djcb</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_kGFGcbwevHE/R1Rgjkq0h3I/AAAAAAAAAMg/KLj-i9qWXGg/S220/rupert.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-7985345679286525524</id><published>2012-02-10T21:57:00.003+02:00</published><updated>2012-02-11T09:16:33.349+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><title type='text'>special characters</title><content type='html'>&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;h2 id="sec-1"&gt;Special characters&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-1"&gt;


&lt;p&gt;
  Living in a post-&lt;a href="http://en.wikipedia.org/wiki/Ascii"&gt;ASCII&lt;/a&gt; world offers great opportunities, but brings some
  problems, too. After all, it's nice to be able to write &lt;i&gt;Ångström&lt;/i&gt; or
  &lt;i&gt;Καλημέρα&lt;/i&gt; or &lt;i&gt;☺☎☯&lt;/i&gt;, but it's not necessarily easy to enter those
  characters.
&lt;/p&gt;

&lt;/div&gt;

&lt;div id="outline-container-1-1" class="outline-3"&gt;
&lt;h3 id="sec-1-1"&gt;input methods&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1-1"&gt;


&lt;p&gt;
  So - what to do? First, you can set the input-method, as &lt;a href="http://www.gnu.org/software/emacs/manual/html_node/emacs/Input-Methods.html"&gt;explained in the emacs manual&lt;/a&gt;. This is the best solution if you're writing a non-Latin
  language &amp;ndash; Russian, Thai, Japanese, &amp;hellip;
&lt;/p&gt;
&lt;p&gt;
  If you only occasionally need some accented character, input methods like
  &lt;code&gt;latin-postfix&lt;/code&gt; (e" -&amp;gt; ë), &lt;code&gt;latin-prefix&lt;/code&gt; ("e -&amp;gt; ë) or &lt;code&gt;TeX&lt;/code&gt; (\"e -&amp;gt; ë) are
  useful. They also tend to annoy me a bit, as they often assume I need an
  accented character, when all I want is to put a word in quotation marks&amp;hellip;
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1-2" class="outline-3"&gt;
&lt;h3 id="sec-1-2"&gt;compose key&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1-2"&gt;


&lt;p&gt;
  Another method is to use a special compose key; for example, under Gnome 3
  it's in the the &lt;i&gt;Region and Language&lt;/i&gt; applet, under &lt;code&gt;Options...&lt;/code&gt;, in Gnome 2
  it's in the &lt;i&gt;Keyboard&lt;/i&gt; applet in &lt;i&gt;Layouts/Options&amp;hellip;&lt;/i&gt;. This works for all
  programs, not just emacs (see &lt;a href="https://help.ubuntu.com/community/ComposeKey"&gt;this Ubuntu help page&lt;/a&gt; for some details). I've
  set my Compose-key to Right-Alt, so &lt;code&gt;Right-Alt&lt;/code&gt; "e -&amp;gt; ë.
&lt;/p&gt;
&lt;p&gt;
  Using the compose key works pretty well for me; setting the input method may
  be more convenient when you need to write &lt;i&gt;a lot&lt;/i&gt; of accented characters.    
&lt;/p&gt;
&lt;p&gt;    
  Now, his may be good and well for the accented characters and other variants    
  of Latin characters, such as the German Ess-Zet ligature "ß" (note, you can    
  get that character with &lt;code&gt;latin-prefix&lt;/code&gt; "s -&amp;gt; ß, &lt;code&gt;latin-postfix&lt;/code&gt; s" -&amp;gt; ß or    
  &lt;code&gt;&amp;lt;compose-key&amp;gt;&lt;/code&gt; ss -&amp;gt; ß). But what about Greek characters? Mathematical
  symbols? Smileys?
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1-3" class="outline-3"&gt;
&lt;h3 id="sec-1-3"&gt;ucs-insert&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1-3"&gt;


&lt;p&gt;
  One way to add characters like &lt;i&gt;α&lt;/i&gt;, &lt;i&gt;∞&lt;/i&gt; or &lt;i&gt;☺&lt;/i&gt; is to use &lt;code&gt;ucs-insert&lt;/code&gt;, by
  default bound to &lt;code&gt;C-x 8 RET&lt;/code&gt;. If you know the official Unicode name for a
  character, you can find it there; note that there's auto-completion and you
  can use &lt;code&gt;*&lt;/code&gt; wild-cards. For the mentioned characters, that would be &lt;code&gt;GREEK   SMALL LETTER ALPHA&lt;/code&gt;, &lt;code&gt;INFINITY&lt;/code&gt; and &lt;code&gt;WHITE SMILING FACE&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
  You can also use the Unicode code points; so &lt;code&gt;C-x 8 RET 03b1 RET&lt;/code&gt; will insert
  &lt;code&gt;α&lt;/code&gt; as well, since its code point is &lt;code&gt;U+03B1&lt;/code&gt;. In case you don't know the code
  points of Unicode characters, a tool like the &lt;i&gt;Character Map&lt;/i&gt; (&lt;code&gt;gucharmap&lt;/code&gt;) in
  Gnome may be useful.
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1-4" class="outline-3"&gt;
&lt;h3 id="sec-1-4"&gt;abbrev&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1-4"&gt;


&lt;p&gt;
   Since &lt;code&gt;ucs-insert&lt;/code&gt; may not be convenient in all cases, you may want to add
   shortcuts for oft-used special characters to you &lt;i&gt;abbrev table&lt;/i&gt;. See the
   entry on &lt;a href="http://www.gnu.org/software/emacs/manual/html_node/elisp/Abbrevs.html#Abbrevs"&gt;Abbrevs&lt;/a&gt; in the emacs manual. I usually edit the entries by hand with
   &lt;code&gt;M-x edit-abbrevs&lt;/code&gt;, and I have entries like:
&lt;/p&gt;



&lt;pre class="example"&gt;(text-mode-abbrev-table)
"Delta0"       0    "Δ"
"^2"           0    "²"
"^3"           0    "³"
"almost0"      0    "≈"
"alpha0"       0    "α"
"any0"         0    "∀"
"beta0"        0    "β"
"c0"           0    "©"
"deg0"         0    "℃"
"delta0"       0    "δ"
"elm0"         0    "∈"
"epsilon0"     0    "ε"
"eta0"         0    "η"
"heart0"       0    "♥"
"inf0"         0    "∞"
"int0"         0    "∫"
"notis0"       0    "≠"
&lt;/pre&gt;


&lt;p&gt;
   Now, &lt;code&gt;alpha0&lt;/code&gt; will be auto-replaced with &lt;i&gt;α&lt;/i&gt;. I'm using the &lt;code&gt;0&lt;/code&gt; suffix for
   most entries so I can easily remember them, without making it hard to use
   &lt;code&gt;alpha&lt;/code&gt; as a normal word. Note, &lt;code&gt;abbrevs&lt;/code&gt; are a bit picky when it comes to
   the characters in the shortcut &amp;ndash; for example, setting &lt;code&gt;!=&lt;/code&gt; -&amp;gt; &lt;code&gt;≠&lt;/code&gt; won't
   work.
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1-5" class="outline-3"&gt;
&lt;h3 id="sec-1-5"&gt;inheriting abbrevs from other modes&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1-5"&gt;


&lt;p&gt;
   If you have set up a nice set of abbreviations for &lt;code&gt;text-mode&lt;/code&gt;, you may want
   to use them in other modes as well; you can accomplish this by including the
   &lt;code&gt;text-mode&lt;/code&gt; abbreviations into the table for the current one, for example in
   your ERC setup: 
&lt;/p&gt;



&lt;pre class="src src-elisp"&gt;&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;inherit abbrevs from text-mode&lt;/span&gt;
(abbrev-table-put erc-mode-abbrev-table &lt;span class="org-builtin"&gt;:parents&lt;/span&gt; (list text-mode-abbrev-table))
&lt;/pre&gt;




&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/7985345679286525524/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=7985345679286525524' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/7985345679286525524'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/7985345679286525524'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2012/02/special-characters.html' title='special characters'/><author><name>djcb</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_kGFGcbwevHE/R1Rgjkq0h3I/AAAAAAAAAMg/KLj-i9qWXGg/S220/rupert.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-5784078687169335944</id><published>2012-02-01T20:24:00.000+02:00</published><updated>2012-02-01T20:24:56.869+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><category scheme='http://www.blogger.com/atom/ns#' term='email'/><title type='text'>update</title><content type='html'>&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div class="outline-text-2" id="text-1"&gt;

&lt;p&gt;
  Regular emacs-fu programming will resume shortly, but for now I'll provide a
  brief update on some of my projects.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Recently, I discussed &lt;a href="http://emacs-fu.blogspot.com/2011/12/sauron-keeping-eye-on-whats-going-on.html"&gt;sauron&lt;/a&gt;, and event-tracking tool for emacs. I added
    some new features, fixed some bugs, and got some contributions (yay!)

&lt;ul&gt;
&lt;li&gt;tweak/improve priority handling
&lt;/li&gt;
&lt;li&gt;add a backend for the emacs-24 notification system
&lt;/li&gt;
&lt;li&gt;add settings to make the sauron frame 'sticky', and to hide the mode-line
&lt;/li&gt;
&lt;li&gt;enable dbus-message source outside your session; useful for cron/procmail
      etc.
&lt;/li&gt;
&lt;li&gt;display events in a tabular fashion
&lt;/li&gt;
&lt;li&gt;add support for John Wiegley's &lt;code&gt;event.el&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;much improved documentation
&lt;/li&gt;
&lt;li&gt;other things&amp;hellip;

&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;    Sauron version 0.2 is available through &lt;a href="http://marmalade-repo.org/"&gt;Marmalade&lt;/a&gt; (see &lt;a href="http://emacs-fu.blogspot.com/2011/11/package-management-revisited.html"&gt;Package Management Revisited&lt;/a&gt;)
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;I released version 0.9.8 of &lt;a href="http://www.djcbsoftware.nl/code/mu"&gt;mu&lt;/a&gt; (e-mail searcher/indexer, previously
    discussed in &lt;a href="http://emacs-fu.blogspot.com/2011/03/searching-e-mails-with-wanderlust-and.html"&gt;Searching e-mails with Wanderlust and mu&lt;/a&gt;). Now, for emacs-users
    I've added &lt;a href="http://www.djcbsoftware.nl/code/mu/mu4e.html"&gt;mu4e&lt;/a&gt; (&lt;a href="http://www.djcbsoftware.nl/code/mu/mu4e/index.html"&gt;manual&lt;/a&gt;), a new &amp;amp; experimental e-mail client. It won't be
    big and professional like &lt;code&gt;gnus&lt;/code&gt;, but it's fun to hack on, and I've been
    using it for a few months.
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/5784078687169335944/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=5784078687169335944' title='14 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/5784078687169335944'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/5784078687169335944'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2012/02/regular-emacs-fu-programming-will.html' title='update'/><author><name>djcb</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_kGFGcbwevHE/R1Rgjkq0h3I/AAAAAAAAAMg/KLj-i9qWXGg/S220/rupert.jpg'/></author><thr:total>14</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-6841811278979936496</id><published>2011-12-22T00:01:00.000+02:00</published><updated>2011-12-22T08:19:22.611+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='org-mode'/><category scheme='http://www.blogger.com/atom/ns#' term='new'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='emacs24'/><category scheme='http://www.blogger.com/atom/ns#' term='emacs23'/><category scheme='http://www.blogger.com/atom/ns#' term='erc'/><title type='text'>sauron: keeping an eye on what's going on</title><content type='html'>&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div class="outline-text-2" id="text-1"&gt;


&lt;p&gt;
  I'm a fairly busy person, and need to keep track of a lot of things. That
  includes following a bunch of internal IRC channels, attending meetings, meeting
  deadlines and so on. But I don't want to stare at my &lt;code&gt;org-mode&lt;/code&gt; calendar, or
  flip through &lt;a href="http://emacs-fu.blogspot.com/2009/06/erc-emacs-irc-client.html"&gt;ERC&lt;/a&gt; buffers all the time. 
&lt;/p&gt;
&lt;p&gt;
  Instead, I'd like to have one little emacs frame (window) that gathers these
  ('events'), and transfers me to wherever the event came from when I click it - some
  IRC-channel in ERC, my org-calendar etc.  and other inputs. Note, using
  &lt;a href="http://www.bitlbee.org"&gt;Bitlbee&lt;/a&gt;, you can include Facebook-contacts, GoogleTalk-buddies and
  Twitter-tweets, &amp;hellip; in ERC - so, you can track just about &lt;i&gt;anything&lt;/i&gt;.
&lt;/p&gt;
&lt;p&gt;
  In addition, with so many inputs, I'd also like the possibility to filter out unwanted
  events, and generate various light/sound effects and fireworks, proportional
  to the priority of the event.
&lt;/p&gt;
&lt;p&gt;
  For all this, I wrote a little emacs-tool called &lt;b&gt;Sauron&lt;/b&gt; that does just
  that. &lt;code&gt;M-x sauron-start&lt;/code&gt; pops up a frame that receives events, and &lt;code&gt;M-x sauron-stop&lt;/code&gt; hides it and stops listening. It works with &lt;code&gt;ERC&lt;/code&gt;, &lt;code&gt;org&lt;/code&gt;, and
  listens for &lt;a href="http://emacs-fu.blogspot.com/2009/01/using-d-bus-example.html"&gt;D-Bus messages&lt;/a&gt;; so it's pretty easy to get events from all over
  the place.
&lt;/p&gt;
&lt;p&gt;
  It's a bit of a balancing act to get all the important information while not
  being swamped in noise, but Sauron allows you to fine-tune it to whatever
  works the best for you. I've tried to have sane defaults though, so things
  should mostly work without too much configuration - but if you need the power,
  it's there.  I also added some convenience functions to make it easy to get
  sounds and other special effects.
&lt;/p&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-0iI3p7Hpbjc/TvJWGjx0AJI/AAAAAAAAAnk/Bd3SrTvLvbo/s1600/sauron.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="108" width="400" src="http://3.bp.blogspot.com/-0iI3p7Hpbjc/TvJWGjx0AJI/AAAAAAAAAnk/Bd3SrTvLvbo/s400/sauron.png" /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;
  So - it's brand new, it is of &lt;i&gt;seems-to-work-for-me&lt;/i&gt;-quality, and I'd like to
  invite others to try it out, hack it, give feedback, add new back-ends and so
  on &amp;ndash; what better Christmas present to ask for!
&lt;/p&gt;
&lt;p&gt;
  There's &lt;a href="https://github.com/djcb/sauron#readme"&gt;documentation, examples&lt;/a&gt; etc. to be found in &lt;a href="https://github.com/djcb/sauron"&gt;Sauron's github repository&lt;/a&gt;.
&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/6841811278979936496/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=6841811278979936496' title='16 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/6841811278979936496'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/6841811278979936496'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2011/12/sauron-keeping-eye-on-whats-going-on.html' title='sauron: keeping an eye on what&apos;s going on'/><author><name>djcb</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_kGFGcbwevHE/R1Rgjkq0h3I/AAAAAAAAAMg/KLj-i9qWXGg/S220/rupert.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-0iI3p7Hpbjc/TvJWGjx0AJI/AAAAAAAAAnk/Bd3SrTvLvbo/s72-c/sauron.png' height='72' width='72'/><thr:total>16</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-1094708036403372928</id><published>2011-12-10T14:33:00.001+02:00</published><updated>2011-12-12T08:01:06.892+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><title type='text'>system administration with emacs</title><content type='html'>&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div class="outline-text-2" id="text-1"&gt;


&lt;p&gt;
  When performing system administration tasks, one often needs to edit files
  owned by &lt;code&gt;root&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
  For both security and safety reasons, it's a good idea to do as &lt;i&gt;little&lt;/i&gt; as
  possible as root (or with root privileges). For that reason, you probably
  don't want to run Emacs as 'root', because it's simply &lt;i&gt;too powerful&lt;/i&gt;. I often
  see people use &lt;code&gt;vi&lt;/code&gt; (usually, &lt;code&gt;vim&lt;/code&gt;) instead &amp;ndash; but since it allows you to do
  just about anything as well (like running shell commands), that's not much of
  an improvement.
&lt;/p&gt;
&lt;p&gt;  
  Now, a while back we discussed &lt;a href="http://emacs-fu.blogspot.com/2009/10/editing-files-owned-by-root.html"&gt;editing files owned by root with tramp&lt;/a&gt; &amp;ndash; you
  can use emacs with your normal user-account, and use &lt;code&gt;sudo&lt;/code&gt; to write the
  root-owned file. That makes it much harder to screw things up.
&lt;/p&gt;
&lt;p&gt;
  Another reason people use &lt;code&gt;vi&lt;/code&gt; for little editing jobs is because its startup
  time is significantly shorter than the startup time for a new emacs
  instance. For that, however, we have &lt;a href="http://emacs-fu.blogspot.com/2009/02/emacs-daemon.html"&gt;emacs daemon&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
  Combining &lt;i&gt;tramp&lt;/i&gt; and &lt;i&gt;emacs daemon&lt;/i&gt; and a shell function:
&lt;/p&gt;



&lt;pre class="src src-sh"&gt;&lt;span class="org-comment-delimiter"&gt;# &lt;/span&gt;&lt;span class="org-comment"&gt;edit file with root privs&lt;/span&gt;
&lt;span class="org-keyword"&gt;function&lt;/span&gt; &lt;span class="org-function-name"&gt;E&lt;/span&gt;() {
         emacsclient -c -a emacs &lt;span class="org-string"&gt;"/sudo:root@localhost:$1"&lt;/span&gt;
}               
&lt;/pre&gt;



&lt;p&gt;
  Now, we can very quickly edit any file owned by root using 'E' --
&lt;/p&gt;




&lt;pre class="example"&gt;$ E /etc/hosts
&lt;/pre&gt;



&lt;p&gt;  
  So, if you prefer emacs, there's little reason to use &lt;code&gt;vi&lt;/code&gt;, even for editing
  system files &amp;ndash; although I have to admit that it takes time to evict 'sudo vi
  &amp;lt;system file&amp;gt;' from my muscle memory.
&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;Update&lt;/b&gt; reader &lt;i&gt;Yi Wang&lt;/i&gt; mentions that, in fact, we can make this a bit more
general using &lt;code&gt;sudoedit&lt;/code&gt;; so, instead of using Tramp, we can use:
&lt;/p&gt;



&lt;pre class="src src-sh"&gt;&lt;span class="org-comment-delimiter"&gt;# &lt;/span&gt;&lt;span class="org-comment"&gt;edit file with root privs&lt;/span&gt;
&lt;span class="org-builtin"&gt;alias&lt;/span&gt; &lt;span class="org-variable-name"&gt;E&lt;/span&gt;=&lt;span class="org-string"&gt;"SUDO_EDITOR=\"emacsclient -c -a emacs\" sudoedit"&lt;/span&gt;   
&lt;/pre&gt;




&lt;p&gt;
This works also without absolute paths.
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/1094708036403372928/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=1094708036403372928' title='13 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/1094708036403372928'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/1094708036403372928'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2011/12/system-administration-with-emacs.html' title='system administration with emacs'/><author><name>djcb</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_kGFGcbwevHE/R1Rgjkq0h3I/AAAAAAAAAMg/KLj-i9qWXGg/S220/rupert.jpg'/></author><thr:total>13</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-3400345349577998800</id><published>2011-11-21T22:22:00.001+02:00</published><updated>2011-11-28T09:01:47.827+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='emacs24'/><category scheme='http://www.blogger.com/atom/ns#' term='emacs23'/><title type='text'>package management revisited</title><content type='html'>&lt;div id="outline-container-1" class="outline-2"&gt;&lt;div class="outline-text-2" id="text-1"&gt;&lt;p&gt;&lt;a href="http://emacs-fu.blogspot.com/2009/04/elpa.html"&gt;Ages ago&lt;/a&gt; we discussed &lt;a href="http://tromey.com/elpa/"&gt;ELPA&lt;/a&gt;, the emacs packaging system. It allows you to&lt;br /&gt;
browse through an online repository of emacs packages and install, uninstall&lt;br /&gt;
and upgrade them, all from within the emacs comfort zone (menu:&lt;br /&gt;
&lt;code&gt;Options/Manage Emacs Packages&lt;/code&gt;).&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;Emacs 24.1 (a &lt;a href="http://article.gmane.org/gmane.emacs.devel/144290"&gt;pretest&lt;/a&gt; is available) will include a version of ELPA --&lt;br /&gt;
&lt;code&gt;package.el&lt;/code&gt;; the version included with emacs 24 supports multiple&lt;br /&gt;
archives. The &lt;i&gt;official&lt;/i&gt; archive is the one provided by GNU, then there is&lt;br /&gt;
the current one for ELPA, but there's now a third one available: &lt;a href="http://marmalade-repo.org/"&gt;Marmalade&lt;/a&gt;.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;Marmelade ('&lt;i&gt;Spreadable Elisp&lt;/i&gt;') offers a very easy way for developers to&lt;br /&gt;
make their packages available to emacs users, and an even easier way for&lt;br /&gt;
users to test out interesting packages.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;To use &lt;i&gt;all&lt;/i&gt; available package repositories (GNU, ELPA and Marmalade), add&lt;br /&gt;
the following snippet to your &lt;code&gt;.emacs&lt;/code&gt;:&lt;br /&gt;
&lt;/p&gt;&lt;pre class="src src-emacs-lisp"&gt;(&lt;span style="color: #8ac6f2; font-weight: bold;"&gt;setq&lt;/span&gt; package-archives '((&lt;span style="color: #95e454;"&gt;"ELPA"&lt;/span&gt; . &lt;span style="color: #95e454;"&gt;"http://tromey.com/elpa/"&lt;/span&gt;) 
                          (&lt;span style="color: #95e454;"&gt;"gnu"&lt;/span&gt; . &lt;span style="color: #95e454;"&gt;"http://elpa.gnu.org/packages/"&lt;/span&gt;)
                          (&lt;span style="color: #95e454;"&gt;"marmalade"&lt;/span&gt; . &lt;span style="color: #95e454;"&gt;"http://marmalade-repo.org/packages/"&lt;/span&gt;))&lt;span style="color: #ccaa8f; background-color: #332323; font-weight: bold;"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;p&gt;This works out-of-the-box for Emacs 24; for Emacs 23, you'll need the newer&lt;br /&gt;
&lt;code&gt;package.el&lt;/code&gt;, which you can get from the &lt;a href="http://bzr.savannah.gnu.org/lh/emacs/trunk/annotate/head:/lisp/emacs-lisp/package.el"&gt;emacs 24 repo&lt;/a&gt; (if necessary, remove&lt;br /&gt;
the old &lt;code&gt;package.el&lt;/code&gt; first).&lt;br /&gt;
&lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-eP7xexj9Agw/Tsqz16Y60lI/AAAAAAAAAmo/4AYCpqLXcgg/s1600/package.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="297" width="320" src="http://2.bp.blogspot.com/-eP7xexj9Agw/Tsqz16Y60lI/AAAAAAAAAmo/4AYCpqLXcgg/s320/package.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;Currently, there are &lt;b&gt;870&lt;/b&gt; packages listed in the three repositories &amp;ndash; a lot of&lt;br /&gt;
toys to play with! In fact, it is already getting quite hard to find what&lt;br /&gt;
you're looking for; a bit more structured way (maybe using categories) would&lt;br /&gt;
be useful. Also, a bit more information than the one-line description would&lt;br /&gt;
be very useful.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;Nevertheless, it's a great addition to emacs, which will make it much easier&lt;br /&gt;
to play with packages &amp;ndash; without even having to read the installation&lt;br /&gt;
instructions.&lt;br /&gt;
&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/3400345349577998800/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=3400345349577998800' title='18 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/3400345349577998800'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/3400345349577998800'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2011/11/package-management-revisited.html' title='package management revisited'/><author><name>djcb</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_kGFGcbwevHE/R1Rgjkq0h3I/AAAAAAAAAMg/KLj-i9qWXGg/S220/rupert.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-eP7xexj9Agw/Tsqz16Y60lI/AAAAAAAAAmo/4AYCpqLXcgg/s72-c/package.png' height='72' width='72'/><thr:total>18</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-1414291109911962066</id><published>2011-09-15T21:49:00.001+03:00</published><updated>2011-09-16T15:56:24.376+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='org-mode'/><category scheme='http://www.blogger.com/atom/ns#' term='new'/><title type='text'>quick note-taking with deft and org-mode</title><content type='html'>&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div class="outline-text-2" id="text-1"&gt;


&lt;p&gt;
  Emacs must be gathering a lot of enthusiasts lately; there's hardly a week
  where I don't discover some new gem. Recently, I discovered &lt;a href="http://jblevins.org/projects/deft/"&gt;deft&lt;/a&gt;. And
  apparently, I wasn't the only one.
&lt;/p&gt;
&lt;p&gt;
  So what is it &lt;code&gt;deft&lt;/code&gt; good for? Well, often I want to jot down some quick thing
  during a meeting or a telephone-call. Of course, I don't want to think about
  file names or anything else distracting me from my task, just get me that note
  already! In addition, at some later time, I want to be able to quickly search
  through the notes I made.
&lt;/p&gt;
&lt;p&gt;
  For MacOS, there's a program called &lt;a href="http://notational.net/"&gt;Notational Velocity&lt;/a&gt; which does this. But
  really - it sounds like a typical task for emacs - wouldn't it be nice to have
  an emacs package that does roughly the same?
&lt;/p&gt;
&lt;p&gt;
  And that is what &lt;code&gt;deft&lt;/code&gt; does - enable you to quickly write notes, and
  retrieving them later. The author has an excellent introduction on his
  website, so my job is very easy :) &lt;code&gt;deft&lt;/code&gt; is not part of &lt;a href="http://orgmode.org/"&gt;org-mode&lt;/a&gt;, but they
  can work together seamlessly. Here's my set-up:
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;&lt;span style="color: #99968b;"&gt;;; &lt;/span&gt;&lt;span style="color: #99968b;"&gt;http://jblevins.org/projects/deft/&lt;/span&gt;
(&lt;span style="color: #8ac6f2; font-weight: bold;"&gt;when&lt;/span&gt; (&lt;span style="color: #8ac6f2; font-weight: bold;"&gt;require&lt;/span&gt; '&lt;span style="color: #e5786d;"&gt;deft&lt;/span&gt; nil 'noerror) 
   (&lt;span style="color: #8ac6f2; font-weight: bold;"&gt;setq&lt;/span&gt;
      deft-extension &lt;span style="color: #95e454;"&gt;"org"&lt;/span&gt;
      deft-directory &lt;span style="color: #95e454;"&gt;"~/Org/deft/"&lt;/span&gt;
      deft-text-mode 'org-mode)
   (global-set-key (kbd &lt;span style="color: #95e454;"&gt;"&amp;lt;f9&amp;gt;"&lt;/span&gt;) 'deft))
&lt;/pre&gt;


&lt;p&gt;
  This blob goes in my &lt;code&gt;.emacs&lt;/code&gt;. Note, the first line ensures that emacs starts
  without errors, even when I run on a system without &lt;code&gt;deft&lt;/code&gt;. Apart from that, I
  make &lt;code&gt;deft&lt;/code&gt; use &lt;code&gt;org&lt;/code&gt; files for note taking, which makes it all very familiar.
&lt;/p&gt;
&lt;p&gt;  
  All notes are saved &lt;code&gt;~/Org/deft&lt;/code&gt; - you can set it to something else of
  course. A Dropbox-folder seems to be a popular choice for synchronizing
  between machines.
&lt;/p&gt;
&lt;p&gt;
  Finally, the last line binds &lt;code&gt;F9&lt;/code&gt; to &lt;code&gt;deft-mode&lt;/code&gt;. So, when I need a quick
  note, I can type &lt;code&gt;F9 C-c C-n&lt;/code&gt; and start writing.
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/1414291109911962066/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=1414291109911962066' title='14 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/1414291109911962066'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/1414291109911962066'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2011/09/quick-note-taking-with-deft-and-org.html' title='quick note-taking with deft and org-mode'/><author><name>djcb</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_kGFGcbwevHE/R1Rgjkq0h3I/AAAAAAAAAMg/KLj-i9qWXGg/S220/rupert.jpg'/></author><thr:total>14</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-2213113953493134138</id><published>2011-09-08T23:22:00.000+03:00</published><updated>2011-09-08T23:22:31.583+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><title type='text'>finding just about anything</title><content type='html'>&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div class="outline-text-2" id="text-1"&gt;

&lt;p&gt;
  Buffer-switching is one of those things I do all the time in Emacs. And it
  should be quick and efficient, or it will break my 'flow'. There are many
  ways to customize the buffer switching experience, and we already discussed
  quite a few of those here: using &lt;a href="http://emacs-fu.blogspot.com/2008/12/cycling-through-your-buffers-with-ctrl.html"&gt;Ctrl-Tab&lt;/a&gt;, &lt;a href="#APPT-Mordor-Scrum-2011-08-30-Tue-11-15-11-30-1w-http-emacs-fu.blogspot.com-2009-02-switching-buffers.html"&gt;iswitchb/ido&lt;/a&gt;, &lt;a href="http://emacs-fu.blogspot.com/2010/02/dealing-with-many-buffers-ibuffer.html"&gt;ibuffer&lt;/a&gt;, the &lt;a href="http://emacs-fu.blogspot.com/2010/07/navigating-through-files-and-buffers.html"&gt;lusty explorer&lt;/a&gt; and others.
&lt;/p&gt;
&lt;p&gt;
  Some of those packages - &lt;code&gt;ido&lt;/code&gt; and &lt;code&gt;lusty-explorer&lt;/code&gt; - do not solely focus on
  buffer-switching - they also let you open files using the same user
  interface. But why stop at files and buffers - wouldn't it be nice if we
  could quickly find just about &lt;i&gt;anything&lt;/i&gt; quickly?
&lt;/p&gt;
&lt;p&gt;
  Indeed that would be nice - and there's a way to do just that - using the
  aptly named &lt;a href="http://www.emacswiki.org/emacs/Anything"&gt;anything&lt;/a&gt; package. I was always a bit put off by this package due
  to the screenshots (see link), but once I got over that, I've become a very
  happy user.
&lt;/p&gt;
&lt;p&gt;
  Anyhow, what can &lt;code&gt;anything&lt;/code&gt; find? I mentioned buffers and files, but it can
  also find bookmarks, recently used files, &lt;i&gt;any&lt;/i&gt; file on your system (using
  &lt;code&gt;locate&lt;/code&gt;), man-pages, info-pages, emacs-function/variables,
  &lt;code&gt;FIXME&lt;/code&gt;-comments, &lt;code&gt;org&lt;/code&gt;-headlines, bbdb-contacts, google-suggests&amp;hellip; and a
  million other things. It can probably find your car keys, too.
&lt;/p&gt;
&lt;p&gt;
  Installation is pretty straightforward, using the git-repository:
&lt;/p&gt;



&lt;pre class="src src-sh"&gt;git clone git://repo.or.cz/anything-config.git
&lt;/pre&gt;


&lt;p&gt;   
   Then, go into the just-cloned directory and execute &lt;code&gt;make&lt;/code&gt;. After that, add
   to your &lt;code&gt;.emacs&lt;/code&gt; (or &lt;code&gt;~/.emacs.d/init.el&lt;/code&gt;):
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;path-to-anything is the path which has the 'anything' we just cloned&lt;/span&gt;
(add-to-list 'load-path &lt;span class="org-string"&gt;"path-to-anything"&lt;/span&gt;)
(&lt;span class="org-keyword"&gt;require&lt;/span&gt; '&lt;span class="org-constant"&gt;anything-config&lt;/span&gt;)
&lt;/pre&gt;


&lt;p&gt;
   This will add a menu with various &lt;code&gt;anything&lt;/code&gt;-commands, and a bunch of
   key-bindings, starting with F5. Play around a bit with it, it's nice. The
   results are shown in a little temporary buffer, and pressing &lt;code&gt;Tab&lt;/code&gt; will let
   you do (search-type dependent) actions on the matches - for example
   &lt;code&gt;ediff&lt;/code&gt; two buffers.
&lt;/p&gt;
&lt;p&gt;
   Of course, the &lt;i&gt;real&lt;/i&gt; fun starts when we super-charge some of the normal
   emacs functions with anything-based ones. Let's look at buffer
   switching. Let's create an &lt;code&gt;anything&lt;/code&gt;-based version, and assign it to &lt;code&gt;C-x    b&lt;/code&gt;, the good-old &lt;code&gt;switch-to-buffer&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
   The thing to consider is that while anything can find just about
   &lt;i&gt;anything&lt;/i&gt;, you (well, I) usually only want to search for a certain set of
   things; when I want to switch to another buffer, I &lt;i&gt;don't&lt;/i&gt; want to match
   man-pages. Luckily, &lt;code&gt;anything&lt;/code&gt; allows for making nifty function which use
   certain subsets of the search sources. So for buffer switching, I have:
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;(global-set-key (kbd &lt;span class="org-string"&gt;"C-x b"&lt;/span&gt;)
  (&lt;span class="org-keyword"&gt;lambda&lt;/span&gt;() (interactive)
    (anything
     &lt;span class="org-builtin"&gt;:prompt&lt;/span&gt; &lt;span class="org-string"&gt;"Switch to: "&lt;/span&gt;
     &lt;span class="org-builtin"&gt;:candidate-number-limit&lt;/span&gt; 10                 &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;up to 10 of each &lt;/span&gt;
     &lt;span class="org-builtin"&gt;:sources&lt;/span&gt;
     '( anything-c-source-buffers               &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;buffers &lt;/span&gt;
        anything-c-source-recentf               &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;recent files &lt;/span&gt;
        anything-c-source-bookmarks             &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;bookmarks&lt;/span&gt;
        anything-c-source-files-in-current-dir+ &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;current dir&lt;/span&gt;
        anything-c-source-locate))))            &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;use 'locate'&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;
   This will search in buffers, then in my recent-files, then in my bookmarks,
   the files in the current directory, and finally check with the &lt;code&gt;locate&lt;/code&gt;
   tool. That last one is pretty neat, and finally gives me something back for
   the countless times I've wondered why the hard disk is grinding &amp;ndash; indeed,
   it was &lt;code&gt;locate&lt;/code&gt;, updating its database.
&lt;/p&gt;
&lt;p&gt;
   Then, I've defined another binding for searching general documentation on
   my system; I've put it under &lt;code&gt;C-c I&lt;/code&gt;. This looks look something like the
   following:
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;(global-set-key (kbd &lt;span class="org-string"&gt;"C-c I"&lt;/span&gt;)  &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;i -&amp;gt; info&lt;/span&gt;
  (&lt;span class="org-keyword"&gt;lambda&lt;/span&gt; () (interactive)
    (anything
      &lt;span class="org-builtin"&gt;:prompt&lt;/span&gt; &lt;span class="org-string"&gt;"Info about: "&lt;/span&gt;
      &lt;span class="org-builtin"&gt;:candidate-number-limit&lt;/span&gt; 3
      &lt;span class="org-builtin"&gt;:sources&lt;/span&gt;
      '( anything-c-source-info-libc             &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;glibc docs&lt;/span&gt;
         anything-c-source-man-pages             &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;man pages&lt;/span&gt;
         anything-c-source-info-emacs))))        &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;emacs &lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;
   These are sources I query quite regularly; there are many more to be
   found - for most packages with info-pages there's a corresponding
   &lt;code&gt;anything-c-source-info-...&lt;/code&gt;; there's a list in &lt;a href="http://www.emacswiki.org/emacs/anything-config.el"&gt;anything-config.el&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
   Now, those are my &lt;i&gt;general&lt;/i&gt; documentation sources; in specific modes, I
   have specialized information sources; for example, for &lt;code&gt;elisp-mode&lt;/code&gt;:
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;(&lt;span class="org-keyword"&gt;add-hook&lt;/span&gt; 'emacs-lisp-mode-hook
  (&lt;span class="org-keyword"&gt;lambda&lt;/span&gt;()
  &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;other stuff...&lt;/span&gt;
  &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;...&lt;/span&gt;
  &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;put useful info under C-c i&lt;/span&gt;
    (local-set-key (kbd &lt;span class="org-string"&gt;"C-c i"&lt;/span&gt;)
      (&lt;span class="org-keyword"&gt;lambda&lt;/span&gt;() (interactive)
        (anything
          &lt;span class="org-builtin"&gt;:prompt&lt;/span&gt; &lt;span class="org-string"&gt;"Info about: "&lt;/span&gt;
          &lt;span class="org-builtin"&gt;:candidate-number-limit&lt;/span&gt; 5
          &lt;span class="org-builtin"&gt;:sources&lt;/span&gt;
          '( anything-c-source-emacs-functions
             anything-c-source-emacs-variables
             anything-c-source-info-elisp
             anything-c-source-emacs-commands
             anything-c-source-emacs-source-defun
             anything-c-source-emacs-lisp-expectations
             anything-c-source-emacs-lisp-toplevels
             anything-c-source-emacs-functions-with-abbrevs
             anything-c-source-info-emacs))))
&lt;/pre&gt;


&lt;p&gt;   
   This post just scratches the surface of what is possible &amp;ndash; so go and
   experiment :) One interesting thing is to add your own sources; I played a
   bit with that already, 
&lt;/p&gt;
&lt;p&gt;
   There are &lt;i&gt;many&lt;/i&gt; things in &lt;code&gt;anything&lt;/code&gt; I did not cover yet. First, there are
   many more sources to search - and it's pretty easy to write your own &amp;ndash; see
   the &lt;a href="http://www.emacswiki.org/emacs/Anything"&gt;EmacsWiki-page&lt;/a&gt;.
&lt;/p&gt;



&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/2213113953493134138/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=2213113953493134138' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/2213113953493134138'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/2213113953493134138'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2011/09/finding-just-about-anything.html' title='finding just about anything'/><author><name>djcb</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_kGFGcbwevHE/R1Rgjkq0h3I/AAAAAAAAAMg/KLj-i9qWXGg/S220/rupert.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-981514934179643003</id><published>2011-08-25T23:48:00.001+03:00</published><updated>2011-08-25T23:50:49.757+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><title type='text'>customizing the mode-line</title><content type='html'>&lt;div class="outline-2" id="outline-container-1"&gt;
&lt;div class="outline-text-2" id="text-1"&gt;
The mode-line is the emacs 'status bar', the bar just above the minibuffer
  that shows various pieces of information, such as the buffer name, the major
  mode, maybe the current line number, some indicators for active minor modes,
  and so on. As I'm looking at it, it starts with &lt;code&gt;1&amp;lt;U:**-&lt;/code&gt; (which is:
  input-method: &lt;code&gt;latin-1-alt-postfix&lt;/code&gt;, buffer-coding-system: &lt;code&gt;utf8-unix&lt;/code&gt;,
  line-ending: unix-style, buffer is writable and buffer is modified – the
  tooltips help).
&lt;br /&gt;
As with just about &lt;i&gt;anything&lt;/i&gt; in emacs, the mode-line can be customized just
  the way you like. I give some example below, not because I think it is
  necessarily the &lt;i&gt;best&lt;/i&gt; way, but just to give you a bit of an example to
  start with when making your own best-mode-line-ever.
&lt;br /&gt;
I'm not going through all the details of the example, but let me highlight a
  few things that make it a bit easier to understand.
&lt;br /&gt;
First of all, the mode-line can be customized by setting the variable
  &lt;code&gt;mode-line-format&lt;/code&gt;; this variable becomes buffer-local automatically when
  changed, so if you want to set it for &lt;i&gt;all&lt;/i&gt; buffers, you'll need to use
  &lt;code&gt;setq-default&lt;/code&gt; in your &lt;code&gt;.emacs&lt;/code&gt; (or equivalent). The format is quite similar
  to the one for &lt;code&gt;frame-title-format&lt;/code&gt;, which we discussed in &lt;a href="http://emacs-fu.blogspot.com/2011/01/setting-frame-title.html"&gt;setting the frame title&lt;/a&gt; a while back.
&lt;br /&gt;
&lt;code&gt;mode-line-format&lt;/code&gt; is a &lt;i&gt;list&lt;/i&gt; of items which are evaluated, and put
  together as a string which then ends up as the mode-line contents. These
  properties can be any string. The following types of items can be used:
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;First, normal strings are just shown as-is;

&lt;/li&gt;
&lt;li&gt;Then, there are some special format parameters which will be replaced with
    their value in the mode-line, from the Emacs-documentation:
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="example"&gt;  %b -- print buffer name.      %f -- print visited file name.
  %F -- print frame name.
  %* -- print %, * or hyphen.   %+ -- print *, % or hyphen.
        %&amp;amp; is like %*, but ignore read-only-ness.
        % means buffer is read-only and * means it is modified.
        For a modified read-only buffer, %* gives % and %+ gives *.
  %s -- print process status.   %l -- print the current line number.
  %c -- print the current column number (this makes editing slower).
        To make the column number update correctly in all cases,
        `column-number-mode' must be non-nil.
  %i -- print the size of the buffer.
  %I -- like %i, but use k, M, G, etc., to abbreviate.
  %p -- print percent of buffer above top of window, or Top, Bot or All.
  %P -- print percent of buffer above bottom of window, perhaps plus Top,
        or print Bottom or All.
  %n -- print Narrow if appropriate.
  %t -- visited file is text or binary (if OS supports this distinction).
  %z -- print mnemonics of keyboard, terminal, and buffer coding systems.
  %Z -- like %z, but including the end-of-line format.
  %e -- print error message about full memory.
  %@ -- print @ or hyphen.  @ means that default-directory is on a
        remote machine.
  %[ -- print one [ for each recursive editing level.  %] similar.
  %% -- print %.   %- -- print infinitely many dashes.
Decimal digits after the % specify field width to which to pad.
&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;Forms of the type &lt;code&gt;(:eval ...)&lt;/code&gt; are evaluated each time the mode-line is
    drawn (just like the '%'-parameters) ; so, if you have a value that
    changes of the course your emacs session, you should use &lt;code&gt;(:eval ...)&lt;/code&gt;.

For example, for your emacs-uptime you could use &lt;code&gt;(:eval (emacs-uptime     "%hh"))&lt;/code&gt;; while the emacs-PID does not change, so simply you could simply
    use  &lt;code&gt;(format "PID:%d")&lt;/code&gt;.
&lt;br /&gt;

The format parameter mentioned above are of evaluated each time as
    well. Note that you have to be a bit careful with evaluations - don't do
    too heavy operations there, and be careful the updates don't recurse.
&lt;br /&gt;

&lt;/li&gt;
&lt;li&gt;There are many others which I won't go into now - please check the Elisp
    reference. It's a rather baroque format…
&lt;/li&gt;
&lt;/ul&gt;
Now, let's put this all together in an example (tested with emacs 23 and
  24). As I said, this is for demonstration purposes only; but hopefully it
  gives you some inspiration. A lot of the 'magic' (colors, tooltips, faces)
  happens with the &lt;code&gt;propertize&lt;/code&gt; function; again, the Elisp documentation can
  tell you a lot more about that. I'm (ab)using the various &lt;code&gt;font-lock&lt;/code&gt;-faces to
  have colors that blend in nicely with your current theme.
&lt;br /&gt;
And it has a limitation still, namely that it does not react to mouse clicks;
  how to that, I will discuss in some future article.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-G61SgIkKlnA/TlazomhrDJI/AAAAAAAAAjg/j39mNphvNNY/s1600/modeline.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-G61SgIkKlnA/TlazomhrDJI/AAAAAAAAAjg/j39mNphvNNY/s1600/modeline.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="src src-elisp"&gt;&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;use &lt;/span&gt;&lt;span class="org-comment"&gt;&lt;span class="org-keyword"&gt;setq&lt;/span&gt;&lt;/span&gt;&lt;span class="org-comment"&gt;-default to set it for /all/ modes&lt;/span&gt;
(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; mode-line-format
  (list
    &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;the buffer name; the file name as a tool tip&lt;/span&gt;
    '(&lt;span class="org-builtin"&gt;:eval&lt;/span&gt; (propertize &lt;span class="org-string"&gt;"%b "&lt;/span&gt; 'face 'font-lock-keyword-face
        'help-echo (buffer-file-name)))

    &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;line and column&lt;/span&gt;
    &lt;span class="org-string"&gt;"("&lt;/span&gt; &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;'%02' to set to 2 chars at least; prevents flickering&lt;/span&gt;
      (propertize &lt;span class="org-string"&gt;"%02l"&lt;/span&gt; 'face 'font-lock-type-face) &lt;span class="org-string"&gt;","&lt;/span&gt;
      (propertize &lt;span class="org-string"&gt;"%02c"&lt;/span&gt; 'face 'font-lock-type-face) 
    &lt;span class="org-string"&gt;") "&lt;/span&gt;

    &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;relative position, size of file&lt;/span&gt;
    &lt;span class="org-string"&gt;"["&lt;/span&gt;
    (propertize &lt;span class="org-string"&gt;"%p"&lt;/span&gt; 'face 'font-lock-constant-face) &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;% above top&lt;/span&gt;
    &lt;span class="org-string"&gt;"/"&lt;/span&gt;
    (propertize &lt;span class="org-string"&gt;"%I"&lt;/span&gt; 'face 'font-lock-constant-face) &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;size&lt;/span&gt;
    &lt;span class="org-string"&gt;"] "&lt;/span&gt;

    &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;the current major mode for the buffer.&lt;/span&gt;
    &lt;span class="org-string"&gt;"["&lt;/span&gt;

    '(&lt;span class="org-builtin"&gt;:eval&lt;/span&gt; (propertize &lt;span class="org-string"&gt;"%m"&lt;/span&gt; 'face 'font-lock-string-face
              'help-echo buffer-file-coding-system))
    &lt;span class="org-string"&gt;"] "&lt;/span&gt;


    &lt;span class="org-string"&gt;"["&lt;/span&gt; &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;insert vs overwrite mode, input-method in a tooltip&lt;/span&gt;
    '(&lt;span class="org-builtin"&gt;:eval&lt;/span&gt; (propertize (&lt;span class="org-keyword"&gt;if&lt;/span&gt; overwrite-mode &lt;span class="org-string"&gt;"Ovr"&lt;/span&gt; &lt;span class="org-string"&gt;"Ins"&lt;/span&gt;)
              'face 'font-lock-preprocessor-face
              'help-echo (concat &lt;span class="org-string"&gt;"Buffer is in "&lt;/span&gt;
                           (&lt;span class="org-keyword"&gt;if&lt;/span&gt; overwrite-mode &lt;span class="org-string"&gt;"overwrite"&lt;/span&gt; &lt;span class="org-string"&gt;"insert"&lt;/span&gt;) &lt;span class="org-string"&gt;" mode"&lt;/span&gt;)))

    &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;was this buffer modified since the last save?&lt;/span&gt;
    '(&lt;span class="org-builtin"&gt;:eval&lt;/span&gt; (&lt;span class="org-keyword"&gt;when&lt;/span&gt; (buffer-modified-p)
              (concat &lt;span class="org-string"&gt;","&lt;/span&gt;  (propertize &lt;span class="org-string"&gt;"Mod"&lt;/span&gt;
                             'face 'font-lock-warning-face
                             'help-echo &lt;span class="org-string"&gt;"Buffer has been modified"&lt;/span&gt;))))

    &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;is this buffer read-only?&lt;/span&gt;
    '(&lt;span class="org-builtin"&gt;:eval&lt;/span&gt; (&lt;span class="org-keyword"&gt;when&lt;/span&gt; buffer-read-only
              (concat &lt;span class="org-string"&gt;","&lt;/span&gt;  (propertize &lt;span class="org-string"&gt;"RO"&lt;/span&gt;
                             'face 'font-lock-type-face
                             'help-echo &lt;span class="org-string"&gt;"Buffer is read-only"&lt;/span&gt;))))  
    &lt;span class="org-string"&gt;"] "&lt;/span&gt;

    &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;add the time, with the date and the emacs uptime in the tooltip&lt;/span&gt;
    '(&lt;span class="org-builtin"&gt;:eval&lt;/span&gt; (propertize (format-time-string &lt;span class="org-string"&gt;"%H:%M"&lt;/span&gt;)
              'help-echo
              (concat (format-time-string &lt;span class="org-string"&gt;"%c; "&lt;/span&gt;)
                      (emacs-uptime &lt;span class="org-string"&gt;"Uptime:%hh"&lt;/span&gt;))))
    &lt;span class="org-string"&gt;" --"&lt;/span&gt;
    &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;i don't want to see minor-modes; but if you want, uncomment this:&lt;/span&gt;
    &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;minor-mode-alist  ;; list of minor modes&lt;/span&gt;
    &lt;span class="org-string"&gt;"%-"&lt;/span&gt; &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;fill with '-'&lt;/span&gt;
    ))
&lt;/pre&gt;
Have fun playing with this!
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/981514934179643003/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=981514934179643003' title='17 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/981514934179643003'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/981514934179643003'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2011/08/customizing-mode-line.html' title='customizing the mode-line'/><author><name>djcb</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_kGFGcbwevHE/R1Rgjkq0h3I/AAAAAAAAAMg/KLj-i9qWXGg/S220/rupert.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-G61SgIkKlnA/TlazomhrDJI/AAAAAAAAAjg/j39mNphvNNY/s72-c/modeline.png' height='72' width='72'/><thr:total>17</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-8218094139540239299</id><published>2011-05-16T22:59:00.001+03:00</published><updated>2011-08-26T00:46:46.725+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>toward balanced and colorful delimiters</title><content type='html'>&lt;div class="outline-3" id="outline-container-1"&gt;
&lt;div class="outline-text-3" id="text-1"&gt;
Emacs has the very useful feature of blinking the corresponding left "(" when
   you type its partner ")" (and the same for other delimiters like "[]", "{}"
   etc., depending on the mode). This is very useful for programming, especially
   for languages like Lisp and Scheme and the like.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Further help can come from tools like &lt;a href="http://emacs-fu.blogspot.com/2010/06/automatic-pairing-of-brackets-and.html"&gt;autopair&lt;/a&gt; or &lt;a href="http://www.emacswiki.org/emacs/ParEdit"&gt;paredit&lt;/a&gt; – although the
   latter is a bit too much &lt;i&gt;bondage &amp;amp; discipline&lt;/i&gt; for me, many people love it.
&lt;br /&gt;
Anyway, recently I discovered a new helper in the quest for balance in
   delimited universe: &lt;a href="http://www.emacswiki.org/emacs/RainbowDelimiters"&gt;rainbow-delimiters&lt;/a&gt;. With this package, the delimiters all
   get different colors based on their nesting level. It works wonderfully well.
&lt;br /&gt;
Installation is straightforward:
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;download &lt;a href="http://www.emacswiki.org/emacs/rainbow-delimiters.el"&gt;rainbow-delimiters&lt;/a&gt; and put it in your &lt;code&gt;load-path&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;add something like the following in your &lt;code&gt;.emacs&lt;/code&gt;:
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="src src-elisp"&gt;(&lt;span class="org-keyword"&gt;when&lt;/span&gt; (&lt;span class="org-keyword"&gt;require&lt;/span&gt; '&lt;span class="org-constant"&gt;rainbow-delimiters&lt;/span&gt; nil 'noerror) 
  (&lt;span class="org-keyword"&gt;add-hook&lt;/span&gt; 'scheme-mode-hook 'rainbow-delimiters-mode))
&lt;/pre&gt;
That's it – of course you'll need to do the equivalent for modes where you'd
   like to enable it. See the screenshot below – maybe a bit &lt;i&gt;too&lt;/i&gt; colorful for
   some people, but I like it and I have found it &lt;i&gt;actually useful&lt;/i&gt; to see the
   corresponding delimiters without having to move the cursor over them.&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-kY5iKW2yB38/TdF_nIEzR3I/AAAAAAAAAio/poikN3URlgY/s1600/rainbow-delimiter.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="206" src="http://2.bp.blogspot.com/-kY5iKW2yB38/TdF_nIEzR3I/AAAAAAAAAio/poikN3URlgY/s400/rainbow-delimiter.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
I already added some nice Zenburn colors for this to the &lt;a href="https://github.com/djcb/elisp/blob/master/themes/zenburn-theme.el"&gt;Zenburn theme for Emacs-24&lt;/a&gt;, as can be seen in the screenshot.
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/8218094139540239299/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=8218094139540239299' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/8218094139540239299'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/8218094139540239299'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2011/05/toward-balanced-and-colorful-delimiters.html' title='toward balanced and colorful delimiters'/><author><name>djcb</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_kGFGcbwevHE/R1Rgjkq0h3I/AAAAAAAAAMg/KLj-i9qWXGg/S220/rupert.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-kY5iKW2yB38/TdF_nIEzR3I/AAAAAAAAAio/poikN3URlgY/s72-c/rainbow-delimiter.png' height='72' width='72'/><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-6798875775963558440</id><published>2011-05-08T12:05:00.000+03:00</published><updated>2011-05-08T12:05:02.558+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><category scheme='http://www.blogger.com/atom/ns#' term='emacs24'/><title type='text'>porting the zenburn theme to emacs 24</title><content type='html'>&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div class="outline-text-2" id="text-1"&gt;


&lt;p&gt;
  Just a small note: I already mentioned the &lt;a href="http://emacs-fu.blogspot.com/search?q=zenburn"&gt;zenburn color theme&lt;/a&gt; a couple of
  times. I have now ported the full (big) set of customizations to the emacs-24 format
  &amp;ndash; &lt;a href="https://github.com/djcb/elisp/blob/master/themes/zenburn-theme.el"&gt;find it at github&lt;/a&gt;; so if you run emacs 24 (the development version) and
  enjoy &lt;a href="http://slinky.imukuppi.org/zenburnpage/"&gt;zenburn&lt;/a&gt; like me, you can give it try. Suggestions, additions are
  welcome.
&lt;/p&gt;
&lt;p&gt;
  Note, there seems to be a limitation with the &lt;code&gt;:inherit&lt;/code&gt;-attribute for themes
  &amp;ndash; in practice it means that some aspects of the theme may not work if a
  package sets the face before the theme does. Therefore, best to load the theme
  early from your &lt;code&gt;.emacs&lt;/code&gt; or &lt;code&gt;init.el&lt;/code&gt;; or alternatively visit the theme file
  (&lt;code&gt;zenburn-theme.el&lt;/code&gt; in this case) and evaluate the buffer.
&lt;/p&gt;


&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/6798875775963558440/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=6798875775963558440' title='18 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/6798875775963558440'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/6798875775963558440'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2011/05/porting-zenburn-theme-to-emacs-24.html' title='porting the zenburn theme to emacs 24'/><author><name>djcb</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_kGFGcbwevHE/R1Rgjkq0h3I/AAAAAAAAAMg/KLj-i9qWXGg/S220/rupert.jpg'/></author><thr:total>18</thr:total><georss:featurename>Helsinki, Finland</georss:featurename><georss:point>60.1698125 24.93824010000003</georss:point><georss:box>60.0313735 24.70242710000003 60.3082515 25.17405310000003</georss:box></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-7951873464428828260</id><published>2011-04-12T20:57:00.000+03:00</published><updated>2011-04-12T20:57:52.053+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='org-mode'/><category scheme='http://www.blogger.com/atom/ns#' term='latex'/><category scheme='http://www.blogger.com/atom/ns#' term='new'/><title type='text'>nice-looking pdfs with org-mode and xetex</title><content type='html'>&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div class="outline-text-2" id="text-1"&gt;


&lt;p&gt;
  I've discussed the wonderful &lt;code&gt;org-mode&lt;/code&gt; here a &lt;a href="http://emacs-fu.blogspot.com/search/label/org-mode"&gt;number of times&lt;/a&gt; already. It has
  become a pretty important part of my overall workflow. One thing I am using
  &lt;code&gt;org-mode&lt;/code&gt; for, is to produce all kinds of PDF-documents that I can share with
  other people.
&lt;/p&gt;

&lt;/div&gt;

&lt;div id="outline-container-1_1" class="outline-3"&gt;
&lt;h3 id="sec-1_1"&gt;org-mode &amp;amp; LaTeX &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1_1"&gt;


&lt;p&gt;
   In the past, I often used straight &lt;a href="http://en.wikipedia.org/wiki/LaTeX"&gt;LaTeX&lt;/a&gt; for such things; I wrote my thesis
   with it, but also many other documents. There are many things I like about
   LaTeX, one of them being that I can use emacs for writing. Still, there are
   also a few things I do &lt;i&gt;not&lt;/i&gt; particularly like. First, I think LaTeX is quite
   heavy with formatting directives, which hinder my writing flow (e.g., when I
   want to include an image, a table or a source code snippet). Another thing is
   that I find the default LaTeX styles a bit &lt;i&gt;boring&lt;/i&gt;. Nothing wrong with it,
   but there just too many documents with the exact same lay-out.
&lt;/p&gt;
&lt;p&gt;   
   Now, back to &lt;code&gt;org-mode&lt;/code&gt;. One way to use &lt;code&gt;org-mode&lt;/code&gt; is as a friendly way to
   generate LaTeX (and, consequently, PDFs). This is a big improvement! Much
   more than LaTeX itself, &lt;code&gt;org-mode&lt;/code&gt; allows to focus on the contents of the
   document, rather than instructing LaTeX what to do. This comes at the price
   of small bit of flexibility, but, if needed &lt;code&gt;org-mode&lt;/code&gt; allows you include
   straight LaTeX when needed &amp;ndash; so while keeping easy things easy, hard things
   are still possible. The latter does require a bit of experience with LaTeX a
   though.
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1_2" class="outline-3"&gt;
&lt;h3 id="sec-1_2"&gt;setting up XeTeX &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1_2"&gt;


&lt;p&gt;
   Now, for the second issue, the way documents &lt;b&gt;look&lt;/b&gt;, there are other
   solutions, and they live on the LaTeX side of things. I'm sure many have seen
   &lt;a href="http://nitens.org/taraborelli/latex"&gt;The Beauty of LaTeX&lt;/a&gt;. Using the &lt;i&gt;XeTeX&lt;/i&gt; implementation of LaTeX and the
   &lt;code&gt;fontspec&lt;/code&gt; package, you can create LaTeX documents with a bit 'refreshed'
   look.
&lt;/p&gt;
&lt;p&gt;   
   So, the steps to get this working with &lt;code&gt;org-mode&lt;/code&gt;:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;install the &lt;code&gt;texlive-xetex&lt;/code&gt; packages on Ubuntu and Debian (this installs a
    &lt;i&gt;huge&lt;/i&gt; set of packages)
&lt;/li&gt;
&lt;li&gt;install the SIL fonts (I'm using &lt;code&gt;ttf-sil-gentium&lt;/code&gt; and &lt;code&gt;ttf-sil-charis&lt;/code&gt;, but
    there are more)
&lt;/li&gt;
&lt;li&gt;I'm also using DejaVu Mono (&lt;code&gt;ttf-dejavu&lt;/code&gt;)
&lt;/li&gt;
&lt;/ul&gt;


&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1_3" class="outline-3"&gt;
&lt;h3 id="sec-1_3"&gt;teaching org-mode about the new XeTeX stuff &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1_3"&gt;


&lt;p&gt;
   We now need to define some LaTeX document class for &lt;code&gt;org-mode&lt;/code&gt; that uses
   &lt;i&gt;XeTeX&lt;/i&gt; and some of these new fonts. Let's call the document class
   &lt;code&gt;djcb-org-article&lt;/code&gt; (as I often use the &lt;code&gt;djcb-&lt;/code&gt; prefix for my own stuff), it
   could be something like the following (add to your &lt;code&gt;org&lt;/code&gt;-setup &amp;ndash; e.g., in
   your &lt;code&gt;.emacs&lt;/code&gt;, make sure there is a &lt;code&gt;(require 'org)&lt;/code&gt; before this:
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;'djcb-org-article' for export org documents to the LaTex 'article', using
&lt;/span&gt;&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;XeTeX and some fancy fonts; requires XeTeX (see org-latex-to-pdf-process)
&lt;/span&gt;(add-to-list 'org-export-latex-classes
  '(&lt;span class="org-string"&gt;"djcb-org-article"&lt;/span&gt;
&lt;span class="org-string"&gt;"\\documentclass[11pt,a4paper]{article}
\\usepackage[T1]{fontenc}
\\usepackage{fontspec}
\\usepackage{graphicx} 
\\defaultfontfeatures{Mapping=tex-text}
\\setromanfont{Gentium}
\\setromanfont [BoldFont={Gentium Basic Bold},
                ItalicFont={Gentium Basic Italic}]{Gentium Basic}
\\setsansfont{Charis SIL}
\\setmonofont[Scale=0.8]{DejaVu Sans Mono}
\\usepackage{geometry}
\\geometry{a4paper, textwidth=6.5in, textheight=10in,
            marginparsep=7pt, marginparwidth=.6in}
\\pagestyle{empty}
\\title{}
      [NO-DEFAULT-PACKAGES]
      [NO-PACKAGES]"&lt;/span&gt;
     (&lt;span class="org-string"&gt;"\\section{%s}"&lt;/span&gt; . &lt;span class="org-string"&gt;"\\section*{%s}"&lt;/span&gt;)
     (&lt;span class="org-string"&gt;"\\subsection{%s}"&lt;/span&gt; . &lt;span class="org-string"&gt;"\\subsection*{%s}"&lt;/span&gt;)
     (&lt;span class="org-string"&gt;"\\subsubsection{%s}"&lt;/span&gt; . &lt;span class="org-string"&gt;"\\subsubsection*{%s}"&lt;/span&gt;)
     (&lt;span class="org-string"&gt;"\\paragraph{%s}"&lt;/span&gt; . &lt;span class="org-string"&gt;"\\paragraph*{%s}"&lt;/span&gt;)
     (&lt;span class="org-string"&gt;"\\subparagraph{%s}"&lt;/span&gt; . &lt;span class="org-string"&gt;"\\subparagraph*{%s}"&lt;/span&gt;)))

&lt;/pre&gt;



&lt;p&gt;
  Of course, this can be customized to your own preference; e.g.,
  North-Americans may not be using A4-paper.
&lt;/p&gt;
&lt;p&gt;
  &lt;code&gt;org-mode&lt;/code&gt; takes care of the export from its own format to LaTeX, but we need
  to tell it to use &lt;code&gt;xelatex&lt;/code&gt; to process the LaTeX to PDF:
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; org-latex-to-pdf-process 
  '(&lt;span class="org-string"&gt;"xelatex -interaction nonstopmode %f"&lt;/span&gt;
     &lt;span class="org-string"&gt;"xelatex -interaction nonstopmode %f"&lt;/span&gt;)) &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;for multiple passes
&lt;/span&gt;&lt;/pre&gt;



&lt;p&gt;  
  That's all that's needed on the setup-side.
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1_4" class="outline-3"&gt;
&lt;h3 id="sec-1_4"&gt;creating a document &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1_4"&gt;


&lt;p&gt;
   Now, let's create a little test document, &lt;code&gt;test.org&lt;/code&gt;, to show how it works:
&lt;/p&gt;



&lt;pre class="src src-org-mode"&gt;#+LaTeX_CLASS: djcb-org-article
#+TITLE: My little document

* Introduction
  
  This is my document. There are many like it, but this is mine. It's easy to
  write without *too* _many_ /distractions/.
  
** Normal distribution

   Probability density of the normal distribution, using familiar TeX notation
   for formulae:
 
   $$\frac{1}{\sqrt{2\pi\sigma^2}}e^{ -\frac{(x-\mu)^2}{2\sigma^2} }$$

** Some table

| *Greek God* | *Roman God* | *Element*      |
|-------------+-------------+----------------|
| Zeus        | Jupiter     | Sky and clouds |
| Hera        | Juno        | Family         |
| Poseidon    | Neptune     | Sea            |
| Hades       | Pluto       | Underworld     |
&lt;/pre&gt;



&lt;p&gt;   
   We can export this to a PDF using &lt;code&gt;C-c C-e p&lt;/code&gt; (or &lt;code&gt;C-c C-e d&lt;/code&gt; to
   automatically open the PDF in a PDF-viewer). This should all work nicely; if
   it doesn't, note that when exporting, say, &lt;code&gt;test.org&lt;/code&gt;, &lt;code&gt;org-mode&lt;/code&gt; will create
   a file called &lt;code&gt;test.tex&lt;/code&gt;, and visit in a buffer. There's also a buffer with
   the output from various commands, but sometimes it can be useful to run LaTeX
   (&lt;code&gt;xelatex&lt;/code&gt; in this case) on the file by hand, to find any problems. The
   wonderful &lt;code&gt;org&lt;/code&gt;-documentation about &lt;a href="http://orgmode.org/worg/org-tutorials/org-latex-export.html"&gt;exporting to LaTeX&lt;/a&gt; has more information.
&lt;/p&gt;

&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-4wlUMuYkass/TaSSlfKjl0I/AAAAAAAAAig/qJ54Ud0xPPI/s1600/org-docs.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="231" width="320" src="http://3.bp.blogspot.com/-4wlUMuYkass/TaSSlfKjl0I/AAAAAAAAAig/qJ54Ud0xPPI/s320/org-docs.png" /&gt;&lt;/a&gt;&lt;/div&gt;



&lt;p&gt;
   I think the result is pretty nice &amp;ndash; it stays true to the class LaTeX article
   class, but freshens it up a bit with some news font. If you can make
   something better &amp;ndash; which is not unlikely &amp;ndash; you are of course invited to
   contribute your own!
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1_5" class="outline-3"&gt;
&lt;h3 id="sec-1_5"&gt;Concluding &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1_5"&gt;


&lt;p&gt;   
   &lt;code&gt;org-mode&lt;/code&gt; is a pretty convenient way to write nice-looking PDFs. Combined
   with &lt;code&gt;xelatex&lt;/code&gt;, they don't have to look too plain :). However, I'm aware of
   my limitations when it comes to the coolness/aesthetic aspects, but I hope
   others can show the way here.
&lt;/p&gt;
&lt;p&gt;
   Maybe &lt;code&gt;org-mode&lt;/code&gt; could ship with a number of ready-made templates to make
   it easy to make nice-looking documents, resumes, reference cards, reports,
   meeting notes and so on.
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/7951873464428828260/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=7951873464428828260' title='19 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/7951873464428828260'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/7951873464428828260'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2011/04/nice-looking-pdfs-with-org-mode-and.html' title='nice-looking pdfs with org-mode and xetex'/><author><name>djcb</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_kGFGcbwevHE/R1Rgjkq0h3I/AAAAAAAAAMg/KLj-i9qWXGg/S220/rupert.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-4wlUMuYkass/TaSSlfKjl0I/AAAAAAAAAig/qJ54Ud0xPPI/s72-c/org-docs.png' height='72' width='72'/><thr:total>19</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-1435692343654093608</id><published>2011-03-31T21:10:00.002+03:00</published><updated>2011-04-02T09:33:26.913+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><category scheme='http://www.blogger.com/atom/ns#' term='wanderlust'/><category scheme='http://www.blogger.com/atom/ns#' term='e-mail'/><title type='text'>searching e-mails with wanderlust and mu</title><content type='html'>&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div class="outline-text-2" id="text-1"&gt;


&lt;p&gt;  
  I have discussed the Wanderlust e-mail client a &lt;a href="http://emacs-fu.blogspot.com/search/label/wanderlust"&gt;couple of times&lt;/a&gt; already. I'm
  still using it, so I keep on learning new tricks. Even though there has been
  quite a bit of action in the competing &lt;a href="http://www.gnus.org/"&gt;gnus&lt;/a&gt; e-mail client, for my particular
  use-case, Wanderlust is still the best option.
&lt;/p&gt;
&lt;p&gt;
  'My particular use-case' consists of storing my mail in Maildirs, which I fill
  with either &lt;a href="https://github.com/nicolas33/offlineimap"&gt;offlineimap&lt;/a&gt; (which has fortunately found a new maintainer) or
  &lt;a href="http://fetchmail.berlios.de/"&gt;fetchmail&lt;/a&gt;.
&lt;/p&gt;

&lt;/div&gt;

&lt;div id="outline-container-1_1" class="outline-3"&gt;
&lt;h3 id="sec-1_1"&gt;mu &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1_1"&gt;


&lt;p&gt;
   When dealing with e-mail, one particularly important feature for me is the
   ability to &lt;i&gt;search&lt;/i&gt; my messages. In fact, it's so important for me that I
   wrote some software to do this for me; the software is called &lt;a href="http://www.djcbsoftware.nl/code/mu"&gt;mu&lt;/a&gt;; it indexes
   the messages in my Maildirs, and then allows for searching them using
   queries, based on message contents, headers, or other message properties.
&lt;/p&gt;
&lt;p&gt;
   &lt;code&gt;mu&lt;/code&gt; works through a command-line interface, although there is an
   experimental GUI available as well. The command-line interface makes it
   possible to hook &lt;code&gt;mu&lt;/code&gt; up with various mail-clients, such as &lt;code&gt;mutt&lt;/code&gt;, or
   Wanderlust. Some Linux distributions ship &lt;code&gt;mu&lt;/code&gt;, but since the versions they
   ship are often a bit outdated, I recommend building it yourself from the
   sources linked on the &lt;code&gt;mu&lt;/code&gt; website. The process is fairly straightforward;
   and there is plenty of documentation in the form of man pages.
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1_2" class="outline-3"&gt;
&lt;h3 id="sec-1_2"&gt;mu and wanderlust &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1_2"&gt;


&lt;p&gt;
   I've been combining &lt;code&gt;mu&lt;/code&gt; and &lt;code&gt;wanderlust&lt;/code&gt; for a while (see &lt;b&gt;mu and    wanderlust - the old way&lt;/b&gt;, below), but this week &lt;i&gt;Sam B.&lt;/i&gt; on the &lt;code&gt;mu&lt;/code&gt; mailing
   list showed a way to do so in a much more elegant way - using &lt;i&gt;virtual&lt;/i&gt; or
   &lt;i&gt;query&lt;/i&gt; folders.
&lt;/p&gt;
&lt;p&gt;
   How does this work? Well, after installing &lt;code&gt;mu&lt;/code&gt;, add the following to your
   Wanderlust setup file (&lt;code&gt;~/.wl&lt;/code&gt; or it's moral equivalent &amp;ndash; see the older
   Wanderlust posts for the details):
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;(&lt;span class="org-keyword"&gt;require&lt;/span&gt; '&lt;span class="org-constant"&gt;elmo-search&lt;/span&gt;)
(elmo-search-register-engine
    'mu 'local-file
    &lt;span class="org-builtin"&gt;:prog&lt;/span&gt; &lt;span class="org-string"&gt;"/usr/local/bin/mu"&lt;/span&gt; &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;or wherever you've installed it
&lt;/span&gt;    &lt;span class="org-builtin"&gt;:args&lt;/span&gt; '(&lt;span class="org-string"&gt;"find"&lt;/span&gt; pattern &lt;span class="org-string"&gt;"--fields"&lt;/span&gt; &lt;span class="org-string"&gt;"l"&lt;/span&gt;) &lt;span class="org-builtin"&gt;:charset&lt;/span&gt; 'utf-8)

(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; elmo-search-default-engine 'mu)
&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;for when you type "g" in folder or summary.
&lt;/span&gt;(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; wl-default-spec &lt;span class="org-string"&gt;"["&lt;/span&gt;)

&lt;/pre&gt;



&lt;p&gt;
   So, to start with the last part, whenever you type &lt;code&gt;g&lt;/code&gt; in folder or summary,
   in the mode-line you will get something like &lt;code&gt;Folder name (.inbox): [&lt;/code&gt;. Now
   simply type your &lt;code&gt;mu&lt;/code&gt; search expression and press Enter, and &lt;code&gt;wanderlust&lt;/code&gt;
   opens a (temporary) folder with the search results. Brilliant!
&lt;/p&gt;
&lt;p&gt;
   Next, to add virtual folders for searches you do often, simply add some
   folder specifications like the following to your &lt;code&gt;.folders&lt;/code&gt; file (again,
   check the older Wanderlust posts if you're not familiar with folders-file):
&lt;/p&gt;



&lt;pre class="example"&gt;VFolders {
# message I received today
  [date:today..now]!mu  "Today"

# messages bigger than 1Mb  
  [size:1m..100m]!mu    "Big"

# signed messages i got in 2010 related to emacs
  [date:2010..2011 flag:signed emacs]!mu "Signed-Emacs2010"

# unread messages
  [not flag:seen]!mu    "Unread"
# or (for mu  &amp;gt;= 0.9.4):
# [flag:unread]! mu      "Unread"
}
&lt;/pre&gt;



&lt;p&gt;
   After this, restart Wanderlust, and there you go! Wanderlust will display
   your brand new virtual folders with an icon that looks like a little whale.
&lt;/p&gt;
&lt;p&gt;
   You can put arbitrary &lt;code&gt;mu&lt;/code&gt; search expressions between the &lt;code&gt;[]&lt;/code&gt;, matching
   whatever is useful in a certain case. Check the &lt;code&gt;mu&lt;/code&gt; documentation to see how
   to do this.
&lt;/p&gt;
&lt;p&gt;     
   Note, the messages you get in these virtual folders are &lt;i&gt;links to&lt;/i&gt; the
   original messages. In practice, this means that changes you make to the links
   do no affect the originals &amp;ndash; if you delete a link you're not deleting the
   message.
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1_3" class="outline-3"&gt;
&lt;h3 id="sec-1_3"&gt;mu and wanderlust - the old way &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1_3"&gt;


&lt;p&gt;
   This discussion would not complete without a description of the &lt;i&gt;old&lt;/i&gt; way I
   used search. This method may still be useful for integrating &lt;code&gt;mu&lt;/code&gt; with other
   clients such as &lt;code&gt;mutt&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
   What I've been using for a while is a (in retrospect) rather clumsy way to
   integrate message searches with Wanderlust: based on the results of a query,
   I would create some special Maildir and fill it with symbolic links to the
   matched messages, and the visit this special Maildir with Wanderlust. I'll
   include the code here to contrast it with the more elegant solution that we
   saw before, but also because the approach taken might be easily adapted for
   other mail-clients.
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;search using mutt
&lt;/span&gt;(&lt;span class="org-keyword"&gt;defvar&lt;/span&gt; &lt;span class="org-variable-name"&gt;mu-wl-mu-program&lt;/span&gt;     &lt;span class="org-string"&gt;"/usr/local/bin/mu"&lt;/span&gt;)
(&lt;span class="org-keyword"&gt;defvar&lt;/span&gt; &lt;span class="org-variable-name"&gt;mu-wl-search-folder&lt;/span&gt;  &lt;span class="org-string"&gt;"search"&lt;/span&gt;)

(&lt;span class="org-keyword"&gt;defun&lt;/span&gt; &lt;span class="org-function-name"&gt;mu-wl-search&lt;/span&gt; ()
  &lt;span class="org-doc"&gt;"search for messages with `&lt;/span&gt;&lt;span class="org-doc"&gt;&lt;span class="org-constant"&gt;mu&lt;/span&gt;&lt;/span&gt;&lt;span class="org-doc"&gt;', and jump to the results"&lt;/span&gt;
   (&lt;span class="org-keyword"&gt;let*&lt;/span&gt; ((muexpr (read-string &lt;span class="org-string"&gt;"Find messages matching: "&lt;/span&gt;))
          (sfldr  (concat elmo-maildir-folder-path &lt;span class="org-string"&gt;"/"&lt;/span&gt;
                    mu-wl-search-folder))
          (cmdline (concat mu-wl-mu-program &lt;span class="org-string"&gt;" find "&lt;/span&gt;
                      &lt;span class="org-string"&gt;"--clearlinks --format=links --linksdir='"&lt;/span&gt; sfldr &lt;span class="org-string"&gt;"' "&lt;/span&gt;
                     muexpr))    
          (rv (shell-command cmdline)))
    (&lt;span class="org-keyword"&gt;cond&lt;/span&gt;
      ((= rv 0)  (message &lt;span class="org-string"&gt;"Query succeeded"&lt;/span&gt;))
      ((= rv 2)  (message &lt;span class="org-string"&gt;"No matches found"&lt;/span&gt;))
      (t (message &lt;span class="org-string"&gt;"Error running query"&lt;/span&gt;)))
  (= rv 0)))

(&lt;span class="org-keyword"&gt;defun&lt;/span&gt; &lt;span class="org-function-name"&gt;mu-wl-search-and-goto&lt;/span&gt; ()
  &lt;span class="org-doc"&gt;"search and jump to the folder with the results"&lt;/span&gt;
  (interactive)
  (&lt;span class="org-keyword"&gt;when&lt;/span&gt; (mu-wl-search)
    (wl-summary-goto-folder-subr
      (concat &lt;span class="org-string"&gt;"."&lt;/span&gt; mu-wl-search-folder)
      'force-update nil nil t)
    (wl-summary-sort-by-date)))

&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;search by pressing 'Q'
&lt;/span&gt;(define-key wl-summary-mode-map (kbd &lt;span class="org-string"&gt;"Q"&lt;/span&gt;) &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;=&amp;gt; query
&lt;/span&gt;  '(&lt;span class="org-keyword"&gt;lambda&lt;/span&gt;()(interactive)(mu-wl-search-and-goto))) 
(define-key wl-folder-mode-map (kbd &lt;span class="org-string"&gt;"Q"&lt;/span&gt;) &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;=&amp;gt; query
&lt;/span&gt;  '(&lt;span class="org-keyword"&gt;lambda&lt;/span&gt;()(interactive)(mu-wl-search-and-goto))) 
&lt;/pre&gt;



&lt;p&gt;   
   After installing &lt;code&gt;mu&lt;/code&gt; and putting the above in your &lt;code&gt;wanderlust&lt;/code&gt; startup
   file, you should be able to search by pressing &lt;code&gt;Q&lt;/code&gt;. The &lt;code&gt;mu&lt;/code&gt; documentation
   has an example for &lt;code&gt;mutt&lt;/code&gt; as well.
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1_4" class="outline-3"&gt;
&lt;h3 id="sec-1_4"&gt;conclusion &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1_4"&gt;


&lt;p&gt;
   It's straightforward to integrate advanced searching capabilities to
   Wanderlust using &lt;code&gt;mu&lt;/code&gt;, and thanks to Sam B., it's gotten a lot easier! The
   second (old) approach may be useful as 'inspiration' for use in other e-mail
   clients as well, if they do not provide the kind of hooks that the first
   solution needs.
&lt;/p&gt;



&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/1435692343654093608/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=1435692343654093608' title='14 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/1435692343654093608'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/1435692343654093608'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2011/03/searching-e-mails-with-wanderlust-and.html' title='searching e-mails with wanderlust and mu'/><author><name>djcb</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_kGFGcbwevHE/R1Rgjkq0h3I/AAAAAAAAAMg/KLj-i9qWXGg/S220/rupert.jpg'/></author><thr:total>14</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-4255444389172592100</id><published>2011-03-26T14:18:00.000+02:00</published><updated>2011-03-26T14:18:37.642+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><title type='text'>IELM: a REPL for emacs</title><content type='html'>&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div class="outline-text-2" id="text-1"&gt;

&lt;p&gt;
Emacs-lisp (elisp) is a nice language to play around with code and try things as
you develop them &amp;ndash; &lt;i&gt;explorative programming&lt;/i&gt;. I often use the &lt;code&gt;*scratch*&lt;/code&gt;
buffer for that, but sometimes it's nice to use a so-called '&lt;a href="http://en.wikipedia.org/wiki/REPL"&gt;REPL&lt;/a&gt;' (
&lt;i&gt;Read-Eval-Print-Loop&lt;/i&gt;) instead. A REPL is a sort-of command-line interface
where your expressions are evaluated as soon as they are considered 'complete'
and you press &lt;code&gt;Enter&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
So, enter Emacs's built-in repl: &lt;code&gt;IELM&lt;/code&gt;. You can activate it with &lt;code&gt;M-x ielm&lt;/code&gt;,
and the interaction looks something like the following:
&lt;/p&gt;



&lt;pre class="example"&gt;*** Welcome to IELM ***  Type (describe-mode) for help.
ELISP&amp;gt; 123 
123
ELISP&amp;gt; (+ 1 2)
3
ELISP&amp;gt; ;; comment
ELISP&amp;gt; (defun fac (n)
         (if (= 0 n)
           1
           (* n (fac (- n 1)))))
fac
ELISP&amp;gt; (fac 5)
120
ELISP&amp;gt; 
&lt;/pre&gt;



&lt;p&gt;
By default, IELM evaluates &lt;b&gt;complete&lt;/b&gt; expressions automatically as soon you as
you press Enter. So one thing to remember is that if you want to have
multi-line expression (like above), you must make sure that after each line
the expression is &lt;i&gt;not&lt;/i&gt; complete (i.e., the brackets are not balanced) --
otherwise the expression will be evaluated too early. That makes modes like
&lt;a href="http://emacs-fu.blogspot.com/2010/06/automatic-pairing-of-brackets-and.html"&gt;autopair&lt;/a&gt; or &lt;a href="http://www.emacswiki.org/emacs/ParEdit"&gt;paredit&lt;/a&gt; a bit inconvenient for this.
&lt;/p&gt;
&lt;p&gt;
If you don't like that behavior, you can do:
&lt;/p&gt;
&lt;p&gt;
(setq ielm-dynamic-return nil)
&lt;/p&gt;
&lt;p&gt;
which will allow you to Enter as much as you want and only evaluate things when
you press &lt;code&gt;C-j&lt;/code&gt;. But then you might as well use &lt;code&gt;*scratch*&lt;/code&gt; I
suppose. Personally, I use IELM mostly as a calculator.
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/4255444389172592100/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=4255444389172592100' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/4255444389172592100'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/4255444389172592100'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2011/03/ielm-repl-for-emacs.html' title='IELM: a REPL for emacs'/><author><name>djcb</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_kGFGcbwevHE/R1Rgjkq0h3I/AAAAAAAAAMg/KLj-i9qWXGg/S220/rupert.jpg'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-2556299854516999420</id><published>2011-02-27T14:32:00.003+02:00</published><updated>2011-02-27T14:36:39.255+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='org-mode'/><category scheme='http://www.blogger.com/atom/ns#' term='new'/><title type='text'>executable source code blocks with org-babel</title><content type='html'>&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div class="outline-text-2" id="text-1"&gt;


&lt;p&gt;
  &lt;a href="http://orgmode.org/worg/org-contrib/babel/"&gt;org-babel&lt;/a&gt; is the mechanism that &lt;code&gt;org-mode&lt;/code&gt; offers for evaluating (executing)
  blocks of source code embedded in your &lt;code&gt;org-mode&lt;/code&gt;-documents. This is useful
  for so-called &lt;a href="http://reproducibleresearch.net/index.php/Main_Page"&gt;reproducible research&lt;/a&gt;, i.e., where you allow your readers to go
  through the steps that led to your results. 
&lt;/p&gt;
&lt;p&gt;
  Here, I'm just scratching the surface with some simple examples.
&lt;/p&gt;

&lt;/div&gt;

&lt;div id="outline-container-1_1" class="outline-3"&gt;
&lt;h3 id="sec-1_1"&gt;source code blocks &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1_1"&gt;


&lt;p&gt;
   Let's first look at how it all began: source code blocks. I guess most
   &lt;code&gt;org-mode&lt;/code&gt;-users will be familiar with those: the ability to include
   syntax-highlighted ('font-locked') snippets of source code in
   &lt;code&gt;org&lt;/code&gt;-documents. We discussed source blocks &lt;a href="http://emacs-fu.blogspot.com/2009/05/writing-and-blogging-with-org-mode.html"&gt;before&lt;/a&gt;, they look like this:
&lt;/p&gt;



&lt;pre class="example"&gt;#+begin_src perl
sub my_func {
        print "Hello, world!\n";
}
#+end_src
&lt;/pre&gt;



&lt;p&gt;   
   And note that code blocks can be edited in their 'native mode' using &lt;code&gt;C-c'=     (or, =org-edit-src-code&lt;/code&gt;).
&lt;/p&gt;
&lt;p&gt;
   When code block like this are exported to, say, HTML, they'll look like the
   following fully highlighted snippet (assuming you're reading Emacs-fu in
   it's full-color version):
&lt;/p&gt;



&lt;pre class="src src-perl"&gt;&lt;span class="org-keyword"&gt;sub&lt;/span&gt; &lt;span class="org-function-name"&gt;my_func&lt;/span&gt; {
        &lt;span class="org-cperl-nonoverridable"&gt;print&lt;/span&gt; &lt;span class="org-string"&gt;"Hello, world!\n"&lt;/span&gt;;
}
&lt;/pre&gt;



&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1_2" class="outline-3"&gt;
&lt;h3 id="sec-1_2"&gt;evaluating source code &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1_2"&gt;


&lt;p&gt;
   &lt;code&gt;org-babel&lt;/code&gt; takes this a few steps further: instead of just &lt;i&gt;looking&lt;/i&gt; at
   source code, we can actually evaluate (execute) it, using the
   &lt;code&gt;org-mode&lt;/code&gt;-based system called &lt;code&gt;org-babel&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
   If you have a recent version of &lt;code&gt;org-mode&lt;/code&gt; (7.x or later), add the
   following to your &lt;code&gt;.emacs&lt;/code&gt; (or equivalent):
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;(org-babel-do-load-languages
 'org-babel-load-languages
  '( (perl . t)         
     (ruby . t)
     (sh . t)
     (python . t)
     (emacs-lisp . t)   
   ))
&lt;/pre&gt;



&lt;p&gt;   
   This enables &lt;code&gt;org-babel&lt;/code&gt; for the mentioned languages; there are &lt;i&gt;many&lt;/i&gt;
   other languages &lt;a href="http://orgmode.org/worg/org-contrib/babel/languages.php"&gt;available as well&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;   
   Now, suppose we have a snippet of &lt;code&gt;python&lt;/code&gt; in an &lt;code&gt;org-mode&lt;/code&gt;-buffer:
&lt;/p&gt;



&lt;pre class="example"&gt;#+begin_src python
def hello(str):
        return "Hello, " + str + "!"
return hello ("dude")
#+end_src
&lt;/pre&gt;



&lt;p&gt;
   You can move the cursor (point) inside the src-block and press &lt;code&gt;C-c C-c&lt;/code&gt; (or,
   &lt;code&gt;org-confirm-babel-evaluate&lt;/code&gt;). This causes the block of code to be evaluated
   (executed), after asking you for confirmation. The result will inserted below
   the block, like:
&lt;/p&gt;



&lt;pre class="example"&gt;#+results:
: Hello, dude!
&lt;/pre&gt;



&lt;p&gt;
   Note, in the &lt;code&gt;hello&lt;/code&gt; example, the result of the block is the &lt;i&gt;value&lt;/i&gt; of the
   evaluation - that is, the value of the last expression evaluated. This is
   the also the default, so we don't need to (but could) write:
&lt;/p&gt;



&lt;pre class="example"&gt;#+begin_src python :results value
&lt;/pre&gt;



&lt;p&gt;
   The alternative is to use the (standard) &lt;i&gt;output&lt;/i&gt; of the function, which is
   activated with &lt;code&gt;:results output&lt;/code&gt;, e.g.:
&lt;/p&gt;



&lt;pre class="example"&gt;#+begin_src sh :results output
   echo "Hello $USER! Today is `date`"
#+end_src
&lt;/pre&gt;



&lt;p&gt;
   Moving to this block and pressing &lt;code&gt;C-c C=c&lt;/code&gt; would get you something like
   the following &amp;ndash; probably with a different username and time:
&lt;/p&gt;



&lt;pre class="example"&gt;˜#+results:
: Hello djcb! Today is Sun Feb 27 13:51:50 EET 2011
&lt;/pre&gt;



&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1_3" class="outline-3"&gt;
&lt;h3 id="sec-1_3"&gt;almost like functions &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1_3"&gt;


&lt;p&gt;
   &lt;code&gt;org-babel&lt;/code&gt; also allows you to refer to the code blocks from elsewhere in
   your document, by labeling your code-blocks with &lt;code&gt;srcname&lt;/code&gt;. Let's say we
   have some Ruby code to revert a string:
&lt;/p&gt;



&lt;pre class="example"&gt;#+begin_src ruby
def revert(s)
  if s == "" then 
    return ""
  else
    return s[-1].chr + revert(s.slice(0, s.length()-1))
  end
end
revert(str)
#+end_src
&lt;/pre&gt;



&lt;p&gt;
   We can now 'call' this block; note that we get the result of &lt;i&gt;evaluating the    block&lt;/i&gt;. So if you want to use the result of a function in the block, you also
   need to add the call to that function (see the last line).
&lt;/p&gt;
&lt;p&gt;
   Now, we can use:
&lt;/p&gt;



&lt;pre class="example"&gt;#+call: revert(str="VeryCoolStuff")
&lt;/pre&gt;



&lt;p&gt;
   And we get: 
&lt;/p&gt;



&lt;pre class="example"&gt;: ffutSlooCyreV
&lt;/pre&gt;



&lt;p&gt;
   Note, due to some limitation/bug in my version of &lt;code&gt;org-babel&lt;/code&gt;, the strings
   should not contain spaces or other special characters, so the following
   will give result in an error note:
&lt;/p&gt;



&lt;pre class="example"&gt;˜#+call: revert(str="Very Cool Stuff")
&lt;/pre&gt;



&lt;p&gt;
   Whenever you try to evaluate a code block, emacs will ask for confirmation --
   this is important, because of the obvious security implications of executing
   unknown code. Anyway, if you &lt;b&gt;do&lt;/b&gt; trust the code, you can use the following
   to skip the confirmation:
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; org-confirm-babel-evaluate nil)
&lt;/pre&gt;



&lt;p&gt;
   These simple examples do not really capture the power that &lt;code&gt;org-babel&lt;/code&gt;
   brings, but it's a start. There is quite a bit of &lt;a href="http://orgmode.org/worg/org-contrib/babel/"&gt;documentation&lt;/a&gt; for
   &lt;code&gt;org-babel&lt;/code&gt; to help you further. Finally, if you are already using
   &lt;code&gt;org-babel&lt;/code&gt;, feel free to share your experiences in the comments!
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/2556299854516999420/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=2556299854516999420' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/2556299854516999420'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/2556299854516999420'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2011/02/executable-source-code-blocks-with-org.html' title='executable source code blocks with org-babel'/><author><name>djcb</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_kGFGcbwevHE/R1Rgjkq0h3I/AAAAAAAAAMg/KLj-i9qWXGg/S220/rupert.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-6631512524066851924</id><published>2011-02-10T22:42:00.002+02:00</published><updated>2011-02-13T21:49:48.268+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><title type='text'>keeping your secrets secret</title><content type='html'>&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div class="outline-text-2" id="text-1"&gt;


&lt;p&gt;
If you want to keep your secrets secret, it is a good idea to &lt;i&gt;encrypt&lt;/i&gt; your
data; I usually do that for files with passwords for various services, banking
data, and so on. Since version 23, Emacs includes a package called &lt;a href="http://epg.sourceforge.jp/"&gt;EasyPG&lt;/a&gt; (an
interface to &lt;a href="http://www.gnupg.org/"&gt;GnuPG&lt;/a&gt;) which makes this seamless &amp;ndash; just make sure that you have
&lt;a href="http://www.gnupg.org/"&gt;GnuPG&lt;/a&gt; installed.
&lt;/p&gt;
&lt;p&gt;
It's easy to use EasyPG &amp;ndash; the only thing you need to do is adding the &lt;code&gt;.gpg&lt;/code&gt;
-extension to your files, and EasyPG will automatically encrypt/decrypt them
when writing/reading. So, for example, to create an encrypted &lt;code&gt;org-mode&lt;/code&gt;-file,
simply visit (&lt;code&gt;C-x C-f&lt;/code&gt;) a file with a name like &lt;code&gt;myfile.org.gpg&lt;/code&gt;; emacs opens
this in Org-Mode (just like any &lt;code&gt;.org&lt;/code&gt;-file). When you want to save the file,
emacs will ask you for a password, and with this same password, you can open
it again. Don't forget that password!
&lt;/p&gt;


&lt;/div&gt;

&lt;div id="outline-container-1_1" class="outline-3"&gt;
&lt;h3 id="sec-1_1"&gt;account data &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1_1"&gt;


&lt;p&gt;
You can store &lt;i&gt;any&lt;/i&gt; kind of secret data in your encrypted files. One type I
find particularly useful is to store &lt;i&gt;account data&lt;/i&gt; (user names, passwords)
for various services there. For example, I use the &lt;a href="http://blog.nethazard.net/identica-mode-for-emacs/"&gt;emacs identi.ca-mode client&lt;/a&gt;, which gets its account data through variables &lt;code&gt;identica-username&lt;/code&gt; and
&lt;code&gt;identica-password&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
I do not want to put this information in my main &lt;code&gt;.emacs&lt;/code&gt; file for safety
reasons, but instead, put it an encrypted file, together with the account data
for other services (mail, twitter etc.). Emacs' &lt;code&gt;require&lt;/code&gt; does not understand
encrypted files, but &lt;code&gt;load-library&lt;/code&gt; does. To deal with that, I have two files,
&lt;code&gt;secrets.el&lt;/code&gt; and &lt;code&gt;secrets.el.gpg&lt;/code&gt; (in my &lt;code&gt;load-path&lt;/code&gt;):
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;secrets.el
&lt;/span&gt;(load-library &lt;span class="org-string"&gt;"secrets.el.gpg"&lt;/span&gt;)
(&lt;span class="org-keyword"&gt;provide&lt;/span&gt; '&lt;span class="org-constant"&gt;secrets&lt;/span&gt;)
&lt;/pre&gt;



&lt;p&gt;
and
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;secrets.el.gpg
&lt;/span&gt;(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; identica-username &lt;span class="org-string"&gt;"djcb"&lt;/span&gt;
      identica-password &lt;span class="org-string"&gt;"$ekr3t"&lt;/span&gt;)
&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;... other passwords ...
&lt;/span&gt;&lt;/pre&gt;



&lt;p&gt;
Now, in my &lt;code&gt;.emacs&lt;/code&gt; I have a function for various services, like:
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;(&lt;span class="org-keyword"&gt;defun&lt;/span&gt; &lt;span class="org-function-name"&gt;start-identica&lt;/span&gt; ()
  (interactive)
  (&lt;span class="org-keyword"&gt;require&lt;/span&gt; '&lt;span class="org-constant"&gt;secrets&lt;/span&gt;)
  (identica-friends-timeline))
&lt;/pre&gt;



&lt;p&gt;
This will prompt me for the password, but only if I use anything that requires
the secret data, and &lt;b&gt;only once&lt;/b&gt; per session.
&lt;/p&gt;

&lt;p&gt;
&lt;b&gt;Update&lt;/b&gt;: as Richard notes in the comments, you can also use &lt;tt&gt;require&lt;/tt&gt; by
   explicitly specifying the filename (parameter two). That might actually be easier --
   thanks Richard!
&lt;/p&gt;

&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1_2" class="outline-3"&gt;
&lt;h3 id="sec-1_2"&gt;using public keys &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1_2"&gt;


&lt;p&gt;
By default, EasyPG performs &lt;a href="http://en.wikipedia.org/wiki/Symmetric_encryption"&gt;symmetric encryption&lt;/a&gt;; if you want to use &lt;a href="http://en.wikipedia.org/wiki/Public-key_cryptography"&gt;public key encryption&lt;/a&gt; instead (useful when you want to share the encrypted files with
others), you can use:
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;'silent to use symmetric encryption
&lt;/span&gt;&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;nil to ask for users unless specified
&lt;/span&gt;&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;t to always ask for a user
&lt;/span&gt;(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; epa-file-select-keys t) 
&lt;/pre&gt;



&lt;p&gt;
The 'users' in this snippet are the people in your GnuPG-keyring &amp;ndash; EasyPG
lists your keyring inhabitants, allowing for easy selection. You can also
specify the people who can decrypt your file by putting something like the
following at the beginning of the file you want to encrypt.
&lt;/p&gt;



&lt;pre class="src src-text"&gt;# -*- epa-file-encrypt-to: ("foo@bar.org") -*-
&lt;/pre&gt;



&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1_3" class="outline-3"&gt;
&lt;h3 id="sec-1_3"&gt;so &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1_3"&gt;


&lt;p&gt;
EasyPG brings more functionality for encryption, decryption, signing, managing
your keyring and so on, but I haven't used that much yet. Anyhow, the
automatic support for reading/writing file is really nice.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/6631512524066851924/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=6631512524066851924' title='16 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/6631512524066851924'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/6631512524066851924'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2011/02/keeping-your-secrets-secret.html' title='keeping your secrets secret'/><author><name>djcb</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_kGFGcbwevHE/R1Rgjkq0h3I/AAAAAAAAAMg/KLj-i9qWXGg/S220/rupert.jpg'/></author><thr:total>16</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-246655838826915563</id><published>2011-02-02T20:40:00.000+02:00</published><updated>2011-02-02T20:40:56.298+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><category scheme='http://www.blogger.com/atom/ns#' term='erc'/><title type='text'>extending ERC with your own commands</title><content type='html'>&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div class="outline-text-2" id="text-1"&gt;


&lt;p&gt;
&lt;code&gt;ERC&lt;/code&gt; is the leading Emacs-based &lt;a href="http://en.wikipedia.org/wiki/IRC"&gt;IRC&lt;/a&gt;-client; I already discussed ERC &lt;a href="http://emacs-fu.blogspot.com/2009/06/erc-emacs-irc-client.html"&gt;before&lt;/a&gt;. I
have been using ERC a &lt;i&gt;lot&lt;/i&gt; in recent times, as it's an essential way to
communicate at work with team members in remote locations. There are other
IRC-clients &amp;ndash; most people around me seem to use either &lt;code&gt;irssi&lt;/code&gt; or &lt;code&gt;xchat&lt;/code&gt;,
but these don't integrate so well with my emacs-based workflow, the easy with
which it can be extended to do exactly what I want; in this although they have
their own strenghts. One of the great strengths of ERC is article I give some
examples.
&lt;/p&gt;
&lt;p&gt;
Apart from chatting, you can send commands (&lt;a href="http://en.wikipedia.org/wiki/List_of_Internet_Relay_Chat_commands"&gt;long list&lt;/a&gt;) to the IRC-server,
for example to request information about other users, change your 'nick',
leave the channel, and so on. As in most IRC-clients, you can send these
commands with ERC by prefixing them with &lt;code&gt;/&lt;/code&gt;, so you'd type:
&lt;/p&gt;



&lt;pre class="example"&gt;/nick ninjaturtle
&lt;/pre&gt;



&lt;p&gt;
to change your nickname.
&lt;/p&gt;
&lt;p&gt;
The nice thing about ERC is how easy it to add your own commands to this. In
your &lt;code&gt;.emacs&lt;/code&gt; (after loading ERC), you can add something like:
&lt;/p&gt;



&lt;pre class="src src-elisp"&gt;(&lt;span class="org-keyword"&gt;defun&lt;/span&gt; &lt;span class="org-function-name"&gt;erc-cmd-MYSYSTEM&lt;/span&gt; ()
  &lt;span class="org-doc"&gt;"show some information about my system"&lt;/span&gt;
  (&lt;span class="org-keyword"&gt;let&lt;/span&gt; ((str (shell-command-to-string &lt;span class="org-string"&gt;"uname -a"&lt;/span&gt;)))
    (&lt;span class="org-keyword"&gt;when&lt;/span&gt; str (erc-send-message str))))
&lt;/pre&gt;



&lt;p&gt;
Or, add add a function called &lt;code&gt;erc-cmd-XXXX&lt;/code&gt; (with the &lt;code&gt;XXXX&lt;/code&gt; being the
command name in capitals, will add command &lt;code&gt;XXXX&lt;/code&gt;, which you can invoke with
&lt;code&gt;/XXXX&lt;/code&gt; or &lt;code&gt;/xxxx&lt;/code&gt;). So, with the above function, I can now do something like:
&lt;/p&gt;



&lt;pre class="example"&gt;ERC&amp;gt; /mysystem
&amp;lt;djcb&amp;gt; Linux cthulhu 2.6.35-25-generic #44 SMP Fri Jan 21 17:40:48 UTC
       2011 i686 GNU/Linux
&lt;/pre&gt;



&lt;p&gt;
Let's look at some other (somewhat) useful command: &lt;code&gt;/calc&lt;/code&gt;; again, just a
small example, I'm sure something can come up with something a bit more
elegant - perhaps using emacs' built-in &lt;code&gt;calc&lt;/code&gt;.
&lt;/p&gt;



&lt;pre class="src src-elisp"&gt;(&lt;span class="org-keyword"&gt;defun&lt;/span&gt; &lt;span class="org-function-name"&gt;erc-cmd-CALC&lt;/span&gt; (&lt;span class="org-type"&gt;&amp;amp;rest&lt;/span&gt; args)
  &lt;span class="org-doc"&gt;"calculate value of some expression using bc"&lt;/span&gt;
  (&lt;span class="org-keyword"&gt;let&lt;/span&gt; ((expr (mapconcat 'identity args &lt;span class="org-string"&gt;" "&lt;/span&gt;)))
    (&lt;span class="org-keyword"&gt;when&lt;/span&gt; (length expr)
      (&lt;span class="org-keyword"&gt;let&lt;/span&gt; ((result (shell-command-to-string (concat &lt;span class="org-string"&gt;"echo '"&lt;/span&gt; expr &lt;span class="org-string"&gt;"' | bc "&lt;/span&gt;))))
        (&lt;span class="org-keyword"&gt;when&lt;/span&gt; result (erc-send-message (concat expr &lt;span class="org-string"&gt;" = "&lt;/span&gt; result)))))))
&lt;/pre&gt;






&lt;pre class="example"&gt;ERC&amp;gt; /calc 2 * (3 + 4) / 7
&amp;lt;djcb&amp;gt; 2 * (3 + 4) / 7  = 2
&lt;/pre&gt;



&lt;p&gt;
Now, a small warning, just because it's &lt;i&gt;easy&lt;/i&gt; to dump the output of, say,
&lt;a href="http://en.wikipedia.org/wiki/Cowsay"&gt;cowsay&lt;/a&gt; in an IRC-channel using your own &lt;code&gt;/cowsay&lt;/code&gt; command, does not mean it is
a good idea &amp;ndash; in fact, using something like that is guaranteed to get you
kicked out fairly quickly from many channels.
&lt;/p&gt;
&lt;p&gt;
That being said, I'm sure many people have come up with much more clever
things than the examples here; feel free to share your inventions in the
comments!
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/246655838826915563/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=246655838826915563' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/246655838826915563'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/246655838826915563'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2011/02/extending-erc-with-your-own-commands.html' title='extending ERC with your own commands'/><author><name>djcb</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_kGFGcbwevHE/R1Rgjkq0h3I/AAAAAAAAAMg/KLj-i9qWXGg/S220/rupert.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-7583600805500387232</id><published>2011-01-06T17:47:00.002+02:00</published><updated>2011-01-06T17:47:52.395+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><category scheme='http://www.blogger.com/atom/ns#' term='basic'/><title type='text'>setting the frame title</title><content type='html'>&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div class="outline-text-2" id="text-1"&gt;


&lt;p&gt;
The 'frame title' (window title) that emacs uses in graphical environments
defaults to something like &lt;code&gt;emacs@hostname&lt;/code&gt;. 
&lt;/p&gt;
&lt;p&gt;
Of course emacs lets us customize this, by changing the value of
&lt;code&gt;frame-title-format&lt;/code&gt;. Emacs accepts many different things there, (see the
documentation for &lt;code&gt;frame-title-format&lt;/code&gt; and &lt;code&gt;mode-line-format&lt;/code&gt; for that), but
let's look at an example.
&lt;/p&gt;
&lt;p&gt;
Instead of the default &lt;code&gt;emacs@hostname&lt;/code&gt;, I find it more useful to include the
name of the file I'm working on instead, or, in case of non-file buffers, the
buffer name. To do this, I have something like the following in my &lt;code&gt;.emacs&lt;/code&gt;:
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; frame-title-format
  '(&lt;span class="org-string"&gt;""&lt;/span&gt; invocation-name &lt;span class="org-string"&gt;": "&lt;/span&gt;(&lt;span class="org-builtin"&gt;:eval&lt;/span&gt; (&lt;span class="org-keyword"&gt;if&lt;/span&gt; (buffer-file-name)
                (abbreviate-file-name (buffer-file-name))
                  &lt;span class="org-string"&gt;"%b"&lt;/span&gt;))))
&lt;/pre&gt;



&lt;p&gt;
As you see, &lt;code&gt;frame-title-format&lt;/code&gt; is a template for the items that are present
in the title bar; i.e.. emacs concatenates the items in the list, and it
supports various &lt;code&gt;%&lt;/code&gt;-constructs, which are replaced with actual values; see
below.
&lt;/p&gt;
&lt;p&gt;
In addition to the &lt;code&gt;%&lt;/code&gt;-constructs, you can use &lt;code&gt;:eval&lt;/code&gt; to make emacs evaluate
the expression whenever it wants to update the title bar.
&lt;/p&gt;
&lt;p&gt;
&lt;code&gt;invocation-name&lt;/code&gt; is the name of the emacs binary.
&lt;/p&gt;
&lt;p&gt;
&lt;code&gt;abbreviate-file-name&lt;/code&gt; replaces the home directory part in file names with
&lt;code&gt;~&lt;/code&gt;; for very deep paths it might be nice to do some abbreviation as well as
some shells do; this is left as an exercise to the reader :)
&lt;/p&gt;
&lt;p&gt;
You can experiment with some other things to put in &lt;code&gt;frame-title-format&lt;/code&gt;;
use the &lt;code&gt;:eval&lt;/code&gt; construct as above to use emacs-lisp functions, and the
various &lt;code&gt;%&lt;/code&gt;-specifiers which are replaced by certain values; the emacs
documentation lists the following:
&lt;/p&gt;



&lt;pre class="src src-text"&gt;%b -- print buffer name.      %f -- print visited file name.
%F -- print frame name.
%* -- print %, * or hyphen.   %+ -- print *, % or hyphen.
      %&amp;amp; is like %*, but ignore read-only-ness.
      % means buffer is read-only and * means it is modified.
      For a modified read-only buffer, %* gives % and %+ gives *.
%s -- print process status.
%i -- print the size of the buffer.
%I -- like %i, but use k, M, G, etc., to abbreviate.
%p -- print percent of buffer above top of window, or Top, Bot or All.
%P -- print percent of buffer above bottom of window, perhaps plus Top,
      or print Bottom or All.
%n -- print Narrow if appropriate.
%t -- visited file is text or binary (if OS supports this distinction).
%z -- print mnemonics of keyboard, terminal, and buffer coding systems.
%Z -- like %z, but including the end-of-line format.
%e -- print error message about full memory.
%@ -- print @ or hyphen.  @ means that default-directory is on a
      remote machine.
%[ -- print one [ for each recursive editing level.  %] similar.
%% -- print %.   %- -- print infinitely many dashes.
Decimal digits after the % specify field width to which to pad.
&lt;/pre&gt;



&lt;p&gt;
So, if we'd like to include the host (system) name and some indication of the
status of this buffer, we could do something like:
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; frame-title-format
  '(&lt;span class="org-string"&gt;"emacs%@"&lt;/span&gt; (&lt;span class="org-builtin"&gt;:eval&lt;/span&gt; (system-name)) &lt;span class="org-string"&gt;": "&lt;/span&gt; (&lt;span class="org-builtin"&gt;:eval&lt;/span&gt; (&lt;span class="org-keyword"&gt;if&lt;/span&gt; (buffer-file-name)
                (abbreviate-file-name (buffer-file-name))
                  &lt;span class="org-string"&gt;"%b"&lt;/span&gt;)) &lt;span class="org-string"&gt;" [%*]"&lt;/span&gt;))
&lt;/pre&gt;



&lt;p&gt;
Of course, some of the information is available elsewhere already, but it
might be clearer in the frame-title. Or not &amp;ndash; there's a lot of room for
tweaking and experimentation here.
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/7583600805500387232/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=7583600805500387232' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/7583600805500387232'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/7583600805500387232'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2011/01/setting-frame-title.html' title='setting the frame title'/><author><name>djcb</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_kGFGcbwevHE/R1Rgjkq0h3I/AAAAAAAAAMg/KLj-i9qWXGg/S220/rupert.jpg'/></author><thr:total>12</thr:total></entry></feed>