<?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: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>2012-02-02T02:22:38.801+02:00</updated><category term='beamer'/><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?max-results=100'/><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=101&amp;max-results=100'/><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>128</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><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;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-5784078687169335944?l=emacs-fu.blogspot.com' alt='' /&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='1 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>1</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;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-6841811278979936496?l=emacs-fu.blogspot.com' alt='' /&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='8 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>8</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;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-1094708036403372928?l=emacs-fu.blogspot.com' alt='' /&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='12 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>12</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;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-3400345349577998800?l=emacs-fu.blogspot.com' alt='' /&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='17 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>17</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;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-1414291109911962066?l=emacs-fu.blogspot.com' alt='' /&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='12 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>12</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;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-2213113953493134138?l=emacs-fu.blogspot.com' alt='' /&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='3 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>3</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;
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-981514934179643003?l=emacs-fu.blogspot.com' alt='' /&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='16 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>16</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;
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-8218094139540239299?l=emacs-fu.blogspot.com' alt='' /&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='9 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>9</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;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-6798875775963558440?l=emacs-fu.blogspot.com' alt='' /&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='17 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>17</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;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-7951873464428828260?l=emacs-fu.blogspot.com' alt='' /&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='15 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>15</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;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-1435692343654093608?l=emacs-fu.blogspot.com' alt='' /&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='11 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>11</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;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-4255444389172592100?l=emacs-fu.blogspot.com' alt='' /&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;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-2556299854516999420?l=emacs-fu.blogspot.com' alt='' /&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='4 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>4</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;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-6631512524066851924?l=emacs-fu.blogspot.com' alt='' /&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='14 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>14</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;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-246655838826915563?l=emacs-fu.blogspot.com' alt='' /&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;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-7583600805500387232?l=emacs-fu.blogspot.com' alt='' /&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='9 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>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-9171742843682944173</id><published>2010-12-30T17:18:00.000+02:00</published><updated>2010-12-30T17:18:33.425+02: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'>color theming with 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;
The emacs development team is hard at work on emacs 24. As far as I know,
there is no planned date for it yet. I'll write more about all the new cool
things when we're a bit closer to the release date, but I'd like to highlight
&lt;i&gt;emacs 24 color-theming&lt;/i&gt; already, as it's an area people outside the core
development theme should be able to contribute to as well.
&lt;/p&gt;
&lt;p&gt;
Here at Emacs-fu, we already discussed &lt;a href="http://emacs-fu.blogspot.com/2009/03/color-theming.html"&gt;color-theming&lt;/a&gt; and in particular the
&lt;a href="http://emacs-fu.blogspot.com/2010/04/zenburn-color-theme.html"&gt;zenburn color theme&lt;/a&gt;; this was all based on the &lt;code&gt;color-theme&lt;/code&gt;-package. While
being popular, there were a few problems with that package, which is why
emacs-24 comes with a new scheme for doing this.
&lt;/p&gt;
&lt;p&gt;
The current development versions of emacs ship with a few themes (&lt;code&gt;tango&lt;/code&gt;,
&lt;code&gt;tango-dark&lt;/code&gt; and &lt;code&gt;wheatgrass&lt;/code&gt;), which you can activate with &lt;code&gt;M-x load-theme&lt;/code&gt;.
It would be great to include some more color themes, and to encourage this,
emacs maintainer Chong Yidong has written the &lt;a href="http://elpa.gnu.org/themes/"&gt;GNU Emacs Theme Generator&lt;/a&gt;
(currently in bèta), which helps you in the process of making a simple
theme. This tool currently only support changing colors, and not e.g. the
boldness or slant, but it's a nice way to get started, and to immediately see
the results.
&lt;/p&gt;
&lt;p&gt;
For more complex theming, there is &lt;code&gt;M-x customize-create-theme&lt;/code&gt;; however, that
is built on the (in my opinion) cumbersome &lt;i&gt;customize&lt;/i&gt;-interface, so I'll
probably start by creating a basic theme with the web tool, and then edit it
by hand. If you design some attractive color theme and would like to propose
it for inclusion in emacs 24, you can send it to &lt;a href="mailto:emacs-devel@gnu.org"&gt;emacs-devel&lt;/a&gt;.
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-9171742843682944173?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/9171742843682944173/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=9171742843682944173' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/9171742843682944173'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/9171742843682944173'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2010/12/color-theming-with-emacs-24.html' title='color theming with 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>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-961108549828550020</id><published>2010-12-01T00:20:00.003+02:00</published><updated>2010-12-01T12:12:23.701+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='web'/><title type='text'>conkeror: web browsing the emacs way</title><content type='html'>&lt;div class="outline-2" id="outline-container-1"&gt;
&lt;div class="outline-text-2" id="text-1"&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/_kGFGcbwevHE/TPV4YeNnx_I/AAAAAAAAAhI/AkcD7kntVTQ/s1600/Screenshot-1.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="235" src="http://1.bp.blogspot.com/_kGFGcbwevHE/TPV4YeNnx_I/AAAAAAAAAhI/AkcD7kntVTQ/s320/Screenshot-1.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
Web browsing is one of the few computer-based activities for which I usually
do &lt;i&gt;not&lt;/i&gt; use emacs. Of course, there are of emacs-based browsers like &lt;a href="http://emacs-w3m.namazu.org/"&gt;w3m&lt;/a&gt;,
which is pretty good. But for the 21st-century web, a text-mode browser is a
bit limited. There are some efforts underway to integrate a graphical web
browser experience in emacs (e.g., using &lt;code&gt;Xembed&lt;/code&gt;), but it will take a while
before that is ready.
&lt;br /&gt;
The next best thing to web browsing with emacs, is a browser that is
&lt;i&gt;inspired by&lt;/i&gt; emacs. Such a browser &lt;i&gt;exists&lt;/i&gt;: it's called &lt;a href="http://conkeror.org/"&gt;conkeror&lt;/a&gt; (not to be
confused with KDE's &lt;i&gt;Konqueror&lt;/i&gt;). &lt;code&gt;conkeror&lt;/code&gt; is a Mozilla-based browser that
brings an emacs-like experience to web browsing. I've been using it for more
than a year now as my primary browser, and I am quite happy with it.
&lt;br /&gt;
Conkeror is a user-interface for the normal Mozilla/Firefox engine
(&lt;code&gt;xulrunner&lt;/code&gt;); this means that all those websites that work with Firefox, work
just as well in &lt;code&gt;conkeror&lt;/code&gt;, including things like ad-blockers, Java, Flash
etc. and many plug-ins. This is a very important point for me.
&lt;br /&gt;
If you like emacs, you'll probably also like conkeror. For starters, it uses
many of the same key bindings – &lt;code&gt;C-x C-f&lt;/code&gt; will open a url in a new buffer
(tab), &lt;code&gt;C-x 5 2&lt;/code&gt; will open a new window (frame), I can inspect a key-binding
with &lt;code&gt;C-h k&lt;/code&gt;… and so on. Some of the single-key shortcuts are the same as
those in &lt;code&gt;w3m&lt;/code&gt;, like &lt;code&gt;g&lt;/code&gt; to &lt;i&gt;go to&lt;/i&gt; a webpage, or &lt;code&gt;B&lt;/code&gt; to &lt;i&gt;go back&lt;/i&gt;. Conkeror
is fully keyboard-driven; it allows you do almost anything on the web without
using the mouse – it can overlay numbers on items in a webpage so you can
interact with them by their number. Of course, you can still use a mouse if
you want, too.
&lt;br /&gt;
The &lt;a href="http://www.conkeror.org/"&gt;conkeror wiki&lt;/a&gt; gives many more examples. It also discusses installation in
quite some detail, which makes life a bit easier for me :) Instead, I will
just list a couple of the customizations I have made and encourage you to try
for yourself.
&lt;/div&gt;
&lt;div class="outline-3" id="outline-container-1_1"&gt;
&lt;h3 id="sec-1_1"&gt;

configuration &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1_1"&gt;
Like emacs, conkeror is very configurable. The big difference is that
conkeror uses Javascript instead of Elisp for the configuration; however,
the concepts and naming should be familiar for emacs-users. Conkeror's
equivalent of &lt;code&gt;~/.emacs&lt;/code&gt; is &lt;code&gt;~/.conkerorrc&lt;/code&gt;. Below are some snippets from my
setup, that can hopefully help you to create your &lt;i&gt;Perfect Browser&lt;/i&gt; ™; all
examples below are based on the latest development version of Conkeror, as
per end of November 2010.
&lt;br /&gt;
First, some basics:
&lt;br /&gt;
&lt;pre class="src src-javascript"&gt;&lt;span class="org-comment-delimiter"&gt;//&lt;/span&gt;&lt;span class="org-comment"&gt;allow for 'contrib' stuff
&lt;/span&gt;load_paths.unshift(&lt;span class="org-string"&gt;"chrome://conkeror-contrib/content/"&lt;/span&gt;);

&lt;span class="org-comment-delimiter"&gt;// &lt;/span&gt;&lt;span class="org-comment"&gt;teach me something whenever I start my browser
&lt;/span&gt;homepage = &lt;span class="org-string"&gt;"http://en.wikipedia.org/wiki/Special:Random"&lt;/span&gt;;

&lt;span class="org-comment-delimiter"&gt;// &lt;/span&gt;&lt;span class="org-comment"&gt;give me new tabs; open buffers (tabs) in the background
&lt;/span&gt;require(&lt;span class="org-string"&gt;"new-tabs.js"&lt;/span&gt;);
require(&lt;span class="org-string"&gt;"clicks-in-new-buffer.js"&lt;/span&gt;);
clicks_in_new_buffer_target = OPEN_NEW_BUFFER_BACKGROUND; 
clicks_in_new_buffer_button = 1; &lt;span class="org-comment-delimiter"&gt;//  &lt;/span&gt;&lt;span class="org-comment"&gt;midclick links in new buffers with
&lt;/span&gt;
&lt;span class="org-comment-delimiter"&gt;// &lt;/span&gt;&lt;span class="org-comment"&gt;auto completion in the minibuffer
&lt;/span&gt;minibuffer_auto_complete_default = &lt;span class="org-constant"&gt;true&lt;/span&gt;;
url_completion_use_history = &lt;span class="org-constant"&gt;true&lt;/span&gt;; &lt;span class="org-comment-delimiter"&gt;// &lt;/span&gt;&lt;span class="org-comment"&gt;should work since bf05c87405
&lt;/span&gt;url_completion_use_bookmarks = &lt;span class="org-constant"&gt;true&lt;/span&gt;;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="outline-4" id="outline-container-1_1_1"&gt;
&lt;h4 id="sec-1_1_1"&gt;

modeline customization &lt;/h4&gt;
&lt;div class="outline-text-4" id="text-1_1_1"&gt;
As in emacs, you can customize the modeline. Also in good emacs tradition,
this is far from intuitive…
&lt;br /&gt;
&lt;pre class="src src-javascript"&gt;require(&lt;span class="org-string"&gt;"mode-line.js"&lt;/span&gt;);
&lt;span class="org-comment-delimiter"&gt;// &lt;/span&gt;&lt;span class="org-comment"&gt;funky icons in the modeline
&lt;/span&gt;require(&lt;span class="org-string"&gt;"mode-line-buttons.js"&lt;/span&gt;);
mode_line_add_buttons(standard_mode_line_buttons, &lt;span class="org-constant"&gt;true&lt;/span&gt;);

&lt;span class="org-comment-delimiter"&gt;// &lt;/span&gt;&lt;span class="org-comment"&gt;we'd like to see the # of buffers being loaded 
&lt;/span&gt;add_hook(&lt;span class="org-string"&gt;"mode_line_hook"&lt;/span&gt;, mode_line_adder(loading_count_widget), &lt;span class="org-constant"&gt;true&lt;/span&gt;);
&lt;span class="org-comment-delimiter"&gt;// &lt;/span&gt;&lt;span class="org-comment"&gt;we don't need a clock
&lt;/span&gt;remove_hook(&lt;span class="org-string"&gt;"mode_line_hook"&lt;/span&gt;, mode_line_adder(clock_widget));
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-4" id="outline-container-1_1_2"&gt;
&lt;h4 id="sec-1_1_2"&gt;

bookmarks &lt;/h4&gt;
&lt;div class="outline-text-4" id="text-1_1_2"&gt;
Plain-old bookmarks are easy to add with &lt;code&gt;define_webjump&lt;/code&gt; – and you can just
bind them to a short string. You can then 'jump' to the corresponding website by
pressing &lt;code&gt;g&lt;/code&gt; and then this short string. For example, to go to &lt;i&gt;Emacs-Fu&lt;/i&gt;, you
could type &lt;code&gt;g efu RET&lt;/code&gt;. No mousing around needed.
&lt;br /&gt;
&lt;pre class="src src-javascript"&gt;&lt;span class="org-comment-delimiter"&gt;// &lt;/span&gt;&lt;span class="org-comment"&gt;some bookmarks
&lt;/span&gt;define_webjump(&lt;span class="org-string"&gt;"conk"&lt;/span&gt;,  &lt;span class="org-string"&gt;"http://conkeror.org"&lt;/span&gt;);
define_webjump(&lt;span class="org-string"&gt;"efu"&lt;/span&gt;,   &lt;span class="org-string"&gt;"http://emacs-fu.blogspot.com"&lt;/span&gt;);
define_webjump(&lt;span class="org-string"&gt;"lkml"&lt;/span&gt;,  &lt;span class="org-string"&gt;"http://lkml.org"&lt;/span&gt;);
define_webjump(&lt;span class="org-string"&gt;"ew"&lt;/span&gt;,    &lt;span class="org-string"&gt;"http://emacswiki.org"&lt;/span&gt;);
&lt;span class="org-comment-delimiter"&gt;// &lt;/span&gt;&lt;span class="org-comment"&gt;...
&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-4" id="outline-container-1_1_3"&gt;
&lt;h4 id="sec-1_1_3"&gt;

smart links &lt;/h4&gt;
&lt;div class="outline-text-4" id="text-1_1_3"&gt;
Smartlinks are just like normal bookmarks, which the one difference that
they contain an &lt;code&gt;%s&lt;/code&gt;-parameter which will be replaced by whatever you type
&lt;i&gt;after&lt;/i&gt; the name of the bookmark. Thus, &lt;code&gt;g imdb grande bouffe RET&lt;/code&gt; would
take you to the IMDB-page about the movie &lt;i&gt;La Grande Bouffe&lt;/i&gt;. 
&lt;br /&gt;
Some examples:
&lt;br /&gt;
&lt;pre class="src src-javascript"&gt;define_webjump(&lt;span class="org-string"&gt;"so"&lt;/span&gt;,    &lt;span class="org-string"&gt;"http://stackoverflow.com/search?q=%s"&lt;/span&gt;);
define_webjump(&lt;span class="org-string"&gt;"yts"&lt;/span&gt;,   &lt;span class="org-string"&gt;"http://www.youtube.com/results?search_query=%s&amp;amp;aq=f"&lt;/span&gt;);
define_webjump(&lt;span class="org-string"&gt;"imbd"&lt;/span&gt;,  &lt;span class="org-string"&gt;"http://www.imdb.com/find?s=all&amp;amp;q=%s"&lt;/span&gt;);
&lt;span class="org-comment-delimiter"&gt;// &lt;/span&gt;&lt;span class="org-comment"&gt;...
&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-4" id="outline-container-1_1_4"&gt;
&lt;h4 id="sec-1_1_4"&gt;

integration with emacs &lt;/h4&gt;
&lt;div class="outline-text-4" id="text-1_1_4"&gt;
Another useful feature in &lt;code&gt;conkeror&lt;/code&gt; is the ability to interact with Emacs
(or any other text editor), so you can use emacs for writing text in web
pages; for example, when you're using emacs-daemon (&lt;a href="http://emacs-fu.blogspot.com/2009/02/emacs-daemon.html"&gt;you should&lt;/a&gt;), you could
can add the below, and &lt;code&gt;C-i&lt;/code&gt; will then take you to emacs whenever you are in
a text field in a web page.
&lt;br /&gt;
&lt;pre class="src src-javascript"&gt;editor_shell_command = &lt;span class="org-string"&gt;"emacsclient -c"&lt;/span&gt;;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-4" id="outline-container-1_1_5"&gt;
&lt;h4 id="sec-1_1_5"&gt;

adding your own functions &lt;/h4&gt;
&lt;div class="outline-text-4" id="text-1_1_5"&gt;
It's fairly easy to add your own functions; admittedly, I'm still at the
beginning stages with that, but it's not too hard to combine the internal
function, and assign them to key bindings. Some examples:
&lt;br /&gt;
&lt;pre class="src src-javascript"&gt;&lt;span class="org-comment-delimiter"&gt;// &lt;/span&gt;&lt;span class="org-comment"&gt;copy url with C-c u
&lt;/span&gt;interactive(&lt;span class="org-string"&gt;"copy-url"&lt;/span&gt;,
        &lt;span class="org-string"&gt;"Copy the current buffer's URL to the clipboard"&lt;/span&gt;,
        &lt;span class="org-keyword"&gt;function&lt;/span&gt;(&lt;span class="org-variable-name"&gt;I&lt;/span&gt;) {
            &lt;span class="org-keyword"&gt;var&lt;/span&gt; &lt;span class="org-variable-name"&gt;text&lt;/span&gt; = I.window.buffers.current.document.location.href;
            writeToClipboard(text);
            I.window.minibuffer.message(&lt;span class="org-string"&gt;"copied: "&lt;/span&gt; + text);
        }
);
define_key(default_global_keymap, &lt;span class="org-string"&gt;"C-c u"&lt;/span&gt;, &lt;span class="org-string"&gt;"copy-url"&lt;/span&gt;);


&lt;span class="org-comment-delimiter"&gt;// &lt;/span&gt;&lt;span class="org-comment"&gt;reload conkerorrc with C-c r
&lt;/span&gt;interactive(&lt;span class="org-string"&gt;"reload-config"&lt;/span&gt;, &lt;span class="org-string"&gt;"reload conkerorrc"&lt;/span&gt;,
       &lt;span class="org-keyword"&gt;function&lt;/span&gt;(&lt;span class="org-variable-name"&gt;I&lt;/span&gt;) {
          load_rc();
          I.window.minibuffer.message(&lt;span class="org-string"&gt;"config reloaded"&lt;/span&gt;);
       }
);
define_key(default_global_keymap, &lt;span class="org-string"&gt;"C-c r"&lt;/span&gt;, &lt;span class="org-string"&gt;"reload-config"&lt;/span&gt;);
&lt;/pre&gt;
It's not necessarily so easy to find the exact functions / objects you need
to accomplish what you want. There's a certain learning curve – just like
when using emacs.
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-4" id="outline-container-1_1_6"&gt;
&lt;h4 id="sec-1_1_6"&gt;

integration with org-mode &lt;/h4&gt;
&lt;div class="outline-text-4" id="text-1_1_6"&gt;
The integration with emacs can go further than merely editing text fields
though; it's possible to integrate &lt;code&gt;conkeror&lt;/code&gt; with &lt;code&gt;org-mode&lt;/code&gt; in emacs; I
have the following in my &lt;code&gt;.conkerorrc&lt;/code&gt; (this requires emacs-daemon), based
on the code in &lt;a href="http://orgmode.org/worg/org-contrib/org-protocol.php"&gt;WOrg&lt;/a&gt;:
&lt;br /&gt;
&lt;pre class="src src-javascript"&gt;&lt;span class="org-comment-delimiter"&gt;// &lt;/span&gt;&lt;span class="org-comment"&gt;org-protocol stuff
&lt;/span&gt;&lt;span class="org-keyword"&gt;function&lt;/span&gt; &lt;span class="org-function-name"&gt;org_capture&lt;/span&gt; (&lt;span class="org-variable-name"&gt;url&lt;/span&gt;, &lt;span class="org-variable-name"&gt;title&lt;/span&gt;, &lt;span class="org-variable-name"&gt;selection&lt;/span&gt;, &lt;span class="org-variable-name"&gt;window&lt;/span&gt;) {
    &lt;span class="org-keyword"&gt;var&lt;/span&gt; &lt;span class="org-variable-name"&gt;cmd_str&lt;/span&gt; =
        &lt;span class="org-string"&gt;'emacsclient \"org-protocol:/capture:/w/'&lt;/span&gt;+url+&lt;span class="org-string"&gt;'/'&lt;/span&gt;+title+&lt;span class="org-string"&gt;'/'&lt;/span&gt;+selection+&lt;span class="org-string"&gt;'\"'&lt;/span&gt;;
    &lt;span class="org-keyword"&gt;if&lt;/span&gt; (window != &lt;span class="org-constant"&gt;null&lt;/span&gt;) {
      window.minibuffer.message(&lt;span class="org-string"&gt;'Issuing '&lt;/span&gt; + cmd_str);
    }
    shell_command_blind(cmd_str);
}

interactive(&lt;span class="org-string"&gt;"org-capture"&lt;/span&gt;, &lt;span class="org-string"&gt;"Clip url, title, and selection to capture via org-protocol"&lt;/span&gt;,
          &lt;span class="org-keyword"&gt;function&lt;/span&gt; (&lt;span class="org-variable-name"&gt;I&lt;/span&gt;) {
              org_capture(encodeURIComponent(I.buffer.display_uri_string),
                        encodeURIComponent(I.buffer.document.title),
                                encodeURIComponent(I.buffer.top_frame.getSelection()),
                        I.window);
          });
&lt;span class="org-comment-delimiter"&gt;// &lt;/span&gt;&lt;span class="org-comment"&gt;capture with C-c c
&lt;/span&gt;define_key(content_buffer_normal_keymap, &lt;span class="org-string"&gt;"C-c c"&lt;/span&gt;, &lt;span class="org-string"&gt;"org-capture"&lt;/span&gt;);
&lt;/pre&gt;
Then, on the emacs-side (in your &lt;code&gt;.emacs&lt;/code&gt;), you should have a capture
template for this; for example:
&lt;br /&gt;
&lt;pre class="src src-emacs-list"&gt;;; ;; the 'w' corresponds with the 'w' used before as in:
;;   emacsclient \"org-protocol:/capture:/w/  [...]
(setq org-capture-templates
  '(
     (&lt;span class="org-string"&gt;"w"&lt;/span&gt; &lt;span class="org-string"&gt;""&lt;/span&gt; entry ;; 'w' for 'org-protocol'
       (file+headline &lt;span class="org-string"&gt;"www.org"&lt;/span&gt; &lt;span class="org-string"&gt;"Notes"&lt;/span&gt;)
       &lt;span class="org-string"&gt;"* %^{Title}\n\n  Source: %u, %c\n\n  %i"&lt;/span&gt;)
     ;; other templates
))
&lt;/pre&gt;
Now, when in &lt;code&gt;conkeror&lt;/code&gt;, you can select some text, push &lt;code&gt;C-c c&lt;/code&gt; ('capture');
emacs will offer you to save this text, including a link to the source, the
date and so on, and saves it for later retrieval. I really love this
feature!
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3" id="outline-container-1_2"&gt;
&lt;h3 id="sec-1_2"&gt;

so… &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1_2"&gt;
These were just a couple of the many things you can do with &lt;code&gt;conkeror&lt;/code&gt;;
there's so much potential here. I haven't discussed many of the other
powerful features, such as the page-specific modes, that give special
features to specific websites, be it GMail or Wikipedia.
&lt;br /&gt;
I've been using this fine browser for a year or so now, and I really like
it. There are a few rough edges here and there, but it's quite amazing what
the small development team has accomplished. I heartily recommend it – for
web-browsing the emacs-way, there's simple no better alternative.
&lt;br /&gt;
Finally, if you're using &lt;code&gt;conkeror&lt;/code&gt; already, and have some clever tricks
you'd like to share, feel free to do so in the comments.
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-961108549828550020?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/961108549828550020/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=961108549828550020' title='25 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/961108549828550020'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/961108549828550020'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2010/12/conkeror-web-browsing-emacs-way.html' title='conkeror: web browsing the emacs way'/><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/_kGFGcbwevHE/TPV4YeNnx_I/AAAAAAAAAhI/AkcD7kntVTQ/s72-c/Screenshot-1.png' height='72' width='72'/><thr:total>25</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-120766809928533795</id><published>2010-11-15T22:33:00.005+02:00</published><updated>2010-11-16T18:02:45.810+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'>undo</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;
One of the advantages that text-editors have over daily life is the ease of
&lt;i&gt;undoing&lt;/i&gt; things. Emacs in particular has a powerful undo-system to return to
the previous state of things.
&lt;/p&gt;
&lt;p&gt;
Undo can be activated by pressing &lt;code&gt;C-x u&lt;/code&gt; or &lt;code&gt;C-_&lt;/code&gt;; if you are more comfortable
with using &lt;code&gt;C-z&lt;/code&gt; for undo (as is the standard in many non-Emacs environments),
you can of course add that key binding as well, by putting in your &lt;code&gt;.emacs&lt;/code&gt;:
&lt;/p&gt;


&lt;pre class="src src-emacs-lisp"&gt;(global-set-key (kbd &lt;span class="org-string"&gt;"C-z"&lt;/span&gt;) 'undo)
&lt;/pre&gt;


&lt;p&gt;
This overrides the default of &lt;code&gt;C-z&lt;/code&gt; triggering &lt;code&gt;suspend-frame&lt;/code&gt;, which is not a
great loss for most people.
&lt;/p&gt;
&lt;p&gt;
Emacs-undo has some nice features - for example, if you have selected some text
('marked a region'), the undo operation only applies to that area. At the same
time, however, the undo-model can be confusing: in emacs, &lt;code&gt;undo&lt;/code&gt; is treated like
any other command, which means that &lt;code&gt;undo&lt;/code&gt; can be applied even to&amp;hellip; &lt;code&gt;undo&lt;/code&gt;,
which is different from what most other editors do. Let me give an example &amp;ndash; if
it's confusing or tedious then, well, that's what it is&amp;hellip;
&lt;/p&gt;
&lt;p&gt;
Suppose I type
&lt;/p&gt;


&lt;pre class="src src-text"&gt;hello
world
&lt;/pre&gt;


&lt;p&gt;
now I press &lt;code&gt;C-_&lt;/code&gt;, and I get
&lt;/p&gt;


&lt;pre class="src src-text"&gt;hello
&lt;/pre&gt;


&lt;p&gt;
Now I type &lt;code&gt;foo&lt;/code&gt;
&lt;/p&gt;


&lt;pre class="src src-text"&gt;hello
foo
&lt;/pre&gt;


&lt;p&gt;
And press &lt;code&gt;C-_&lt;/code&gt; &lt;code&gt;C-_&lt;/code&gt;; and I get back:
&lt;/p&gt;


&lt;pre class="src src-text"&gt;hello
world
&lt;/pre&gt;


&lt;p&gt;
This is because we're 'undoing the undo' of adding the word 'world', and thus,
it reappears! When you try this in most other editors, it would result in
&lt;/p&gt;


&lt;pre class="src src-text"&gt;hello
&lt;/pre&gt;


&lt;p&gt;
because those editors completely forget about 'world' after it is undone. 
&lt;/p&gt;
&lt;p&gt;
So, emacs' model is strictly more powerful - but some (many? )people find it a
bit confusing, esp. when a series of 'undos' is interrupted by a 'do'.
&lt;/p&gt;
&lt;p&gt;
If you prefer the model that many other editors use, you might be interested in
&lt;code&gt;redo-mode&lt;/code&gt;, in particular in &lt;a href="http://www.emacswiki.org/emacs/RedoPlus"&gt;RedoPlus&lt;/a&gt;. Using that package, undo (or rather,
&lt;i&gt;redo&lt;/i&gt;) follows a different model. In that model, &lt;i&gt;redo&lt;/i&gt; is 'special': it's
&lt;b&gt;not&lt;/b&gt; registered as a buffer change, and as such it's conceptually different
from the redo=undo-undo model that emacs uses by default. As seen above, you
actually lose some information in the process.
&lt;/p&gt;
&lt;p&gt;
Yet another way to tackle the undo-problem is implemented by &lt;a href="http://www.emacswiki.org/emacs/UndoTree"&gt;UndoTree&lt;/a&gt;: the
states of your buffer are seen as nodes in a &lt;i&gt;tree&lt;/i&gt;, and you can freely move to
specific nodes. UndoTree is as powerful as the emacs system, yet easier to
understand. It can even visualize the tree of changes - and you can then by
clicking on a node go back to the corresponding buffer state.
&lt;/p&gt;
&lt;p&gt;
Now, when using &lt;code&gt;UndoTree&lt;/code&gt;, let's look at our example again:
&lt;/p&gt;
&lt;p&gt;
We started with:
&lt;/p&gt;


&lt;pre class="src src-text"&gt;hello
world
&lt;/pre&gt;


&lt;p&gt;
then did &lt;code&gt;C-_&lt;/code&gt; (which removed 'world') and typed 'foo' to get:
&lt;/p&gt;


&lt;pre class="src src-text"&gt;hello
foo
&lt;/pre&gt;


&lt;p&gt;
Now press &lt;code&gt;C-u&lt;/code&gt; again, and 'foo' disappear. Now we press &lt;code&gt;C-x u&lt;/code&gt;
(&lt;code&gt;undo-tree-visualize&lt;/code&gt;) and we get a buffer with:
&lt;/p&gt;


&lt;pre class="src src-undo-tree-visualizer-mode"&gt;  |
  o
  |
  |
  x
  | 
 / \
o   o
&lt;/pre&gt;


&lt;p&gt;
and we can now visually move to any of the nodes, and our buffer is instantly
brought back. Cool! The two branches correspond to the states 'world' and 'foo'.
I have been undo-tree-mode for the last few weeks, and it works very well:
usually I don't even notice it, but when I need the extra power, it's there.
&lt;/p&gt;
&lt;p&gt;
I am told that &lt;i&gt;UndoTree&lt;/i&gt; is inspired by the way the &lt;code&gt;vim&lt;/code&gt;-text editor does
this. Anyway, there is another very powerful feature in the &lt;a href="http://vimdoc.sourceforge.net/htmldoc/usr_32.html"&gt;&lt;code&gt;vim&lt;/code&gt; undo-system&lt;/a&gt;
that would be nice to have in emacs to: time-based undo. In vim you can e.g. say
something like:
&lt;/p&gt;


&lt;pre class="src src-text"&gt;:earlier 5m
&lt;/pre&gt;


&lt;p&gt;
to go to the state of your buffer 5 minutes ago. That would be a nice addition
for &lt;code&gt;undo-tree-mode&lt;/code&gt;!  
&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;Update&lt;/b&gt; &lt;i&gt;Tavis Rudd&lt;/i&gt; notes that pressing &lt;code&gt;t&lt;/code&gt; in &lt;code&gt;undo-tree-visualizer-mode&lt;/code&gt;
(i.e.. what you see when your press &lt;code&gt;C-x u&lt;/code&gt;) will give you timestamps instead of
&lt;code&gt;o&lt;/code&gt; and &lt;code&gt;x&lt;/code&gt;:
&lt;/p&gt;


&lt;pre class="src src-undo-tree-visualizer-mode"&gt;                  |
                  | 
             18:54:20
                  |
                  |
             18:54:20
          ________|___ 
         /            \
     18:54:15       18:53:37
        |              |
        |              |
     18:54:15       18:53:37
     ___|___           |
    /       \          |
18:54:10  18:53:43  18:53:36
&lt;/pre&gt;



&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-120766809928533795?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/120766809928533795/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=120766809928533795' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/120766809928533795'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/120766809928533795'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2010/11/undo.html' title='undo'/><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-3394448227791083888</id><published>2010-10-23T15:59:00.006+03:00</published><updated>2010-10-24T18:07:55.982+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><title type='text'>auto-complete-mode</title><content type='html'>&lt;p&gt;Recently, we &lt;a href="http://emacs-fu.blogspot.com/2010/09/interview-with-eric-ludlam-cedet.html"&gt;discussed CEDET&lt;/a&gt; in the interview with Eric Ludlam. CEDET has a deep
understanding of the source code, and assists the development process by
exploiting that knowledge. For example by drawing class diagrams (&lt;a href="http://cedet.sourceforge.net/cogre.shtml"&gt;COGRE&lt;/a&gt;) or
providing auto-completion for function names and parameters.
&lt;/p&gt;
&lt;p&gt;
Currently, however, CEDET is also be a bit hard to set up effectively, and may
also not support your programming language yet. Therefore, it's still useful to
look at some other packages that can substitute (part of) the functionality.
&lt;/p&gt;
&lt;p&gt;
For me, &lt;a href="http://cx4a.org/software/auto-complete/"&gt;auto-complete-mode&lt;/a&gt; has been very useful for that. It's not as fancy as
CEDET in the sense that it does not really &lt;i&gt;understand&lt;/i&gt; the code &amp;ndash; but in
practice I found it to work quite well for both C/C++, Elisp and shell scripts.
It can even display the docstrings of functions. And when editing shell-scripts,
it can complete path names as you are editing the scripts; very nice.
&lt;/p&gt;
&lt;p&gt;
To install, follow the &lt;a href="http://cx4a.org/software/auto-complete/manual.html#Installation"&gt;instructions&lt;/a&gt;. Then, in your &lt;code&gt;.emacs&lt;/code&gt;, have something
like:
&lt;/p&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;auto-complete-config&lt;/span&gt; nil 'noerror) &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;don't break if not installed &lt;/span&gt;
(add-to-list 'ac-dictionary-directories &lt;span class="org-string"&gt;"~/.emacs.d/ac-dict"&lt;/span&gt;)
  (&lt;span class="org-keyword"&gt;setq&lt;/span&gt; ac-comphist-file  &lt;span class="org-string"&gt;"~/.emacs.d/ac-comphist.dat"&lt;/span&gt;)
  (ac-config-default))
&lt;/pre&gt;



&lt;p&gt;
After that, &lt;code&gt;M-x auto-complete-mode&lt;/code&gt; to start using it. Alternatively, there's a
&lt;a href="http://www.youtube.com/watch?v=rGVVnDxwJYE"&gt;YouTube-video&lt;/a&gt; explaining how to install and use &lt;code&gt;auto-complete-mode&lt;/code&gt;;
recommended. In any case, it is &lt;a href="http://cx4a.org/software/auto-complete/manual.html"&gt;fully documented&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
&lt;code&gt;auto-complete-mode&lt;/code&gt; uses a configurable set of &lt;i&gt;sources&lt;/i&gt; from which it takes it
knowledge about what can be completed. For example, when writing in &lt;code&gt;org-mode&lt;/code&gt;,
it takes its input from
&lt;/p&gt;


&lt;pre class="src src-elisp"&gt;(ac-source-filename ac-source-abbrev ac-source-dictionary
 ac-source-words-in-same-mode-buffers)
&lt;/pre&gt;


&lt;p&gt;
while in a &lt;code&gt;c-mode&lt;/code&gt; buffer it is (in my case):
&lt;/p&gt;


&lt;pre class="src src-elisp"&gt;(ac-source-filename ac-source-yasnippet ac-source-gtags ac-source-abbrev
ac-source-dictionary ac-source-words-in-same-mode-buffers)
&lt;/pre&gt;


&lt;p&gt;
You can customize this, and (for the more ambitious), it's possible to add your
own sources as well.
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-3394448227791083888?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/3394448227791083888/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=3394448227791083888' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/3394448227791083888'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/3394448227791083888'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2010/10/auto-complete-mode.html' title='auto-complete-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>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-8830503538191507740</id><published>2010-09-27T07:42:00.000+03:00</published><updated>2010-09-27T07:42:26.149+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><category scheme='http://www.blogger.com/atom/ns#' term='interview'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='emacs23'/><title type='text'>interview with Eric Ludlam (CEDET)</title><content type='html'>&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;img src="http://cedet.sourceforge.net/img-gen/cedet-logo-left.png" align="right" width="400"/&gt;
&lt;div class="outline-text-2" id="text-1"&gt;

&lt;p&gt;
One of the notable new features of &lt;a href="http://emacs-fu.blogspot.com/2010/05/emacs-232.html"&gt;emacs 23.2&lt;/a&gt; was the inclusion of &lt;a href="http://cedet.sourceforge.net/"&gt;CEDET&lt;/a&gt;. CEDET adds IDE-type functionality to emacs, and one only needs to read
the responses to the &lt;a href="http://emacs-fu.blogspot.com/2010/05/100th-post.html"&gt;100th post&lt;/a&gt; to see the great interest in that.
&lt;/p&gt;
&lt;p&gt;
The man behind CEDET is Eric Ludlam (&lt;b&gt;EML&lt;/b&gt;), a long-time Emacs user and
developer. He kindly answered the many questions we had for him. Thanks, Eric!
&lt;/p&gt;


&lt;strong&gt;djcb: Eric, could you tell us a little bit about yourself? And about
that fantastic hobby of yours, building &lt;a
href="http://en.wikipedia.org/wiki/Siege_engine"&gt;siege engines&lt;/a&gt;?&lt;/strong&gt;

&lt;p&gt;
&lt;b&gt;EML&lt;/b&gt;: I manage a software engineering team at the &lt;a href="http://www.mathworks.com"&gt;MathWorks&lt;/a&gt;.  The MathWorks
are the creators of Matlab.  In my spare time I maintain CEDET, the Matlab
support for Emacs, and build replicas of ancient siege engines.
&lt;/p&gt;
&lt;p&gt;
I've been building catapults of various types for use at the &lt;a href="http://www.worldchampionshippunkinchunkin.com/"&gt;World Championship Punkin' Chunk&lt;/a&gt; since 1998. My team started with a traction
trebuchet, then a HCW Trebuchet, then moved to Human Powered Centripetal, and
finally to the torsion division with &lt;a href="http://www.siege-engine.com/MistaBallista.shtml"&gt;MistaBallista&lt;/a&gt;. As far as I know, Mista
Ballista is the worlds largest farthest throwing currently functional
ballista.
&lt;/p&gt;
&lt;p&gt;
Most recently, I got to &lt;a href="http://www.siege-engine.com/MathWorksDemo2010.shtml"&gt;help demolish a building where I work&lt;/a&gt; by shooting
stuff at it, which was a lot of fun.
&lt;/p&gt;


&lt;strong&gt;djcb: How did you get involved with Emacs? Do you spend a lot of time
with it?&lt;/strong&gt;

&lt;p&gt;
EML: I've been hacking Emacs since version 18.54 on &lt;a href="http://en.wikipedia.org/wiki/Ultrix"&gt;Ultrix&lt;/a&gt; because the alternative
was &lt;code&gt;vi&lt;/code&gt;.  My first post (and thus contribution to Emacs) was to
&lt;code&gt;gnu.emacs.sources&lt;/code&gt; on June 6, 1992.  I've used Emacs to work on C/C++ code for
many years which inspired all the various parts of CEDET, but these days I
don't get much coding time.
&lt;/p&gt;
&lt;p&gt;
My work with Emacs and CEDET is seasonal currently.  The summers are usually
busy with family activities, and my falls are busy getting the catapult
ready, so CEDET work usually happens in the winter.
&lt;/p&gt;


  &lt;strong&gt;djcb: Can you tell us a bit about the background of CEDET?&lt;/strong&gt;

&lt;p&gt;
&lt;b&gt;EML&lt;/b&gt;: I started with some really basic editors and eventually with &lt;a href="http://en.wikipedia.org/wiki/Language-Sensitive_Editor"&gt;LSE&lt;/a&gt; (Language
Sensitive Editor) on VMS.  LSE was pretty cool.  When I switched OSes to
Ultrix and was forced to use Emacs, and discovered you could script it, I was
hooked.  My first big Emacs hack was etalk, an implementation of Unix talk in
Emacs.
&lt;/p&gt;
&lt;p&gt;
In one of the Emacs related newsgroups, a spoof story floated around about how
Emacs became sentient, and started writing code for Richard [Stallman] instead
of the other way around.  Since then I've always wanted to get Emacs to start
writing my code for me.  I wrote &lt;code&gt;cparse.el&lt;/code&gt;, a regexp nightmare that could
parse almost any C file into a sequence of highly detailed tags.  The tags
could be used to then generate code, and I had a cool comment writing utility,
automatic prototype generation, and some navigation features.  On the whole it
failed for many reasons.
&lt;/p&gt;
&lt;p&gt;
The concept, however, continued.  CParse became the basic idea behind what is
now the Semantic package in CEDET, though none of the old stuff remains beyond
some echos in some &lt;a href="http://cedet.sourceforge.net/srecode.shtml"&gt;SRecode&lt;/a&gt; utilities.
&lt;/p&gt;
&lt;p&gt;
My end goal is to provide round-trip code management in Emacs.  Emacs needs to
be able to read your code, allow you to perform transformations in the code in
an abstract way, and then write new code for you.  Everything in CEDET is
building toward that goal.  It is taking a long time, and you can see it
starting to take shape.  Semantic can parse the code, &lt;a href="http://cedet.sourceforge.net/cogre.shtml"&gt;COGRE&lt;/a&gt; can manipulate UML
diagrams representing your code, and you can export diagrams into code through
SRecode.  Unfortunately this isn't a round-trip solution as the generated code
currently should not replace existing hand-written code.
&lt;/p&gt;


  &lt;strong&gt;Can you tell us a bit about the CEDET-project?&lt;/strong&gt;

&lt;p&gt;
&lt;b&gt;EML&lt;/b&gt;: I maintain CEDET and field questions on the &lt;a href="http://sourceforge.net/mail/?group_id=17886"&gt;mailing list&lt;/a&gt;.  There are
several contributors who either own some tool in the "contrib" area, fix bugs,
answer questions or apply patches for new features.  There has always been
someone to pick up the slack when I'm busy elsewhere, and I've greatly
appreciated that.
&lt;/p&gt;
&lt;p&gt;
The easiest (and most common) way to contribute code to CEDET is to provide
support for some new language, or to create a language agnostic tool using the
CEDET APIs.  As with Emacs, you need to be able to assign copyright to the FSF
to contribute to CEDET's core, but new language support or utilities can have
a home in the contrib area as well.
&lt;/p&gt;


  &lt;strong&gt;djcb: CEDET is part of Emacs since 23.2. Can you tell us a bit about how that
  happened?&lt;/strong&gt;

&lt;p&gt;
&lt;b&gt;EML&lt;/b&gt;: I've been providing assignments for the parts of CEDET since 1996 or so.
For Emacs 23.1, CEDET was at a stable and useful enough state that Chong
Yidong was willing to do the work to integrate it into Emacs.  My ability to
get a legal release for CEDET in time for Emacs 23.1 failed, so it went into
23.2 instead.  It is my understanding that CEDET's smart completion engine
reached a performance and reliability point that made it desirable to have in
Emacs.
&lt;/p&gt;
&lt;p&gt;
Emacs currently includes the parts of CEDET needed to make EDE, the project
management system, Semantic and it's user tools, and SRecode all work from a
user perspective.  Emacs lacks the Semantic development environment, needed
for writing new language support, and COGRE, the UML diagram editing tool.
&lt;/p&gt;


&lt;strong&gt;djcb: Are there plans to include those parts as well?&lt;/strong&gt;

&lt;p&gt;
Yes.  It is important for users with a stock Emacs to develop new languages
using the missing Semantic development tools.  I don't know if COGRE will ever
go in, though I expect that this will be done via the new package management
system [elpa].
&lt;/p&gt;


&lt;strong&gt;djcb: Did you ever try IDEs such as &lt;a
  href="http://en.wikipedia.org/wiki/Eclipse_(software)"&gt;Eclipse&lt;/a&gt;? How do you
  think CEDET stacks up against such programs?&lt;/strong&gt;

&lt;p&gt;
&lt;b&gt;EML&lt;/b&gt;: I have used &lt;a href="http://en.wikipedia.org/wiki/Visual_studio"&gt;Visual Studio&lt;/a&gt; more than Eclipse, and certainly watched demos
on how these and other tools work.
&lt;/p&gt;
&lt;p&gt;
These tools win over CEDET's features in that they usually integrate directly
with the compiler, VM or whatever, and have very good completion engines and
UIs that you can interact with.
&lt;/p&gt;
&lt;p&gt;
CEDET wins in that you don't need a compiler, or even code that can compile
for it to work and start providing useful completions.  It can infer an awful
lot from a project.
&lt;/p&gt;
&lt;p&gt;
CEDET's language support structure is thus simple in comparison, and CEDET
supports many more languages as a side effect.  It also wins because it is in
Emacs, and I've done my best to try and match the "Emacs Way".  For an Emacs
user, this is intuitive, but can appear quirky to outsiders.
&lt;/p&gt;


  &lt;strong&gt;djcb: What about other development tools for in emacs?&lt;/strong&gt;

&lt;p&gt;
&lt;b&gt;EML&lt;/b&gt;: There are a lot of language specific solutions like &lt;a href="http://cx4a.org/software/gccsense/"&gt;GCCSense&lt;/a&gt;, &lt;a href="http://common-lisp.net/project/slime/"&gt;slime&lt;/a&gt;, &lt;a href="http://jdee.sourceforge.net/"&gt;JDEE&lt;/a&gt;, and
others out there.  These projects are great in that they take a language, and
push it to the edge of what you can do, and the users generally love that
stuff.  When someone wants to do the same thing, like when &lt;a href="http://csde.sourceforge.net/"&gt;CSDE&lt;/a&gt; started for
C#, and it tried to copy JDEE, it was just that, a copy that didn't quite make
it.
&lt;/p&gt;
&lt;p&gt;
It is my hope that CEDET will become the target of choice for users who want
to make their language support in Emacs the best.  They will save a lot of
time doing so as well.  The same infrastructure for integrating in external
tools can be used to get improved results out of CEDET, but CEDET will handle
converting that into a representation that would then allow any tool built on
CEDET to work.  This is the same model that worked well for &lt;code&gt;comint.el&lt;/code&gt;, and
&lt;code&gt;gud.el&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://code.google.com/p/yasnippet/"&gt;Yasnippet&lt;/a&gt; is a bit different in the way it "competes" with SRecode.  My first
implementation of SRecode tried recycling tempo templates, but I couldn't get
it to work.  In fact all the template systems I investigated fell short of
what I was trying to do, so I had to roll my own, and ended up using a variant
of the Google template format.
&lt;/p&gt;
&lt;p&gt;
The key difference is that the goal was for SRecode to provide a series of
base templates for code generation.  A tool writer would then write some tool
to generate code.  A user would then use the tool, and say "This is great, how
do I change where the &lt;code&gt;{&lt;/code&gt; goes?"
&lt;/p&gt;
&lt;p&gt;
The answer is to override the template with that detail in it without
interfering with the system templates.  That only works if the templates are
sufficiently granular that the changed template can be simple.  Template reuse
needs to be high so that if your company formats your methods as:
&lt;/p&gt;



&lt;pre class="src src-c"&gt;&lt;span class="org-type"&gt;int&lt;/span&gt; &lt;span class="org-function-name"&gt;mymethod&lt;/span&gt;() { implementme() };
&lt;/pre&gt;



&lt;p&gt;
instead of 
&lt;/p&gt;



&lt;pre class="src src-c"&gt;&lt;span class="org-type"&gt;int&lt;/span&gt; &lt;span class="org-function-name"&gt;mymethod&lt;/span&gt;() {
}
&lt;/pre&gt;



&lt;p&gt;
that one template change will allow this to happen for all code generated from
every tool.
&lt;/p&gt;
&lt;p&gt;
Thus, the audience for yasnippet and SRecode is quite different.  Of course
you could do yasnippet like things with SRecode if someone took the time to
improve the field-editing feature in SRecode, but that has not been my focus.
&lt;/p&gt;


  &lt;strong&gt;djcb: Do you follow the overall Emacs development process? Are there
  things you would like to see changed/improved?&lt;/strong&gt;

&lt;p&gt;
&lt;b&gt;EML&lt;/b&gt;: I watch the &lt;code&gt;emacs-devel&lt;/code&gt; mailing list, mainly to see if anything 
related to CEDET goes by that I can help with, or what the latest cool 
feature might be. My first contribution of &lt;a href="http://cedet.sourceforge.net/speedbar.shtml"&gt;Speedbar&lt;/a&gt; to Emacs in Emacs 20 
helped drive some features related to overlines, boxes, and other face 
attributes that appeared in Emacs 21.
&lt;/p&gt;
&lt;p&gt;
In the future, once CEDET and Emacs cross merge techniques are hashed out, I
would expect some key parts that need performance improvements might move into
C.  Another part of CEDET that I'd love to see become bound closer to Emacs is
&lt;code&gt;mode-local.el&lt;/code&gt;.  It tries to simulate mode-local variables and mode-local
functions.  This is critical in a complex system like CEDET that needs to
provide a language support author with fine grained control.  There are good
reasons not to make what is currently implemented "the Emacs way", but it
would be nice to resolve those and enable mode authors a with a more powerful
way to customize the user experience.
&lt;/p&gt;


&lt;strong&gt;djcb: Do you have specific plans for CEDET in the future?&lt;/strong&gt;

&lt;p&gt;
&lt;b&gt;EML&lt;/b&gt;: Here is the short list:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Improve Emacs/CEDET cross merging
&lt;/li&gt;
&lt;li&gt;
Offload tag storage to an external process - needed for scalability
&lt;/li&gt;
&lt;li&gt;
Design/define a "CEDET mode" as a way of simplifying the confusing array of
distinct tools and modes that make up CEDET now.
&lt;/li&gt;
&lt;li&gt;
Finish the smart-context menu project
&lt;/li&gt;
&lt;li&gt;
Resolve the "code replacement" problem of parsing a block of code,
transforming it, and re-creating that code in place reliably.

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


&lt;strong&gt;djcb: In addition to all these 'generic' improvements, are there
specific areas where new contributors could make a difference?&lt;/strong&gt;

&lt;p&gt;
&lt;b&gt;EML&lt;/b&gt;: Supporting new "stuff" in CEDET is one big win.  Stuff can be:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
New project types under EDE to ease transition from something like Visual
Studio to Emacs.
&lt;/li&gt;
&lt;li&gt;
Language support, such as parsers, or mode overrides.  Finding ways to take
existing cool tools, like JDE's beanshell, or slime's inferior lisp process
and allowing it to do work for CEDET is another big win.
&lt;/li&gt;
&lt;li&gt;
Templates for code generation in new languages.

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

&lt;p&gt;Tool writing would also be good.  JDEE's author Paul Kinnucan converted many
bits of JDEE to CEDET and co-designed many of CEDET's parts along the way,
such as semanticdb, and that was a huge help.  ECB's current maintainer Klaus
has also had a big impact on the way concepts are abstracted to a tool that
depends on CEDET.
&lt;/p&gt;
&lt;p&gt;
Naturally, joining the mailing list and fixing reported bugs and improving
the doc is also a huge help, but not as exciting as writing new code. :)
&lt;/p&gt;


&lt;strong&gt;djcb: Finally, many people want to start using CEDET, but it seems they
have a bit of trouble to get started. Do you have any recommendations for
them?&lt;/strong&gt;

&lt;p&gt;
&lt;b&gt;EML&lt;/b&gt;: Start with the &lt;code&gt;cedet.info&lt;/code&gt; file which has many of the common setup
configurations in it.  If you run into something not explained well or at
all, be sure to join the mailing list and be specific about how that doc
failed.  Very few questions on the mailing list refer to the doc, so the doc
is rarely improved in a way that can help others.
&lt;/p&gt;
&lt;p&gt;
Another good starting point is Alex Ott's article &lt;a href="http://xtalk.msk.su/~ott/en/writings/emacs-devenv/EmacsCedet.html"&gt;A Gentle Introduction to CEDET&lt;/a&gt;, which is very helpful.
&lt;/p&gt;


&lt;strong&gt;Thanks a lot for your time, Eric! Wishing you a lot of success with
CEDET and all your other projects!&lt;/strong&gt;

&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-8830503538191507740?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/8830503538191507740/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=8830503538191507740' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/8830503538191507740'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/8830503538191507740'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2010/09/interview-with-eric-ludlam-cedet.html' title='interview with Eric Ludlam (CEDET)'/><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>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-5395938754174547300</id><published>2010-08-22T14:10:00.001+03:00</published><updated>2010-08-29T22:48:20.779+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'>narrowing buffer contents</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;
'Narrowing' is yet another of those many useful emacs features that took me
years to appreciate, mostly because I never really tried it. I may not be the
only one, so here's a short introduction.
&lt;/p&gt;
&lt;p&gt;
&lt;i&gt;Narrowing&lt;/i&gt; is the concept of hiding the buffer contents except for what you
are currently working on. This is useful when you don't want to be distracted,
but also because it allows you to execute commands &lt;i&gt;only&lt;/i&gt; on the narrowed
part. You can narrow different things:
&lt;/p&gt;
&lt;table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides"&gt;
&lt;caption&gt;&lt;/caption&gt;
&lt;colgroup&gt;&lt;col align="left" /&gt;&lt;col align="left" /&gt;&lt;col align="left" /&gt;
&lt;/colgroup&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th scope="col"&gt;what's shown&lt;/th&gt;&lt;th scope="col"&gt;name&lt;/th&gt;&lt;th scope="col"&gt;binding&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;region (selection)&lt;/td&gt;&lt;td&gt;&lt;code&gt;narrow-to-region&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;C-x n n&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;current page&lt;/td&gt;&lt;td&gt;&lt;code&gt;narrow-to-page&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;C-x n p&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;function&lt;/td&gt;&lt;td&gt;&lt;code&gt;narrow-to-defun&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;C-x n d&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;everything&lt;/td&gt;&lt;td&gt;&lt;code&gt;widen&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;C-x n w&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


&lt;p&gt;
I never used narrowing for the current page, but apparently it's used by
e.g. &lt;code&gt;Info-Mode&lt;/code&gt; to show only one page.
&lt;/p&gt;
&lt;p&gt;
That last one is pretty important to remember; it's not &lt;i&gt;totally obvious&lt;/i&gt; how
to get back to 'normal' mode where you can see everything. For this very
reason ('where the #&amp;gt;*$@ did my text go'), always-helpful emacs by defaults
&lt;i&gt;disables&lt;/i&gt; &lt;code&gt;narrow-to-region&lt;/code&gt; (but, for some reason, not the other ones). To
enable it, put the following in your &lt;code&gt;.emacs&lt;/code&gt;:
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;(put 'narrow-to-region 'disabled nil)
&lt;/pre&gt;



&lt;p&gt;
Also note that the mode-line will show 'Narrow' when you're in narrow mode,
lest you forget.
&lt;/p&gt;
&lt;p&gt;
When you're using &lt;code&gt;org-mode&lt;/code&gt; there is an additional one you might want to
memorize:
&lt;/p&gt;
&lt;table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides"&gt;
&lt;caption&gt;&lt;/caption&gt;
&lt;colgroup&gt;&lt;col align="left" /&gt;&lt;col align="left" /&gt;&lt;col align="left" /&gt;
&lt;/colgroup&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th scope="col"&gt;what's shown&lt;/th&gt;&lt;th scope="col"&gt;name&lt;/th&gt;&lt;th scope="col"&gt;binding&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;subtree&lt;/td&gt;&lt;td&gt;&lt;code&gt;org-narrow-to-subtree&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;C-x n s&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


&lt;p&gt;
I'm using that last one quite often; I have org-files where I keep meeting notes
etc., and when in a certain meeting, I only want to see the notes for that
specific meeting.
&lt;/p&gt;
&lt;p&gt;
One &lt;i&gt;bug&lt;/i&gt;? &lt;i&gt;feature&lt;/i&gt;? of narrowing is that line-numbering is relative to the
narrowed area rather than the full buffer. I'd prefer to have the &lt;i&gt;real&lt;/i&gt; line
numbers.
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-5395938754174547300?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/5395938754174547300/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=5395938754174547300' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/5395938754174547300'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/5395938754174547300'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2010/08/narrowing-buffer-contents.html' title='narrowing buffer contents'/><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>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-176862637301615408</id><published>2010-07-30T21:23:00.002+03:00</published><updated>2010-07-30T22:49:00.260+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'>some handy key bindings</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 offers many handy key bindings; every now and then I come across a new
one, which has been hiding there somewhere for a decade or more&amp;hellip; Here are
some of my favorites &amp;ndash; I'm listing those that are (a) often useful, (b) might
not be known by everyone already (c) don't require any external packages or
setup. 
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;M-27 x&lt;/code&gt; gives you &lt;code&gt;xxxxxxxxxxxxxxxxxxxxxxxxxxx&lt;/code&gt;; and, believe it or not,
works also with different characters and numbers;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;M-m&lt;/code&gt; jumps to the first non-whitespace character on the current line;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;M-^&lt;/code&gt; joins two lines into one &amp;ndash; like vi(m)'s &lt;code&gt;:join&lt;/code&gt;,
except that point must be on the second line, not the first;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;M-/&lt;/code&gt; auto-completes based on words in all your buffers; there are more
powerful alternatives, but this one does not require any setup;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;C-h k&lt;/code&gt; followed by some key or key combination tells you what it does, &lt;code&gt;C-h     m&lt;/code&gt; describes the currently active modes, with their key bindings;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;C-h f&lt;/code&gt; documents the current function, &lt;code&gt;C-h v&lt;/code&gt; does the same for
variables. &lt;code&gt;C-h a&lt;/code&gt; gives you information about commands - for example to get
&lt;code&gt;date&lt;/code&gt;-related commands, press &lt;code&gt;C-h a date&lt;/code&gt;. This will, however, also get
you commands related to &lt;code&gt;update&lt;/code&gt;; instead, you can use &lt;code&gt;C-h a \bdate&lt;/code&gt;
(because &lt;code&gt;C-h a&lt;/code&gt; accepts regular expressions);
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;C-x C-o&lt;/code&gt; will delete all the empty lines around your current cursor
position, except for one;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;M-q&lt;/code&gt; re-aligns the current paragraph; I use it all the time when writing
e-mails etc. (you might want to check out &lt;a href="http://www.emacswiki.org/emacs/FillAdapt"&gt;filladapt&lt;/a&gt; for a version that gives
you a bit more smartness with indentations, lists etc.);
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;C-x 8 RET&lt;/code&gt; in a recent emacs version gives you an auto-completable list of
special characters to insert. So if I need, say, the Yen-character, I type
&lt;code&gt;C-x 8 RET ye TAB&lt;/code&gt; and I get &lt;code&gt;YEN SIGN&lt;/code&gt;, which &lt;code&gt;RET&lt;/code&gt; will then insert:
¥. Note that the completion only works on the &lt;i&gt;start&lt;/i&gt; of the character name,
so if you'd want to include the α-character, you'd need to know that its
UCS-name is &lt;code&gt;GREEK SMALL LETTER ALPHA&lt;/code&gt;&amp;hellip; (you can try &lt;code&gt;*alpha&lt;/code&gt; or TAB the
empty string, and search in the results buffer, but that's rather slow);
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;C-h l&lt;/code&gt; shows your last 300 key presses ('lossage'). Interesting to see, and
it might be useful when &lt;a href="http://emacs-fu.blogspot.com/2010/07/keyboard-macros.html"&gt;defining keyboard macros&lt;/a&gt;.

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

&lt;p&gt;What are your favorites? Please share them in the comments.
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-176862637301615408?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/176862637301615408/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=176862637301615408' title='23 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/176862637301615408'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/176862637301615408'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2010/07/some-handy-key-bindings.html' title='some handy key bindings'/><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>23</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-8007676915264290254</id><published>2010-07-21T17:29:00.000+03:00</published><updated>2010-07-21T17:29:17.913+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><title type='text'>navigating through files and buffers with the lusty explorer</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 think quite a few people are using &lt;code&gt;ido-mode&lt;/code&gt; to navigate through files an
and buffers; we discussed it here already &lt;a href="http://emacs-fu.blogspot.com/2009/02/switching-buffers.html"&gt;a long time ago&lt;/a&gt;. I am a happy
&lt;code&gt;ido&lt;/code&gt;-user myself &amp;ndash; it took me some time to fully get full accustomed to the
key bindings, but now it feels very natural. Definitely an improvement of my
emacs user experience.
&lt;/p&gt;
&lt;p&gt;
However, I am always looking for new things &amp;ndash; and one of those is a sort-of
&lt;code&gt;ido-mode&lt;/code&gt; substitute. It's called the &lt;a href="http://www.emacswiki.org/emacs/LustyExplorer"&gt;Lusty Explorer&lt;/a&gt; and it's the emacs
implementation of an existing &lt;a href="http://www.vim.org/scripts/script.php?script_id=1890"&gt;vim-plugin&lt;/a&gt;. It's quite similar to &lt;code&gt;ido-mode&lt;/code&gt;;
the difference is mainly that it shows all the files or buffers at the same
time, in the way that shells (say, &lt;code&gt;bash&lt;/code&gt; or &lt;code&gt;zsh&lt;/code&gt;) do auto-completion.
&lt;/p&gt;
&lt;p&gt;
The best way to show how it works is using an &lt;a href="http://viewglob.sourceforge.net/lusty-explorer.el.animated.gif"&gt;screencast&lt;/a&gt; (note, this is of a
slightly older version). Lusty Explorer uses &lt;i&gt;fuzzy matching&lt;/i&gt;; that means that
I can type &lt;code&gt;/etc/fo&lt;/code&gt;, and all items in &lt;code&gt;/etc/&lt;/code&gt; with names &lt;code&gt;f.*o&lt;/code&gt; match.
&lt;/p&gt;
&lt;p&gt;
To install &lt;code&gt;lusty-explorer&lt;/code&gt;, simply copy &lt;a href="http://www.emacswiki.org/emacs/download/lusty-explorer.el"&gt;lusty-explorer.el&lt;/a&gt; to your
&lt;code&gt;load-path&lt;/code&gt;, and put something like the following in your &lt;code&gt;.emacs&lt;/code&gt;:0
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&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;lusty-explorer&lt;/span&gt; nil 'noerror)

  &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;overrride the normal file-opening, buffer switching
&lt;/span&gt;  (global-set-key (kbd &lt;span class="org-string"&gt;"C-x C-f"&lt;/span&gt;) 'lusty-file-explorer)
  (global-set-key (kbd &lt;span class="org-string"&gt;"C-x b"&lt;/span&gt;)   'lusty-buffer-explorer))

&lt;/pre&gt;



&lt;p&gt;
Side-note, the &lt;code&gt;(when (require 'lusty-explorer nil 'noerror) ...)&lt;/code&gt; is there
just make sure that no error is raised when &lt;code&gt;lusty-explorer&lt;/code&gt; is not found, and
the rest is ignored in that case. I use this construct for all packages that
are not necessarily available everywhere I use my &lt;code&gt;.emacs&lt;/code&gt;; thus, they will
simply be ignored and not cause startup errors.
&lt;/p&gt;
&lt;p&gt;
I've been using Lusty Explorer for about a week now, and I am quite happy with
it. I still need some time (and maybe some more customization) to get used to
the way it works - for example, I found the way &lt;code&gt;ido-mode&lt;/code&gt; handles backspace a
bit smarter. Also, &lt;code&gt;ido-mode&lt;/code&gt; can be customized to a much greater extent. That
might merely be a factor of the relative age of the packages &amp;ndash; and I haven't
really felt the need to customize Lusty Explorer too much. For now, I think
I'm going to keep on using it. It's worth a try at least!
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-8007676915264290254?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/8007676915264290254/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=8007676915264290254' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/8007676915264290254'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/8007676915264290254'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2010/07/navigating-through-files-and-buffers.html' title='navigating through files and buffers with the lusty explorer'/><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>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-6197615112978020971</id><published>2010-07-16T20:34:00.005+03:00</published><updated>2010-07-24T10:25:41.922+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'>keyboard macros</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;
Keyboard macros are a truly &lt;i&gt;classic&lt;/i&gt; emacs feature. Still, I only started to
use them years after I got sucked into emacs &amp;ndash; not so uncommon for emacs
features&amp;hellip; There may be more people like me, so let's raise the awareness a
bit.
&lt;/p&gt;
&lt;p&gt;
Keyboard macros allow you to record a number of keystrokes, and replay those at
some later point. This can be a great time-saver when you need to do repetitive
things. In many cases, they are an easy alternative to writing some elisp to get
a job done. Note, keyboard macros are should not be confused with elisp-macros,
which are something else altogether.
&lt;/p&gt;

&lt;/div&gt;

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


&lt;p&gt;
So, when would we want to use a keyboard macro? Let's take some tedious task --
for example, we have a list of a few hundred names:
&lt;/p&gt;



&lt;pre class="example"&gt;Newton, Isaac
Einstein, Albert
Maxwell, James
Turing, Alan
...
&lt;/pre&gt;



&lt;p&gt;
and we want to turn that into:
&lt;/p&gt;



&lt;pre class="example"&gt;Isaac Newton
James Maxwell
Alan Turing
...
&lt;/pre&gt;



&lt;p&gt;
so, roughly, put the last name after the first name, and remove the comma.
&lt;/p&gt;
&lt;p&gt;
We can solve this in different ways; we could simple change each line by
hand. That's a fine solution if there are only a few lines, but it gets boring
rather quickly.
&lt;/p&gt;
&lt;p&gt;
Another way is to use &lt;i&gt;regular expressions&lt;/i&gt; (see &lt;a href="http://emacs-fu.blogspot.com/2009/05/building-regular-expression.html"&gt;Building regular expressions&lt;/a&gt;);
in this case, it's fairly easy to come up with one (assuming you &lt;i&gt;know&lt;/i&gt; regular
expressions). But let's see how we can solve it with a keyboard macro.
&lt;/p&gt;
&lt;p&gt;
Schematically, we can solve this with the following:
&lt;/p&gt;
&lt;table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides"&gt;
&lt;caption&gt;&lt;/caption&gt;
&lt;colgroup&gt;&lt;col align="left" /&gt;&lt;col align="left" /&gt;
&lt;/colgroup&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th scope="col"&gt;action&lt;/th&gt;&lt;th scope="col"&gt;key&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;go to beginning of a line&lt;/td&gt;&lt;td&gt;C-a&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;kill (cut) the first word&lt;/td&gt;&lt;td&gt;M-d&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;delete the next two characters&lt;/td&gt;&lt;td&gt;DEL DEL&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;go to the end of the line&lt;/td&gt;&lt;td&gt;C-e&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;insert a space&lt;/td&gt;&lt;td&gt;SPC&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;yank (paste)&lt;/td&gt;&lt;td&gt;C-y&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;go to the next line&lt;/td&gt;&lt;td&gt;C-n&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;



&lt;p&gt;
This may look like some magical incantation, but it comes quite natural when you
are actually doing the editing. 
&lt;/p&gt;
&lt;p&gt;
An &lt;b&gt;important&lt;/b&gt; thing to remember when working with keyboard macros is that you
do your commands in such a way that they can be repeated for each line. Suppose
you would select &lt;code&gt;Newton&lt;/code&gt; with &lt;i&gt;shift-select&lt;/i&gt;, i.e., &lt;code&gt;C-SPC&lt;/code&gt; at the beginning of
the line and pressing the right arrow key 6 times &amp;ndash; that works for &lt;code&gt;Newton&lt;/code&gt;,
but not for &lt;code&gt;Einstein&lt;/code&gt;. Instead, we need to use &lt;code&gt;M-d&lt;/code&gt; ('&lt;code&gt;kill-word&lt;/code&gt;')
instead.
&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;defining a macro &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1_2"&gt;


&lt;p&gt;
Now that we have solved the problem for a single line, let's make a keyboard
macro.
&lt;/p&gt;
&lt;p&gt;
We move the cursor to the first line, and start the definition by pressing
&lt;code&gt;C-x (&lt;/code&gt;, or alternatively, &lt;code&gt;F3&lt;/code&gt;. Then, we press the commands &lt;code&gt;C-a&lt;/code&gt;, &lt;code&gt;M-d&lt;/code&gt;, &lt;code&gt;DEL DEL&lt;/code&gt;, &lt;code&gt;C-e&lt;/code&gt;, &lt;code&gt;SPC&lt;/code&gt;, &lt;code&gt;C-y&lt;/code&gt;, &lt;code&gt;C-n&lt;/code&gt; (as in the list above).  To finish the
definition, press &lt;code&gt;C-x )&lt;/code&gt;, (or &lt;code&gt;F4&lt;/code&gt;).
&lt;/p&gt;
&lt;p&gt;
Hurray, we have our macro. Now, let's use it.
&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;using the macro &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1_3"&gt;


&lt;p&gt;
Now, to execute the last defined macro, you press &lt;code&gt;C-x e&lt;/code&gt;. We could repeat that
for our whole list, but fortunately there's an easier way to repeat a macro &lt;i&gt;n&lt;/i&gt;
times, using a &lt;i&gt;prefix argument&lt;/i&gt;. For example, to repeat the macro 123 times,
you first press &lt;code&gt;C-u 123&lt;/code&gt; and then &lt;code&gt;C-x e&lt;/code&gt;. 
&lt;/p&gt;
&lt;p&gt;
There's a slightly shorter way to do this: instead of &lt;code&gt;C-u 123&lt;/code&gt; we can write
&lt;code&gt;M-123&lt;/code&gt;, and for &lt;code&gt;C-x e&lt;/code&gt; we can use &lt;code&gt;F4&lt;/code&gt; (&lt;code&gt;kmacro=end-or-call-macro&lt;/code&gt;).
&lt;/p&gt;
&lt;p&gt;
You can even repeat the macro until the end of the buffer is reached with &lt;code&gt;C-u 0 C-x e&lt;/code&gt;; this only makes sense if the macros ever &lt;i&gt;reaches&lt;/i&gt; the end of the buffer
of course. (Remember that you can always terminate with &lt;code&gt;C-g&lt;/code&gt;, &lt;code&gt;keyboard-quit&lt;/code&gt;)
&lt;/p&gt;
&lt;p&gt;
You can also apply your keyboard macro to &lt;i&gt;all lines in the selected area&lt;/i&gt;
(region) with &lt;code&gt;M-x apply-macro-to-region-lines&lt;/code&gt; (or &lt;code&gt;C-x C-k r&lt;/code&gt;). Important to
remember: this will actually move the cursor (point) to the start of each line,
and then execute the macro. If you want your macro like that, the
go-to-the-next-line should &lt;b&gt;not&lt;/b&gt; be part of your macro, or you will be skipping
lines.
&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;saving macros for later use &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1_4"&gt;


&lt;p&gt;
If you want to use multiple macros, you can &lt;i&gt;name them&lt;/i&gt;. You can do this with
&lt;code&gt;M-x name-last-kbd-macro&lt;/code&gt;. If you name your macro, say, &lt;code&gt;foo&lt;/code&gt; (inventive as we
are), you can then execute it after that as &lt;code&gt;M-x foo&lt;/code&gt;, which will be available
until you exit emacs.
&lt;/p&gt;
&lt;p&gt;
If you want to have the macro for future emacs sessions as well, you can use
&lt;code&gt;insert-kbd-macro&lt;/code&gt;, which will give you an elisp version of your macro. For our
example, this will look like:
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;(fset 'foo 
   [?\C-a ?\M-d delete delete ?\C-e ?  ?\C-y ?\C-n])
&lt;/pre&gt;



&lt;p&gt;
Not very readable, but we can put this in &lt;code&gt;.emacs&lt;/code&gt;, and we can use it the next
time we start emacs as well. We can also add a key binding for this, for
example:
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;(global-set-key (kbd &lt;span class="org-string"&gt;"C-c f"&lt;/span&gt;) 'foo)
&lt;/pre&gt;



&lt;p&gt;
This will bind &lt;code&gt;foo&lt;/code&gt; to &lt;code&gt;C-c f&lt;/code&gt;.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-2" class="outline-2"&gt;
&lt;h2 id="sec-2"&gt;final notes &lt;/h2&gt;
&lt;div class="outline-text-2" id="text-2"&gt;


&lt;p&gt;
Keyboard macros can be useful and easy, but they are fundamentally connected
to key presses &amp;ndash; so, if you remap your keys to something different, your
macros may not work anymore. Also, the macros are pretty much &lt;i&gt;write-only&lt;/i&gt; in
the way we use them here. You can edit them in the &lt;i&gt;macro editor&lt;/i&gt; though, with
&lt;code&gt;M-x edit-kbd-macro M-x foo&lt;/code&gt;; we'll then get something like:
&lt;/p&gt;



&lt;pre class="example"&gt;;; Keyboard Macro Editor.  Press C-c C-c to finish; press C-x k RET to cancel.
;; Original keys: C-a M-d 2*&amp;lt;delete&amp;gt; C-e SPC C-y C-n

Command: foo
Key: none

Macro:

C-a                     ;; move-beginning-of-line
M-d                     ;; kill-word
2*&amp;lt;delete&amp;gt;              ;; delete-char
C-e                     ;; move-end-of-line
SPC                     ;; self-insert-command
C-y                     ;; yank
C-n                     ;; next-line
&lt;/pre&gt;



&lt;p&gt;
Keyboard macros can be quite a useful trick in your arsenal. And I have not
even gone into more advanced tricks like &lt;i&gt;macros with variations&lt;/i&gt; or the
&lt;i&gt;macro ring&lt;/i&gt;. Please refer to the section &lt;a href="http://www.gnu.org/software/emacs/manual/html_node/emacs/Keyboard-Macros.html#Keyboard-Macros"&gt;Keyboard macros&lt;/a&gt; in the emacs
manual (&lt;code&gt;C-h r&lt;/code&gt;) for all the details.
&lt;/p&gt;
&lt;p&gt;
And, finally, don't let the text-based example limit your imagination &amp;ndash; you
can turn just about any repetitive sequence of tasks into a macro.
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-6197615112978020971?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/6197615112978020971/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=6197615112978020971' title='15 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/6197615112978020971'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/6197615112978020971'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2010/07/keyboard-macros.html' title='keyboard macros'/><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>15</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-2453472948117026214</id><published>2010-06-30T23:05:00.002+03:00</published><updated>2010-07-01T19:16:55.939+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='updated'/><category scheme='http://www.blogger.com/atom/ns#' term='new'/><title type='text'>console apps in emacs with multi-term</title><content type='html'>&lt;div&gt;&lt;a href="http://2.bp.blogspot.com/_kGFGcbwevHE/TCujU1_NZBI/AAAAAAAAAgo/jgNXAPGhNaU/s1600/htop.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_kGFGcbwevHE/TCujU1_NZBI/AAAAAAAAAgo/jgNXAPGhNaU/s320/htop.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;h2 id="sec-1"&gt;multi-term &lt;/h2&gt;
&lt;div class="outline-text-2" id="text-1"&gt;


&lt;p&gt;
&lt;strong&gt;updated&lt;/strong&gt; Whenever it makes sense, I try to use emacs for my computer-based activities;
surely, programs like &lt;a href="http://www.gimp.org/"&gt;The Gimp&lt;/a&gt; or a graphical web browser cannot &lt;i&gt;yet&lt;/i&gt; be
replace by emacs, but I'm making progress. I like the ways emacs gives me to
automate and speed-up my tasks; I get some return-on-time-investment.
&lt;/p&gt;
&lt;p&gt;
2010 or not, I still spend quite a bit of time on the console. So why not do
that from within emacs? There different ways to run shells within emacs. 
&lt;/p&gt;
&lt;p&gt;
The simplest one is &lt;code&gt;shell&lt;/code&gt; (i.e,, &lt;code&gt;M-x shell&lt;/code&gt;), which starts a simple shell,
which does not support which does not support 'graphical' console applications,
such as &lt;code&gt;mutt&lt;/code&gt;, &lt;code&gt;mc&lt;/code&gt;, &lt;code&gt;htop&lt;/code&gt;. 
&lt;/p&gt;
&lt;p&gt;
Then there are &lt;code&gt;term&lt;/code&gt; and &lt;code&gt;ansi-term&lt;/code&gt; (&lt;code&gt;M-x ansi-term&lt;/code&gt;) that do support such
applications, which &lt;code&gt;ansi-term&lt;/code&gt; supporting colors as well (it seems to have
become the default for &lt;code&gt;term&lt;/code&gt; in recent emacs versions).
&lt;/p&gt;
&lt;p&gt;
Another one is the nifty &lt;a href="http://www.emacswiki.org/emacs/CategoryEshell"&gt;EShell&lt;/a&gt; (included with emacs), which is not just a
(simple) terminal, but also a full shell environment, and has integration with
other things in emacs.  It's nice, but has some of the limitations that &lt;code&gt;shell&lt;/code&gt;
has - you cannot run 'graphical' applications; also, I don't really need a
&lt;i&gt;shell&lt;/i&gt;, as I am quite happy with &lt;a href="http://zsh.org"&gt;zsh&lt;/a&gt; (zed shell) already, which is more
powerful, and I prefer a shell that works both inside and outside emacs.
&lt;/p&gt;
&lt;p&gt;
For all these reasons, I am using &lt;a href="http://www.emacswiki.org/emacs/MultiTerm"&gt;MultiTerm&lt;/a&gt;, which has 'graphical' support that
&lt;code&gt;ansi-term&lt;/code&gt; has, but adds a nice extra, namely support for multiple terminals
within emacs. I'm not fully up to date with the exact difference in the terminal
support between the two, but I haven't had any problems so far.
&lt;/p&gt;
&lt;p&gt;
You can install &lt;code&gt;multi-term&lt;/code&gt; (put it in your &lt;code&gt;load-path&lt;/code&gt;), and add the
following to your &lt;code&gt;.emacs&lt;/code&gt;:
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;(autoload 'multi-term &lt;span class="org-string"&gt;"multi-term"&lt;/span&gt; nil t)
(autoload 'multi-term-next &lt;span class="org-string"&gt;"multi-term"&lt;/span&gt; nil t)

(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; multi-term-program &lt;span class="org-string"&gt;"/bin/bash"&lt;/span&gt;)   &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;use bash
&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"&gt;&lt;span class="org-keyword"&gt;setq&lt;/span&gt;&lt;/span&gt;&lt;span class="org-comment"&gt; multi-term-program "/bin/zsh") ;; or use zsh...
&lt;/span&gt;
&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;only needed if you use autopair
&lt;/span&gt;(&lt;span class="org-keyword"&gt;add-hook&lt;/span&gt; 'term-mode-hook
  #'(&lt;span class="org-keyword"&gt;lambda&lt;/span&gt; () (&lt;span class="org-keyword"&gt;setq&lt;/span&gt; autopair-dont-activate t)))


(global-set-key (kbd &lt;span class="org-string"&gt;"C-c t"&lt;/span&gt;) 'multi-term-next)
(global-set-key (kbd &lt;span class="org-string"&gt;"C-c T"&lt;/span&gt;) 'multi-term) &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;create a new one
&lt;/span&gt;&lt;/pre&gt;



&lt;p&gt;
With this, &lt;code&gt;C-c t&lt;/code&gt; will jump through your &lt;code&gt;multi-term&lt;/code&gt; buffers (create a new one
if it doesn not exist yet), while &lt;code&gt;C-c T&lt;/code&gt; unconditionally creates a new
terminal. 
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-2453472948117026214?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/2453472948117026214/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=2453472948117026214' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/2453472948117026214'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/2453472948117026214'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2010/06/console-apps-in-emacs-with-multi-term.html' title='console apps in emacs with multi-term'/><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/_kGFGcbwevHE/TCujU1_NZBI/AAAAAAAAAgo/jgNXAPGhNaU/s72-c/htop.png' height='72' width='72'/><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-5801320037956802309</id><published>2010-06-17T22:24:00.001+03:00</published><updated>2010-06-20T14:00:58.297+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='updated'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>automatic pairing of brackets and quotes</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;
Some text-editors, notably &lt;a href="http://en.wikipedia.org/wiki/TextMate"&gt;TextMate&lt;/a&gt; for &lt;i&gt;MacOS&lt;/i&gt;, have a nice feature where
inserting a opening &lt;b&gt;(&lt;/b&gt; will automatically insert the closing &lt;b&gt;)&lt;/b&gt;, and put the
cursor in between them (and does same for [], {}, and various quote-marks).
&lt;/p&gt;
&lt;p&gt;
Not surprisingly, there are &lt;a href="http://www.emacswiki.org/emacs/AutoPairs"&gt;some implementations&lt;/a&gt; for emacs as well; the best
one I have found so far is called &lt;a href="http://code.google.com/p/autopair/"&gt;autopair&lt;/a&gt;, which was written by João
Távora. It usually does things &lt;i&gt;just right&lt;/i&gt;. Do things 'just right' is
essential for such a tool; even small annoyances can disturb your
&lt;i&gt;flow&lt;/i&gt;. Autopair tries to do whatever makes the most sense for a given mode
(programming language etc.), but it can be tuned as well.
&lt;/p&gt;
&lt;p&gt;
After &lt;a href="http://code.google.com/p/autopair/"&gt;installation&lt;/a&gt;, you can automatically activate it for all modes with (in
your &lt;code&gt;.emacs&lt;/code&gt;):
&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;autopair&lt;/span&gt;)
(autopair-global-mode 1)
&lt;/pre&gt;



&lt;p&gt;
Now, evaluate this or restart emacs, and enjoy the autopairing-magic!
&lt;/p&gt;
&lt;p&gt;
Except for &lt;i&gt;autopairing&lt;/i&gt;, &lt;code&gt;autopair&lt;/code&gt; also takes care of &lt;i&gt;autocleaning&lt;/i&gt;; that
is, if I press &lt;b&gt;(&lt;/b&gt; it turns that into &lt;b&gt;()&lt;/b&gt; (the pairing part), and if I press
Backspace then, it removes the whole &lt;b&gt;()&lt;/b&gt; (the cleaning part). This makes
things much less annoying if you type a pair by accident. Autopairing is the
kind of thing that can get annoying quickly if it does not things exactly
right &amp;ndash; and autopair succeeds!
&lt;/p&gt;
&lt;p&gt;
Another nice trick it offers is &lt;i&gt;autowrapping&lt;/i&gt; &amp;ndash; that is, I select a &lt;b&gt;word&lt;/b&gt;,
press ", and automatically it's turned into "&lt;b&gt;word&lt;/b&gt;". To enable that, you need
to add the following:
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; autopair-autowrap t)
&lt;/pre&gt;



&lt;p&gt;
Note: you might want to see the notes below about &lt;code&gt;delete-selection-mode&lt;/code&gt;
and &lt;code&gt;cua-mode&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
Anyway, &lt;code&gt;autopair&lt;/code&gt; with autowrap makes for a really smooth editing
experience, I love it! There are two small issues for me though. First, when the cursor in front of some non-whitespace,
I'd like autopairing &lt;i&gt;not&lt;/i&gt; to happen, and second, somehow I can't seem to
get "-autopairing to work in &lt;code&gt;org-mode&lt;/code&gt;; of course, that could be my own
fault. These things might be tunable; I haven't tried very hard yet.
&lt;/p&gt;

&lt;/div&gt;

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


&lt;p&gt;
Important to mention here is that &lt;code&gt;autopair&lt;/code&gt; is (by default) not fully
compatible with &lt;a href="http://www.emacswiki.org/emacs/DeleteSelectionMode"&gt;delete-selection-mode&lt;/a&gt;. As you may know, that is the mode that
causes emacs to replace the current selection with a character typed, similar
to what most other programs do. I think many people have it enabled in their
&lt;code&gt;.emacs&lt;/code&gt; with something like:
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;(delete-selection-mode 1)
&lt;/pre&gt;



&lt;p&gt;
If you want to keep on using that together with &lt;code&gt;autopair&lt;/code&gt;, add the
following to your &lt;code&gt;.emacs&lt;/code&gt;:
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;(put 'autopair-insert-opening 'delete-selection t)
(put 'autopair-skip-close-maybe 'delete-selection t)
(put 'autopair-insert-or-skip-quote 'delete-selection t)
(put 'autopair-extra-insert-opening 'delete-selection t)
(put 'autopair-extra-skip-close-maybe 'delete-selection t)
(put 'autopair-backspace 'delete-selection 'supersede)
(put 'autopair-newline 'delete-selection t)
&lt;/pre&gt;



&lt;p&gt;
But, not that that still won't give you the &lt;code&gt;autowrap&lt;/code&gt; behavior mentioned
above. For that, we can use &lt;code&gt;cua-mode&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;cua-mode &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1_2"&gt;


&lt;p&gt;
We &lt;a href="http://emacs-fu.blogspot.com/2010/01/rectangles-and-cua.html"&gt;discussed CUA-mode before&lt;/a&gt;, focusing on its nice rectangle-editing
features. But CUA-mode can also be an alternative for
&lt;code&gt;delete-selection-mode&lt;/code&gt;, and it goes together more nicely with &lt;code&gt;autopair&lt;/code&gt;;
so, &lt;i&gt;instead&lt;/i&gt; of &lt;code&gt;delete-selection-mode&lt;/code&gt; and the &lt;code&gt;put&lt;/code&gt;'s, add the following
to your &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; cua-enable-cua-keys nil)           &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;don't add C-x,C-c,C-v
&lt;/span&gt;(cua-mode t)                             &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;for rectangles, CUA is nice
&lt;/span&gt;&lt;/pre&gt;



&lt;p&gt;
See the linked CUA-mode article for the 'why' of that first line. With this
change, &lt;code&gt;autopair&lt;/code&gt; should be working smoothly, including &lt;code&gt;autowrap&lt;/code&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;further customization &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1_3"&gt;


&lt;p&gt;
As I have hinted at, autopair can be tuned for different modes, and can
differentiate between it's behaviour in literal strings, code, comments
etc. The default are usually sane, but if you're interested, have a look at
the documentation, in particular &lt;code&gt;autopair-extra-pairs&lt;/code&gt; and the &lt;i&gt;More    tricks&lt;/i&gt;-section in the &lt;a href="http://code.google.com/p/autopair"&gt;documentation&lt;/a&gt;.
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-5801320037956802309?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/5801320037956802309/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=5801320037956802309' title='14 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/5801320037956802309'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/5801320037956802309'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2010/06/automatic-pairing-of-brackets-and.html' title='automatic pairing of brackets and quotes'/><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-3875360908688088594</id><published>2010-06-10T21:57:00.000+03:00</published><updated>2010-06-10T21:57:48.064+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'>worldcup 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;
A significant part of the world population will be watching the Football World
Cup in South-Africa this month. For people who use &lt;code&gt;org-mode&lt;/code&gt; to organize
their lives, find the schedule of all the games &lt;a href="http://lists.gnu.org/archive/html/emacs-orgmode/2010-06/msg00217.html"&gt;in this message&lt;/a&gt; I sent to the
&lt;code&gt;org-mode&lt;/code&gt; mailing list.
&lt;/p&gt;
&lt;p&gt;
In order to have the games show up in your agenda, make sure the file is in
your &lt;code&gt;org-agenda-files&lt;/code&gt;. If needed, you could add it with something like in
your &lt;code&gt;org-mode&lt;/code&gt; settings:
&lt;/p&gt;



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




&lt;p&gt;
One small issue with the schedule is that it use the South-African times, 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;uphours&lt;/span&gt; (n)
  &lt;span class="org-doc"&gt;"update all timestamps 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 (in emacs, put your cursor after the last ")"), then
press &lt;code&gt;C-x C-e&lt;/code&gt;. After that, you can go to the file with the world cup
schedule, and give an &lt;code&gt;M-x uphours&lt;/code&gt;, provide the offset for your timezone,
compare to South-African time (positive or negative).
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-3875360908688088594?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/3875360908688088594/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=3875360908688088594' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/3875360908688088594'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/3875360908688088594'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2010/06/worldcup-games-in-your-org-mode-agenda.html' title='worldcup 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>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-6529863840720914346</id><published>2010-05-20T10:29:00.003+03:00</published><updated>2010-06-06T18:18:32.624+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='updated'/><category scheme='http://www.blogger.com/atom/ns#' term='meta'/><title type='text'>100th post</title><content type='html'>&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;h2 id="sec-1"&gt;100 &lt;/h2&gt;
&lt;div class="outline-text-2" id="text-1"&gt;


&lt;p&gt;
With that &lt;a href="http://emacs-fu.blogspot.com/2010/05/using-zenburn-for-org-mode-generated.html"&gt;last post&lt;/a&gt;, emacs-fu reached the 100 posts milestone! Hurray! Thank you for all the
support, it's been a great ride so far, and there's so much more to write about - if only there
were 36 hours in a day.
&lt;/p&gt;
&lt;p&gt;
Anyway, to celebrate, I'll be off for the coming weeks (Korea), and I'm not sure if I have much
time to blog from there. So, let's take this opportunity for a small reader poll: what would &lt;b&gt;you&lt;/b&gt;
be interested to read about? More programming-related stuff, more org-mode, more about integration
with other programs, more interviews, more &amp;hellip;? 
&lt;/p&gt;
&lt;p&gt;
Please leave your ideas in the comments. I'd be interested to hear!
&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;Update&lt;/b&gt;: I am back now; thanks for all the replies. It seems that many people are interested in
CEDET. In fact, I am interested in it myself as well, but am not using it right now, so it will
take a while. For the time being, &lt;a href="http://alexott.net/en/writings/emacs-devenv/EmacsCedet.html"&gt;Alex Ott's Gentle Introduction&lt;/a&gt; might be the best way to get
started.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-6529863840720914346?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/6529863840720914346/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=6529863840720914346' title='28 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/6529863840720914346'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/6529863840720914346'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2010/05/100th-post.html' title='100th post'/><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>28</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-2585483528455545782</id><published>2010-05-20T10:15:00.003+03:00</published><updated>2010-05-20T10:18:20.316+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'>zenburn for org-mode-generated html</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 read this blog &lt;i&gt;directly&lt;/i&gt;, instead of through some aggregator or feed-reader, you can
now see the code blocks rendered in the nice &lt;i&gt;zenburn&lt;/i&gt; color theme that I &lt;a href="http://emacs-fu.blogspot.com/2010/04/zenburn-color-theme.html"&gt;discussed before&lt;/a&gt;. I'm
really enjoying it, so I added some style sheet definitions, so org-mode &lt;code&gt;#+BEGIN_SRC&lt;/code&gt; /
&lt;code&gt;#+END_SRC&lt;/code&gt; blocks look as such in the web page (and just like they look on my screen), for
instance:
&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;fibo&lt;/span&gt; (n) 
     &lt;span class="org-doc"&gt;"calculate the Nth (N&amp;gt;=0) fibonacci number in a simple yet
  inefficient way"&lt;/span&gt;
    (&lt;span class="org-keyword"&gt;cond&lt;/span&gt;
      ((= n 0) 0)
      ((= n 1) 1)
      (t (+ (fibo (- n 1)) (fibo (- n 2))))))

&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;now, gimme a list of fibo numbers 0..20
&lt;/span&gt;(mapcar 'fibo (number-sequence 0 20))
&lt;/pre&gt;




&lt;p&gt;
Note, I discussed the use of such code blocks &lt;a href="http://emacs-fu.blogspot.com/2009/05/writing-and-blogging-with-org-mode.html"&gt;earlier&lt;/a&gt;; it's one of many nice features of
&lt;code&gt;org-mode&lt;/code&gt;. Only quite &lt;i&gt;recently&lt;/i&gt; I found that I can press &lt;code&gt;C-c '&lt;/code&gt; in such a code block to edit
them in a mode-specific little buffer&amp;hellip; something new and obvious to learn every day.
&lt;/p&gt;
&lt;p&gt;
Anyhow, to get the nice zenburn-output in the generated HTML, you can use the
following CSS (note, so far I have only done the code blocks):
&lt;/p&gt;



&lt;pre class="src src-css"&gt;&lt;span class="org-comment"&gt;/* zenburnesque code blocks in for html-exported org mode */&lt;/span&gt;

&lt;span class="org-function-name"&gt;pre.src&lt;/span&gt; {
   &lt;span class="org-variable-name"&gt;background&lt;/span&gt;: #3f3f3f; &lt;span class="org-variable-name"&gt;color&lt;/span&gt;: #dcdccc; 
}

&lt;span class="org-function-name"&gt;.org-preprocessor&lt;/span&gt; {
   &lt;span class="org-variable-name"&gt;color&lt;/span&gt;: #8cd0d3;
}

&lt;span class="org-function-name"&gt;.org-preprocessor&lt;/span&gt; {
   &lt;span class="org-variable-name"&gt;color&lt;/span&gt;: #8cd0d3;
}

&lt;span class="org-function-name"&gt;.org-variable-name&lt;/span&gt; {
   &lt;span class="org-variable-name"&gt;color&lt;/span&gt;: #f0dfaf;
}

&lt;span class="org-function-name"&gt;.org-string&lt;/span&gt; {
   &lt;span class="org-variable-name"&gt;color&lt;/span&gt;: #cc9393;
}

&lt;span class="org-function-name"&gt;.org-type&lt;/span&gt; {
   &lt;span class="org-variable-name"&gt;color&lt;/span&gt;: #dfdfbf;
   &lt;span class="org-variable-name"&gt;font-weight&lt;/span&gt;: bold;
}

&lt;span class="org-function-name"&gt;.org-function-name&lt;/span&gt; {
   &lt;span class="org-variable-name"&gt;color&lt;/span&gt;: #8cd0d3;
   &lt;span class="org-variable-name"&gt;font-weight&lt;/span&gt;: bold;
}

&lt;span class="org-function-name"&gt;.org-keyword&lt;/span&gt; {
   &lt;span class="org-variable-name"&gt;color&lt;/span&gt;: #f0dfaf;
   &lt;span class="org-variable-name"&gt;font-weight&lt;/span&gt;: bold;
}

&lt;span class="org-function-name"&gt;.org-comment&lt;/span&gt; {
   &lt;span class="org-variable-name"&gt;color&lt;/span&gt;: #7f9f7f;
}

&lt;span class="org-function-name"&gt;.org-doc&lt;/span&gt; {
   &lt;span class="org-variable-name"&gt;color&lt;/span&gt;: #afd8af;
}

&lt;span class="org-function-name"&gt;.org-comment-delimiter&lt;/span&gt; {
   &lt;span class="org-variable-name"&gt;color&lt;/span&gt;: #708070;
}

&lt;span class="org-function-name"&gt;.org-constant&lt;/span&gt; {
   &lt;span class="org-variable-name"&gt;color&lt;/span&gt;: #dca3ac;
   &lt;span class="org-variable-name"&gt;font-weight&lt;/span&gt;:bold;
}

&lt;span class="org-function-name"&gt;.org-builtin&lt;/span&gt; {
   &lt;span class="org-variable-name"&gt;color&lt;/span&gt;: #7f9f7f;
}
&lt;/pre&gt;



&lt;p&gt;
You can save the above CSS-blob in a file (say, &lt;code&gt;zenburn-code.css&lt;/code&gt;), and set
the style sheet for the org-html export by putting a &lt;code&gt;#+STYLE:&lt;/code&gt;-line in your
&lt;code&gt;org&lt;/code&gt; files:
&lt;/p&gt;


&lt;pre class="src src-org"&gt;&lt;span class="org-org-meta-line"&gt;#+STYLE: &amp;lt;link rel="stylesheet" type="text/css" href="zenburn-code.css" /&amp;gt;&lt;/span&gt;
&lt;/pre&gt;


&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-2585483528455545782?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/2585483528455545782/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=2585483528455545782' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/2585483528455545782'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/2585483528455545782'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2010/05/using-zenburn-for-org-mode-generated.html' title='zenburn for org-mode-generated html'/><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>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-1485620013314216183</id><published>2010-05-14T20:22:00.001+03:00</published><updated>2010-05-14T20:23:03.808+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><title type='text'>emacs 23.2</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://permalink.gmane.org/gmane.emacs.announce/17"&gt;Recently&lt;/a&gt;, emacs version &lt;b&gt;23.2&lt;/b&gt; was released. It's a quick update after &lt;a href="http://emacs-fu.blogspot.com/2009/07/emacs-23-is-very-near.html"&gt;23.1 came out&lt;/a&gt; (July 29 of 2009); it seems Chong Yidong / Stefan Monnier
(&lt;a href="http://emacs-fu.blogspot.com/2009/08/interview-with-chong-yidong-and-stefan.html"&gt;interview&lt;/a&gt;) are doing releases more often than before they took over emacs
maintainership. A welcome change, I would say.

&lt;/p&gt;
&lt;p&gt;
The amount of changes is obviously also a bit smaller than in 23.1, but
there are still some interesting updates. Let's go through a couple of those
here; I am not striving for completeness, and I won't really go into the
biggest change (inclusion of the &lt;a href="http://cedet.sourceforge.net/"&gt;CEDET&lt;/a&gt; IDE-framework), as I haven't been
using that enough to say anything about it. Instead, let's look at some of
the other highlights; for the full list of changes, please refer to the
&lt;a href="http://www.gnu.org/software/emacs/NEWS.23.2"&gt;NEWS&lt;/a&gt;-file. If you have some other cool new feature that deserves mentioning,
please add a comment.
&lt;/p&gt;

&lt;/div&gt;

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

&lt;ul&gt;
&lt;li&gt;
Maximum file size increased to 512Mb (this used to be 256 on 32-bit
machines). This may be useful for big log files etc. It does take a while
to load such big files, but after that it's not too slow, at least if you
have enough RAM. For 'normal' files, you're unlikely to ever hit the
limit; e.g. Tolstoy's &lt;a href="http://www.gutenberg.org/files/2600/2600.txt"&gt;War and Peace&lt;/a&gt; is only 3 MB&amp;hellip; 

&lt;p&gt;
Note, you can set &lt;code&gt;large-file-warning-threshold&lt;/code&gt; to set the maximum file
size after which emacs will starting asking you for confirmation when
trying to open (eh, &lt;i&gt;visit&lt;/i&gt;) files.
&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
By default, the mouse cursor turns invisible when typing, so there is no
more need for &lt;code&gt;mouse-avoidance-mode&lt;/code&gt; and similar tricks. However, if you
insist on seeing the mouse cursor, you can add to your &lt;code&gt;.emacs&lt;/code&gt;:

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


&lt;pre class="src src-emacs-lisp"&gt;(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; make-pointer-invisible nil)
&lt;/pre&gt;



&lt;ul&gt;
&lt;li&gt;
On X-based systems, emacs now listens for font changes (Xft), and can
automatically use the GNOME mono-spaced font (as set in the GNOME
&lt;i&gt;Appearance preferences&lt;/i&gt; dialog). Note that this may not work for all
fonts/settings (at least in my tests, setting the font to &lt;i&gt;italic&lt;/i&gt; does
not seem to reflect in emacs). Anyway, to enable this, put the following
in your &lt;code&gt;.emacs&lt;/code&gt; (or the moral equivalent):

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


&lt;pre class="src src-emacs-lisp"&gt;(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; font-use-system-font t)
&lt;/pre&gt;




&lt;ul&gt;
&lt;li&gt;
On Unix, Emacs 23.2 now follows the &lt;a href="http://www.freedesktop.org/wiki/Specifications/trash-spec"&gt;freedesktop trash specification&lt;/a&gt; for
file deletion; thus, the hacks we &lt;a href="http://emacs-fu.blogspot.com/2009/05/using-systems-trash-when-deleting-files.html"&gt;hacks we mentioned before&lt;/a&gt; are no longer
needed.


&lt;/li&gt;
&lt;li&gt;
Some cool additions for &lt;a href="http://www.gnu.org/software/tramp/"&gt;Tramp&lt;/a&gt;, allowing emacs to access files in &lt;code&gt;rsync&lt;/code&gt;
and even &lt;code&gt;imap://&lt;/code&gt;-locations. On systems supporting &lt;a href="http://en.wikipedia.org/wiki/GVFS"&gt;GVFS&lt;/a&gt;, emacs can now
directly use e.g. &lt;code&gt;obex://&lt;/code&gt;-uris (Bluetooth). I need to play a bit with
these things! Tramp support has also been built into &lt;code&gt;eshell&lt;/code&gt;.

&lt;/li&gt;

&lt;li&gt;
There are already quite some ways to do auto-completion in emacs using the
&lt;code&gt;TAB&lt;/code&gt;-key, and emacs 23.2 makes this a bit easier to set up. You can add
basic auto-completion with:


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


&lt;pre class="src src-emacs-lisp"&gt;(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; tab-always-indent 'complete)
&lt;/pre&gt;




&lt;ul&gt;
&lt;li&gt;
After setting that, the &lt;code&gt;TAB&lt;/code&gt;-key will (after trying if there's anything to
indent first) provide possible completions. It works pretty well for
Emacs-Lisp (I did not test other languages), although the way it shows the
completions (separate &lt;code&gt;*Completions*&lt;/code&gt;-buffer) is a bit clumsier that what
for instance &lt;code&gt;yasnippet&lt;/code&gt; or &lt;code&gt;company-mode&lt;/code&gt; do.

&lt;/li&gt;
&lt;li&gt;
You can also do partial completions now, by appending &lt;code&gt;initials&lt;/code&gt; to the
completion style, i.e.:



&lt;/li&gt;
&lt;/ul&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;there must be a more elegant way...
&lt;/span&gt;(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; completion-styles (append completion-style '(initials)))
&lt;/pre&gt;




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

With this, you can complete on the initials of functions and variables in
the minibuffer, say, typing &lt;code&gt;C-h v tai&lt;/code&gt; and then pressing &lt;code&gt;TAB&lt;/code&gt; will give
you &lt;code&gt;tab-always-indent&lt;/code&gt;.

&lt;/li&gt;
&lt;li&gt;
As mentioned, the biggest change is the addition on the CEDET-framework,
which contains things like smart completion, code browsing, UML diagram
creation, project management &amp;ndash; features somewhat similar to those in
e.g. Eclipse. I don't know how well it works in practice, but I will give
it a try. At least, inclusion in Emacs should make setting it up with all
dependencies a bit easier, as there is now a guaranteed-to-work setup for
Emacs 23.2 at least.

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

&lt;p&gt;Summarizing, 23.2 provides us with some nice updates all around and brings
CEDET to the masses. Chong Yidong / Stefan Monnier have done a very good job
in making faster releases, while still keeping an eye on the quality. On the
other hand, the previous version (23.1) is a very solid release, and if you
don't need CEDET, there is no real need to hurry to 23.2.
&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;Future releases &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1_2"&gt;


&lt;p&gt;
A lot is happening in the world of GNU/Emacs, with changes being proposed
and implemented in many different places. There's Eli Zaretskii's way work
on making emacs support bidirectional languages (for right-to-left writing
systems such as Hebrew and Arabic; the /bi/directional part is that one
should be able to mix left-to-right and right-to-left). There is Jan
DjÃ¤rv's work on adding UI-tabs to emacs (like e.g. Firefox has them). There
is Ken Raeburn and Andy Wingo's work on &lt;a href="http://wingolog.org/archives/2010/04/02/recent-developments-in-guile"&gt;adding Guile Scheme support to emacs&lt;/a&gt; - possibly replacing the current Emacs Lisp implementation in the
future. These are just a few of the more prominent projects.

&lt;/p&gt;
&lt;p&gt;
Nobody knows in which release these items will be available (if at all),
but it's exciting to see all the directions people are taking emacs.
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-1485620013314216183?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/1485620013314216183/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=1485620013314216183' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/1485620013314216183'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/1485620013314216183'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2010/05/emacs-232.html' title='emacs 23.2'/><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-5564809285695465242</id><published>2010-05-12T00:02:00.005+03:00</published><updated>2010-05-12T07:33:42.360+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><title type='text'>cleaning up the mode-line</title><content type='html'>Emacs' version on a status-bar is called the &lt;i&gt;mode-line&lt;/i&gt;, and contains all
kind of information – the current buffer name, the cursor position and a
lot of other things, depending on what major and minor modes are active.
&lt;br /&gt;
&lt;br /&gt;
Customizing the mode-line is, unfortunately, rather hard. One day, I'll
write something about that… but for now at least we may be able to improve
things a little bit, by reducing mode line pollution. Mode line pollution?
Well, many parts of emacs like to announce their presence and state in the
mode line. With the limited space available there, this can become a bit of
an issue, the &lt;code&gt;(Lisp Interaction company Yas abbrev)&lt;/code&gt; takes quite some
space:
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/_kGFGcbwevHE/S-nFoazJCiI/AAAAAAAAAgU/JhitOq7NHLg/s1600/Screenshot-djcb%40mindcrime.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="86" src="http://2.bp.blogspot.com/_kGFGcbwevHE/S-nFoazJCiI/AAAAAAAAAgU/JhitOq7NHLg/s400/Screenshot-djcb%40mindcrime.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
But there are some ways to limit the space taken by modes and
minor-modes. Note, these snippets should go in your &lt;tt&gt;.emacs&lt;/tt&gt;, and you need to restart emacs to make them active.&lt;br /&gt;
&lt;br /&gt;
First, the minor modes (note, you can see the currently activated
ones with &lt;code&gt;C-h m&lt;/code&gt;); install the handy &lt;a href="http://www.eskimo.com/~seldon/diminish.el"&gt;diminish.el&lt;/a&gt; (or get it using the &lt;tt&gt;emacs-goodies-el&lt;/tt&gt; package when using Debian/Ubuntu&lt;/tt&gt;) and add something like the following:
&lt;br /&gt;
&lt;pre class="src src-emacs-lisp"&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;diminish&lt;/span&gt; nil 'noerror)
  (&lt;span class="org-keyword"&gt;eval-after-load&lt;/span&gt; &lt;span class="org-string"&gt;"company"&lt;/span&gt;
      '(diminish 'company-mode &lt;span class="org-string"&gt;"Cmp"&lt;/span&gt;))
  (&lt;span class="org-keyword"&gt;eval-after-load&lt;/span&gt; &lt;span class="org-string"&gt;"abbrev"&lt;/span&gt;
    '(diminish 'abbrev-mode &lt;span class="org-string"&gt;"Ab"&lt;/span&gt;))
  (&lt;span class="org-keyword"&gt;eval-after-load&lt;/span&gt; &lt;span class="org-string"&gt;"yasnippet"&lt;/span&gt;
    '(diminish 'yas/minor-mode &lt;span class="org-string"&gt;"Y"&lt;/span&gt;)))
&lt;/pre&gt;
&lt;br /&gt;
And the major-modes, for example for Emacs Lisp mode:
&lt;br /&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-keyword"&gt;setq&lt;/span&gt; mode-name &lt;span class="org-string"&gt;"el"&lt;/span&gt;)))&amp;nbsp;&lt;/pre&gt;
This looks a bit shorter:
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/_kGFGcbwevHE/S-nFycNVGSI/AAAAAAAAAgc/zgzXi8UqM4Y/s1600/Screenshot-djcb%40mindcrime-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="102" src="http://2.bp.blogspot.com/_kGFGcbwevHE/S-nFycNVGSI/AAAAAAAAAgc/zgzXi8UqM4Y/s400/Screenshot-djcb%40mindcrime-1.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
You can of course set these names to whatever is obvious to you.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-5564809285695465242?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/5564809285695465242/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=5564809285695465242' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/5564809285695465242'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/5564809285695465242'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2010/05/cleaning-up-mode-line.html' title='cleaning up 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://2.bp.blogspot.com/_kGFGcbwevHE/S-nFoazJCiI/AAAAAAAAAgU/JhitOq7NHLg/s72-c/Screenshot-djcb%40mindcrime.png' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-2273904079063818539</id><published>2010-04-27T22:38:00.003+03:00</published><updated>2010-04-28T07:35:52.081+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><title type='text'>navigating the kill-ring</title><content type='html'>&lt;p&gt;The &lt;code&gt;kill-ring&lt;/code&gt; is emacs' implementation of a copy-paste-clipboard. As
expected, it's more powerful than what most other editors offer - but at the
same time, it may be a bit hard to use. We already discussed the &lt;code&gt;kill-ring&lt;/code&gt;
in the &lt;a href="http://emacs-fu.blogspot.com/2009/01/kill-ring.html"&gt;Emacs-Fu prehistory&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
One of the more powerful features of the emacs kill-ring is that is allows for
&lt;i&gt;multiple&lt;/i&gt; entries to be saved there. You can then retrieve those older
entries by using &lt;i&gt;prefix arguments&lt;/i&gt;, that is: &lt;code&gt;C-y&lt;/code&gt; will retrieve the last
item from the kill-ring, while &lt;code&gt;M-&lt;/code&gt; &lt;i&gt;n&lt;/i&gt; &lt;code&gt;C-y&lt;/code&gt; will retrieve the &lt;i&gt;n&lt;/i&gt; &lt;sup&gt;th&lt;/sup&gt; last
stretch of 'killed' (cut/copied) text. For example, &lt;code&gt;M-2 C-y&lt;/code&gt; will retrieve
the second last one.
&lt;/p&gt;
&lt;p&gt;
Unfortunately, for most people it's quite hard to remember what was 'killed'
and when and in what order&amp;hellip; Those people can of course use the menu
(Edit/Paste from kill menu), but that is not always so convenient, requires
mousing around etc. 
&lt;/p&gt;
&lt;p&gt;
Edit: As &lt;code&gt;Anynomous&lt;/code&gt; mentions in the comments, one can of course use &lt;code&gt;M-y&lt;/code&gt; to
circle through the candidates. This is quite
useful, esp. when you have only a few items in the ring. Note, this command
only works just after a 'yank' (&lt;code&gt;C-y&lt;/code&gt;).
&lt;/p&gt;

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


&lt;p&gt;
Instead, using the handy &lt;code&gt;browse-kill-ring&lt;/code&gt; extension, you can open a buffer
which lists the contents of the kill ring, and you can move your cursor to the
desired item and insert it.
&lt;/p&gt;
&lt;p&gt;
Installation in simple; first get the &lt;code&gt;browse-kill-ring&lt;/code&gt; package &lt;a href="http://www.emacswiki.org/emacs/browse-kill-ring.el"&gt;from EmacsWiki&lt;/a&gt;, or, alternatively, Debian/Ubuntu users can install the
&lt;code&gt;emacs-goodies-el&lt;/code&gt;-package.
&lt;/p&gt;
&lt;p&gt;
Then, add to your &lt;code&gt;.emacs&lt;/code&gt; something like:
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&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;browse-kill-ring&lt;/span&gt; nil 'noerror)
  (browse-kill-ring-default-keybindings))
&lt;/pre&gt;



&lt;p&gt;
Now, the &lt;code&gt;M-y&lt;/code&gt; key binding will activate &lt;code&gt;browse-kill-ring&lt;/code&gt; iff the &lt;i&gt;normal behavior&lt;/i&gt; (see above) is not available, i.e., when the last command was &lt;b&gt;not&lt;/b&gt; a
'yank'.  You can also edit the kill-ring (press &lt;code&gt;C-h m&lt;/code&gt; when in the
&lt;code&gt;browse-kill-ring&lt;/code&gt;-buffer to see the available bindings).
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-2" class="outline-3"&gt;
&lt;h3 id="sec-2"&gt;a little pop-up menu &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-2"&gt;


&lt;p&gt;
While browsing EmacsWiki, I found another trick:
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;(global-set-key &lt;span class="org-string"&gt;"\C-cy"&lt;/span&gt; '(&lt;span class="org-keyword"&gt;lambda&lt;/span&gt; ()
   (interactive)
   (popup-menu 'yank-menu)))
&lt;/pre&gt;



&lt;p&gt;
After which &lt;code&gt;C-c y&lt;/code&gt; will show a little pop-up menu with the your kill-menu
entries. It does not seem to fully synchronize with the (possibly edited)
entries you get from &lt;code&gt;browse-kill-ring&lt;/code&gt;, but it's a pretty neat way to
navigate through your kill-ring-buffers &amp;ndash; if you don't have too many of them
(if so, you could customize the &lt;code&gt;kill-ring-max&lt;/code&gt; variable).
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-2273904079063818539?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/2273904079063818539/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=2273904079063818539' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/2273904079063818539'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/2273904079063818539'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2010/04/navigating-kill-ring.html' title='navigating the kill-ring'/><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-7776999996134947941</id><published>2010-04-18T20:35:00.003+03:00</published><updated>2010-04-18T20:48:07.459+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><title type='text'>creating custom modes the easy way with generic-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;
Syntax highlighting is useful when editing configuration files, programs and
so on, as it helps to prevent errors and makes it easier to quickly scan
documents.
&lt;/p&gt;
&lt;p&gt;
Emacs supports syntax highlighting (&lt;i&gt;font locking&lt;/i&gt; in emacs lingo) for many
different file types. For many common cases (e.g. editing for many programming
languages, &lt;code&gt;org-mode&lt;/code&gt;), emacs' support goes much further than merely
colorizing keywords, and offers all kinds of 'magic' (auto-completion,
'electricity', special key bindings, &amp;hellip;). For some other file types, at least
keywords are given some different color.
&lt;/p&gt;
&lt;p&gt;
Still, there are files that are &lt;i&gt;not&lt;/i&gt; recognized by emacs as having some
special format; these are displayed as plain text. This may be the case for
less-common configuration files, or your own specific formats.
&lt;/p&gt;
&lt;p&gt;
Defining a full 'mode' for such file types can be a lot of work. Fortunately,
emacs offers a easier way: &lt;code&gt;generic-mode&lt;/code&gt;. &lt;code&gt;generic-mode&lt;/code&gt; defines a whole lot
of mode of modes for common formats, but also defines the
&lt;code&gt;define-generic-mode&lt;/code&gt; macro to create your own modes.
&lt;/p&gt;
&lt;p&gt;
Suppose we have a little language called &lt;code&gt;foo&lt;/code&gt;; a typical &lt;code&gt;foo&lt;/code&gt;-file might
look something like:
&lt;/p&gt;


&lt;pre class="src src-text"&gt;!! this is a comment
account=foo; !! another comment
user=jimmy;
password=$3cre7;
&lt;/pre&gt;



&lt;p&gt;
Using &lt;code&gt;define-generic-mode&lt;/code&gt;, we can easily define a mode for this:
&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;generic-x&lt;/span&gt;) &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;we need this
&lt;/span&gt;
(&lt;span class="org-keyword"&gt;define-generic-mode&lt;/span&gt; 
  'foo-mode                         &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;name of the mode to create
&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;comments start with '!!'
&lt;/span&gt;  '(&lt;span class="org-string"&gt;"account"&lt;/span&gt; &lt;span class="org-string"&gt;"user"&lt;/span&gt; 
    &lt;span class="org-string"&gt;"password"&lt;/span&gt;)                     &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;some keywords
&lt;/span&gt;  '((&lt;span class="org-string"&gt;"="&lt;/span&gt; . 'font-lock-operator)     &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;'=' is an operator
&lt;/span&gt;    (&lt;span class="org-string"&gt;";"&lt;/span&gt; . 'font-lock-builtin))     &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;';' is a a built-in 
&lt;/span&gt;  '(&lt;span class="org-string"&gt;"\\.foo$"&lt;/span&gt;)                      &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;files for which to activate this mode 
&lt;/span&gt;   nil                              &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;other functions to call
&lt;/span&gt;  &lt;span class="org-doc"&gt;"A mode for foo files"&lt;/span&gt;            &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;doc string for this mode
&lt;/span&gt;)
&lt;/pre&gt;


&lt;p&gt;
Now, this will look something like this (if necessary, see the &lt;a href="http://emacs-fu.blogspot.com/2010/04/creating-custom-modes-easy-way-with.html"&gt;colorized version&lt;/a&gt;):
&lt;/p&gt;


&lt;pre class="src src-foo"&gt;&lt;span class="org-comment-delimiter"&gt;!! &lt;/span&gt;&lt;span class="org-comment"&gt;this is a comment
&lt;/span&gt;&lt;span class="org-keyword"&gt;account&lt;/span&gt;&lt;span class="org-operator"&gt; = &lt;/span&gt;foo&lt;span class="org-builtin"&gt;;&lt;/span&gt; &lt;span class="org-comment-delimiter"&gt;!! &lt;/span&gt;&lt;span class="org-comment"&gt;another comment
&lt;/span&gt;&lt;span class="org-keyword"&gt;user&lt;/span&gt;&lt;span class="org-operator"&gt; = &lt;/span&gt;jimmy&lt;span class="org-builtin"&gt;;&lt;/span&gt;
&lt;span class="org-keyword"&gt;password&lt;/span&gt;&lt;span class="org-operator"&gt; = &lt;/span&gt;$3cre7&lt;span class="org-builtin"&gt;;&lt;/span&gt;
&lt;/pre&gt;


&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-7776999996134947941?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/7776999996134947941/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=7776999996134947941' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/7776999996134947941'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/7776999996134947941'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2010/04/creating-custom-modes-easy-way-with.html' title='creating custom modes the easy way with generic-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>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-6991806489664012099</id><published>2010-04-04T13:48:00.001+03:00</published><updated>2010-04-04T13:53:37.347+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><title type='text'>the zenburn color theme</title><content type='html'>&lt;div class="outline-2" id="outline-container-1"&gt;
&lt;div class="outline-text-2" id="text-1"&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/_kGFGcbwevHE/S7hudg01isI/AAAAAAAAAfw/-jq5xEoP9LA/s1600/zenburn.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_kGFGcbwevHE/S7hudg01isI/AAAAAAAAAfw/-jq5xEoP9LA/s320/zenburn.png" /&gt;&lt;/a&gt;&lt;/div&gt;
A popular way to customize emacs is changing its &lt;i&gt;color scheme&lt;/i&gt;, as already
discussed &lt;a href="http://emacs-fu.blogspot.com/2009/03/color-theming.html"&gt;color theming&lt;/a&gt;. Until recently, I was using an evolved version of the
color theme presented there, '&lt;code&gt;djcb-dark&lt;/code&gt;'. It works for me but, admittedly,
it's a bit ugly.&lt;br /&gt;
&lt;br /&gt;
But recently, in a post to the &lt;a href="http://emacs-fu.blogspot.com/2009/06/e-mail-with-wanderlust.html"&gt;Wanderlust&lt;/a&gt; mailing list, someone mentioned a
color theme called &lt;i&gt;Zenburn&lt;/i&gt;. &lt;a href="http://slinky.imukuppi.org/zenburnpage/"&gt;Zenburn&lt;/a&gt; started its life as a color scheme for

&lt;code&gt;vim&lt;/code&gt;, around 2002. The explicit goal was to have a pleasant theme that is
light on the eyes, and allows you to stay 'in the zone' for long stretches of
time. People liked it, and version for many other programs were made,
&lt;a href="http://brockman.se/2003/zenburn/"&gt;including emacs&lt;/a&gt;.
&lt;br /&gt;
&lt;br /&gt;
I've been using Zenburn for the last few weeks, and I really like it. I used
to think that 'low-contrast' would mean that things are not really clear; but
the opposite seems true. Anyway, the screen shot says more than a thousand
words I suppose…
&lt;br /&gt;
&lt;br /&gt;
Zenburn-for-emacs (written by Daniel Brockman) can be found at the link
above. I've sent my updates to him of course, but as it may take a while for
the 'official' version to be updated, I've put my version on
Emacswiki: &lt;a href="http://www.emacswiki.org/emacs/ColorThemeZenburn"&gt;ZenburnColorTheme&lt;/a&gt;. The changes are the support for Wanderlust,
&lt;code&gt;hi-line&lt;/code&gt; (for &lt;a href="http://emacs-fu.blogspot.com/2008/12/highlighting-current-line.html"&gt;highlighting the current line&lt;/a&gt;) , &lt;code&gt;magit&lt;/code&gt; and &lt;a href="http://emacs-fu.blogspot.com/2009/07/keeping-related-buffers-together-with.html"&gt;&lt;code&gt;elscreen&lt;/code&gt;&lt;/a&gt;; also,
I made selected (eh, &lt;i&gt;transiently marked regions&lt;/i&gt;) not loose their foreground
color.

&lt;br /&gt;
&lt;br /&gt;
Note, the theme is not yet part of the &lt;code&gt;color-theme&lt;/code&gt; package, but does require
it.
&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-6991806489664012099?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/6991806489664012099/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=6991806489664012099' title='35 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/6991806489664012099'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/6991806489664012099'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2010/04/zenburn-color-theme.html' title='the zenburn color theme'/><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/_kGFGcbwevHE/S7hudg01isI/AAAAAAAAAfw/-jq5xEoP9LA/s72-c/zenburn.png' height='72' width='72'/><thr:total>35</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-2461533492060024024</id><published>2010-03-20T13:34:00.001+02:00</published><updated>2010-03-20T13:35:50.591+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><title type='text'>showing the buffer position in 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;
I do quite a bit of &lt;a href="http://emacs-fu.blogspot.com/2009/12/scrolling.html"&gt;scrolling&lt;/a&gt; in emacs, but I hardly ever use the scroll bar
for that. The main reason for still having the scroll bar is that it gives me
some indication where I am in the buffer. Of course, there is some information
in the mode-line, and you can get some more with &lt;code&gt;size-indication-mode&lt;/code&gt;, but
it's not as immediately obvious as the scroll bar.
&lt;br /&gt;
But recently, I discovered Lennart Borgman's &lt;a href="http://www.emacswiki.org/emacs/SmlModeLine"&gt;&lt;code&gt;sml-modeline&lt;/code&gt;&lt;/a&gt;, which
combines all of the scroll bar information into a nice visual indication on
the modeline, and I have been happily using it, and got rid of my scroll bar.
&lt;br /&gt;
Put you &lt;code&gt;sml-modeline&lt;/code&gt; in your &lt;code&gt;load-path&lt;/code&gt;, and the following fragment in your
&lt;code&gt;.emacs&lt;/code&gt; should do the trick:
&lt;br /&gt;
&lt;pre class="src src-emacs-lisp"&gt;(&lt;span class="org-keyword"&gt;if&lt;/span&gt; (&lt;span class="org-keyword"&gt;require&lt;/span&gt; '&lt;span class="org-constant"&gt;sml-modeline&lt;/span&gt; nil 'noerror)    &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;use sml-modeline if available
&lt;/span&gt;  (&lt;span class="org-keyword"&gt;progn&lt;/span&gt; 
    (sml-modeline-mode 1)                   &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;show buffer pos in the mode line
&lt;/span&gt;    (scroll-bar-mode -1))                   &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;turn off the scrollbar
&lt;/span&gt;  (scroll-bar-mode 1)                       &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;otherwise, show a scrollbar...
&lt;/span&gt;  (set-scroll-bar-mode 'right))             &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;... on the right
&lt;/span&gt;&lt;/pre&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/_kGFGcbwevHE/S6SyadxiEGI/AAAAAAAAAfQ/BkUJ-ujYICU/s1600-h/bufpos.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_kGFGcbwevHE/S6SyadxiEGI/AAAAAAAAAfQ/BkUJ-ujYICU/s320/bufpos.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Note, there is a older version available in Emacswiki which has some problems
(such as conflicting with the &lt;a href="http://www.smlnj.org/doc/Emacs/sml-mode.html"&gt;Standard ML editing mode&lt;/a&gt; for emacs); thus, for
now it's better to us the &lt;a href="http://bazaar.launchpad.net/%7Enxhtml/nxhtml/main/annotate/head%3A/util/sml-modeline.el"&gt;Launchpad version&lt;/a&gt;; the instructions above apply to
that version.
&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-2461533492060024024?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/2461533492060024024/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=2461533492060024024' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/2461533492060024024'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/2461533492060024024'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2010/03/showing-buffer-position-in-mode-line.html' title='showing the buffer position in 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://2.bp.blogspot.com/_kGFGcbwevHE/S6SyadxiEGI/AAAAAAAAAfQ/BkUJ-ujYICU/s72-c/bufpos.png' height='72' width='72'/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-4807516215162297206</id><published>2010-03-08T20:24:00.001+02:00</published><updated>2010-03-08T22:32:08.881+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><title type='text'>cleaning up buffers automatically</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/2010/02/dealing-with-many-buffers-ibuffer.html"&gt;Recently, I discussed&lt;/a&gt; some ways to deal with large numbers of buffers. Maybe
we can also take a step back and ask why we have so many buffers in the first
place - do we really need all of them?
&lt;/p&gt;
&lt;p&gt;
Well, the obvious answer is: &lt;i&gt;probably not&lt;/i&gt;. After a few days of
&lt;code&gt;(emacs-uptime)&lt;/code&gt; there are all kinds of temporary output buffers, man pages
and unchanged buffers you haven't touched in a long time. Let's get rid of
those!
&lt;/p&gt;

&lt;/div&gt;

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


&lt;p&gt;
For this very purpose, emacs provides &lt;code&gt;midnight-mode&lt;/code&gt; (as has done so for more
than a decade). At midnight, it looks at all the buffers, and determines which
of the buffers are no longer in use, and closes ('kills') them. Regardless of
its name, this cleanup does not &lt;i&gt;necessarily&lt;/i&gt; have to take place at midnight,
but could be invoked at any time.
&lt;/p&gt;
&lt;p&gt;
Setup is easy, just put the following in your &lt;code&gt;.emacs&lt;/code&gt;:
&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;midnight&lt;/span&gt;)
&lt;/pre&gt;



&lt;p&gt;
Clearly, the package was designed for emacs instances that are running for
&lt;i&gt;long&lt;/i&gt; times &amp;ndash; for example, by default it clears buffers after having been
inactive for &lt;b&gt;3 days&lt;/b&gt;. I'm not sure if that use case is very common today.
Anyway, you can change it by setting &lt;code&gt;clean-buffer-list-delay-general&lt;/code&gt; (which
takes the number of &lt;b&gt;days&lt;/b&gt; before a buffer becomes eligible for killing).
&lt;/p&gt;
&lt;p&gt;
You can ask &lt;code&gt;midnight-mode&lt;/code&gt; to clean-up unused buffers &lt;b&gt;right now&lt;/b&gt; with &lt;code&gt;M-x clean-buffer-list&lt;/code&gt;. Also, you can use some variables to control which buffers
are to be killed, and which ones specifically not:
&lt;/p&gt;


&lt;pre class="example"&gt;clean-buffer-list-kill-buffer-names
clean-buffer-list-kill-never-buffer-names
clean-buffer-list-kill-regexps
clean-buffer-list-kill-never-regexps
&lt;/pre&gt;



&lt;p&gt;
To run &lt;code&gt;clean-buffer-list&lt;/code&gt; every &lt;i&gt;n&lt;/i&gt; minutes or so, you could use
&lt;code&gt;run-at-time&lt;/code&gt;, left as an exercise to the reader.
&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;tempbuf &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1.2"&gt;


&lt;p&gt;
Another way to accomplish roughly the same is &lt;a href="http://www.emacswiki.org/emacs/TempbufMode"&gt;TempbufMode&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
It seems a bit better equipped for shorter cleanup interval, and you have some
killed. However, that requires you to add it to the modes where you'd like to
more influence on the algorithm it uses to decide whether a buffer may be use
it, something like:
&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;download tempbuf: http://www.emacswiki.org/emacs/tempbuf.el
&lt;/span&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;tempbuf&lt;/span&gt; nil 'noerror) 
  (&lt;span class="org-keyword"&gt;add-hook&lt;/span&gt; 'custom-mode-hook 'turn-on-tempbuf-mode)
  (&lt;span class="org-keyword"&gt;add-hook&lt;/span&gt; 'w3-mode-hook 'turn-on-tempbuf-mode)
  (&lt;span class="org-keyword"&gt;add-hook&lt;/span&gt; 'Man-mode-hook 'turn-on-tempbuf-mode)
  (&lt;span class="org-keyword"&gt;add-hook&lt;/span&gt; 'view-mode-hook 'turn-on-tempbuf-mode))
&lt;/pre&gt;



&lt;p&gt;
Side-note: I'm using the &lt;code&gt;(when (require 'tempbuf nil 'noerror) ... )&lt;/code&gt; pattern
here to make sure that my &lt;code&gt;.emacs&lt;/code&gt; also works when &lt;code&gt;tempbuf&lt;/code&gt; is not available.
&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;Added&lt;/b&gt;: for cleaning-up your buffer list &lt;em&gt;non&lt;/em&gt;-automatically, you can simply
use &lt;code&gt;M-x kill-some-buffers&lt;/code&gt;. (Thanks Susan!). Or you can use &lt;code&gt;C-x C-b&lt;/code&gt;.
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-4807516215162297206?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/4807516215162297206/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=4807516215162297206' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/4807516215162297206'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/4807516215162297206'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2010/03/cleaning-up-buffers-automatically.html' title='cleaning up buffers automatically'/><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-246570950774488454</id><published>2010-02-23T20:06:00.003+02:00</published><updated>2010-06-14T12:26:12.665+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='updated'/><category scheme='http://www.blogger.com/atom/ns#' term='wanderlust'/><category scheme='http://www.blogger.com/atom/ns#' term='e-mail'/><title type='text'>wanderlust iii</title><content type='html'>&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;h2 id="sec-1"&gt;Wanderlust &lt;/h2&gt;
&lt;div class="outline-text-2" id="text-1"&gt;


&lt;p&gt;
I have been using the &lt;a href="http://www.gohome.org/wl/"&gt;Wanderlust E-mail client&lt;/a&gt; for almost a year now, and I
am very happy with it. In previous postings I already discussed &lt;a href="http://emacs-fu.blogspot.com/2009/06/e-mail-with-wanderlust.html"&gt;setup&lt;/a&gt; and
some &lt;a href="http://emacs-fu.blogspot.com/2009/09/wanderlust-tips-and-tricks.html"&gt;tips and tricks&lt;/a&gt;; and I also had somewhat related posts on &lt;a href="http://emacs-fu.blogspot.com/2009/08/managing-e-mail-addresses-with-bbdb.html"&gt;bbdb&lt;/a&gt; (the
address book) and &lt;a href="http://emacs-fu.blogspot.com/2009/11/showing-pop-ups.html"&gt;warning you about new mail&lt;/a&gt;. But I think it's time for an
update.
&lt;/p&gt;

&lt;/div&gt;

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


&lt;p&gt;
One question that I have received quite a few times was about the
&lt;i&gt;maintenance&lt;/i&gt; of Wanderlust; it's may be a nice e-mail client, but little
seems to have happened in the last few years. It's reasonable concern.
&lt;/p&gt;
&lt;p&gt;
Fortunately, it seems the situation has improved significantly. There's
more traffic on the mailing lists, both from old and new users. Various
improvements are circulating; the place to get the latest stuff is in David
Abrahams' git-repository: &lt;a href="http://github.com/dabrahams/semi"&gt;semi&lt;/a&gt;, &lt;a href="http://github.com/dabrahams/flim"&gt;flim&lt;/a&gt;, &lt;a href="http://github.com/dabrahams/apel"&gt;apel&lt;/a&gt; and &lt;a href="http://github.com/dabrahams/wanderlust"&gt;wanderlust&lt;/a&gt;. The plan is to
gradually apply the changes to the upstream (CVS) repository.
&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;bugs &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1_2"&gt;


&lt;p&gt;
Although I have been quite happy with Wanderlust, there was one &lt;a href="http://debbugs.gnu.org/cgi/bugreport.cgi%3Fmsg=8;bug=5534"&gt;bug #5534&lt;/a&gt;
that has bitten me a few times, causing occasional &lt;i&gt;hangs&lt;/i&gt; when saving
(draft) messages with non-ascii characters. It seemed finally to be a bug
in emacs itself, which is triggered by something in Wanderlust. A fix will
probably be available for the next emacs version; until then, you can work
around this by using an external MIME-encoder. To do this, add the
following to your WL initialization code (thanks to various helpful people
on the WL mailing list):
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; mel-b-ccl-module nil)
(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; mel-q-ccl-module nil)
(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; base64-external-encoder '(&lt;span class="org-string"&gt;"mimencode"&lt;/span&gt;))
(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; base64-external-decoder '(&lt;span class="org-string"&gt;"mimencode"&lt;/span&gt; &lt;span class="org-string"&gt;"-u"&lt;/span&gt;))
(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; base64-external-decoder-option-to-specify-file '(&lt;span class="org-string"&gt;"-o"&lt;/span&gt;))
(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; quoted-printable-external-encoder '(&lt;span class="org-string"&gt;"mimencode"&lt;/span&gt; &lt;span class="org-string"&gt;"-q"&lt;/span&gt;))
(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; quoted-printable-external-decoder '(&lt;span class="org-string"&gt;"mimencode"&lt;/span&gt; &lt;span class="org-string"&gt;"-q"&lt;/span&gt; &lt;span class="org-string"&gt;"-u"&lt;/span&gt;))
(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; quoted-printable-external-decoder-option-to-specify-file '(&lt;span class="org-string"&gt;"-o"&lt;/span&gt;))
(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; base64-internal-decoding-limit 0)
(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; base64-internal-encoding-limit 0)
(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; quoted-printable-internal-decoding-limit 0)
(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; quoted-printable-internal-encoding-limit 0)

(&lt;span class="org-keyword"&gt;setq&lt;/span&gt;-default mime-transfer-level 8)
(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; mime-header-accept-quoted-encoded-words t)
&lt;/pre&gt;




&lt;p&gt;
This requires the &lt;code&gt;mimencode&lt;/code&gt;-program, which is part of the
&lt;code&gt;metamail&lt;/code&gt;-package. For the time being, this seems to be the best solution
when using Wanderlust with Emacs 23.
&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;one more trick: reformatting &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1_3"&gt;


&lt;p&gt;
Let's finish with one more trick. Sometimes, incoming mail is formatted
quite &lt;i&gt;badly&lt;/i&gt;; in particular, the new lines are too long for comfortable
reading. From the WL-mailing list, here's a trick to deal with that:
&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;filladapt&lt;/span&gt;)

&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;from a WL mailing list post by Per b. Sederber
&lt;/span&gt;&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;Re-fill messages that arrive poorly formatted
&lt;/span&gt;(&lt;span class="org-keyword"&gt;defun&lt;/span&gt; &lt;span class="org-function-name"&gt;wl-summary-refill-message&lt;/span&gt; (all)
  (interactive &lt;span class="org-string"&gt;"P"&lt;/span&gt;)
  (&lt;span class="org-keyword"&gt;if&lt;/span&gt; (and wl-message-buffer (get-buffer-window wl-message-buffer))
      (&lt;span class="org-keyword"&gt;progn&lt;/span&gt;
        (wl-summary-toggle-disp-msg 'on)
        (&lt;span class="org-keyword"&gt;save-excursion&lt;/span&gt;
          (set-buffer wl-message-buffer)
          (goto-char (point-min))
          (re-search-forward &lt;span class="org-string"&gt;"^$"&lt;/span&gt;)
          (&lt;span class="org-keyword"&gt;while&lt;/span&gt; (or (looking-at &lt;span class="org-string"&gt;"^\\[[1-9]"&lt;/span&gt;) (looking-at &lt;span class="org-string"&gt;"^$"&lt;/span&gt;))
            (forward-line 1))
          (&lt;span class="org-keyword"&gt;let*&lt;/span&gt; ((buffer-read-only nil)
                 (find (&lt;span class="org-keyword"&gt;lambda&lt;/span&gt; (regexp)
                         (&lt;span class="org-keyword"&gt;save-excursion&lt;/span&gt;
                           (&lt;span class="org-keyword"&gt;if&lt;/span&gt; (re-search-forward regexp nil t)
                               (match-beginning 0)
                             (point-max)))))
                 (start (point))
                 (end (&lt;span class="org-keyword"&gt;if&lt;/span&gt; all
                          (point-max)
                        (min (funcall find &lt;span class="org-string"&gt;"^[&lt;/span&gt;&lt;span class="org-string"&gt;&lt;span class="org-negation-char"&gt;^&lt;/span&gt;&lt;/span&gt;&lt;span class="org-string"&gt;&amp;gt;\n]* wrote:[ \n]+"&lt;/span&gt;)
                             (funcall find &lt;span class="org-string"&gt;"^&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;"&lt;/span&gt;)
                             (funcall find &lt;span class="org-string"&gt;"^ *&amp;gt;.*\n *&amp;gt;"&lt;/span&gt;)
                             (funcall find &lt;span class="org-string"&gt;"^-----Original Message-----"&lt;/span&gt;)))))
            (&lt;span class="org-keyword"&gt;save-restriction&lt;/span&gt;
              (narrow-to-region start end)
              (filladapt-mode 1)
              (fill-region (point-min) (point-max)))))
        (message &lt;span class="org-string"&gt;"Message re-filled"&lt;/span&gt;))
    (message &lt;span class="org-string"&gt;"No message to re-fill"&lt;/span&gt;)))

(define-key wl-summary-mode-map &lt;span class="org-string"&gt;"\M-q"&lt;/span&gt; 'wl-summary-refill-message)
&lt;/pre&gt;




&lt;p&gt;
Now, you can refill your messages with &lt;code&gt;M-q&lt;/code&gt; when in the Summary.
&lt;/p&gt;
&lt;p&gt;
If you have any other nifty WL-tricks that could be useful for others, please
share them in the comments, thanks!
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-246570950774488454?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/246570950774488454/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=246570950774488454' title='17 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/246570950774488454'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/246570950774488454'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2010/02/i-have-been-using-wanderlust-e-mail.html' title='wanderlust iii'/><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>17</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-6216475401649621541</id><published>2010-02-19T07:53:00.003+02:00</published><updated>2010-02-19T08:00:31.368+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><title type='text'>dealing with many buffers: ibuffer</title><content type='html'>&lt;div class="outline-2" id="outline-container-1"&gt;&lt;div class="outline-text-2" id="text-1"&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_kGFGcbwevHE/S34nHxJF0kI/AAAAAAAAAe8/XyQF9LWUTUw/s1600-h/Screenshot-emacs%40cthulhu.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_kGFGcbwevHE/S34nHxJF0kI/AAAAAAAAAe8/XyQF9LWUTUw/s320/Screenshot-emacs%40cthulhu.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
If you are like me, you'll open a &lt;i&gt;lot&lt;/i&gt; of buffers in &lt;code&gt;emacs&lt;/code&gt;. There may be a couple of buffers with source code, a few for e-mail. &lt;code&gt;org-mode&lt;/code&gt; will open buffers for all your agenda files. Then, maybe an info page, a few ERC-channels, a couple of special emacs buffers such as &lt;code&gt;**Messages**&lt;/code&gt; and &lt;code&gt;**scratch**&lt;/code&gt;. So, in a moderately busy emacs session there may 30-40 buffers open, and after a day or so there can be many more.&lt;br /&gt;
&lt;br /&gt;
With so many buffers, it can be hard to quickly find the one you are looking for - and clearly a one-tab-per-buffer (like Firefox uses) would not work very well either.&lt;br /&gt;
&lt;br /&gt;
So, what can we do instead? Here, on &lt;code&gt;emacs-fu&lt;/code&gt;, we discussed this a couple of&lt;br /&gt;
times already:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;using &lt;a href="http://emacs-fu.blogspot.com/2009/02/switching-buffers.html"&gt;ido-mode&lt;/a&gt;, you can quickly switch to buffers by typing a subset of&lt;br /&gt;
their name&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;using &lt;a href="http://emacs-fu.blogspot.com/2009/07/stepping-through-your-window.html"&gt;elscreen&lt;/a&gt; to step through buffer configurations (this comes close to a&lt;br /&gt;
workable tab-like solution)&lt;br /&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
These are really useful tools. What's still missing though, is a way to get an overview of all buffers. For that, &lt;code&gt;emacs&lt;/code&gt; provide &lt;code&gt;buffer-menu&lt;/code&gt;, normally bound to &lt;code&gt;C-x C-b&lt;/code&gt;. It lists all your buffers, and you can interact with them in a way similar to &lt;code&gt;dired&lt;/code&gt;, e.g. you can switch to a buffer by moving the point (cursor) to the buffer and pressing &lt;code&gt;Return&lt;/code&gt;. Or you mark buffers for deletion by pressing &lt;code&gt;d&lt;/code&gt; when point is on the buffer, and then press &lt;code&gt;x&lt;/code&gt; to kill them all.&lt;br /&gt;
&lt;br /&gt;
Very useful. But if you really have a &lt;i&gt;lot&lt;/i&gt; of buffers, just having a long list of them may still be a bit hard to deal with. For that, there is &lt;code&gt;ibuffer&lt;/code&gt;, which allows you to put your buffers in different categories -- which can even overlap. Emacs ships &lt;code&gt;ibuffer&lt;/code&gt; since version 22, so you'll probably already have it.&lt;br /&gt;
&lt;br /&gt;
Using a setup like the following, you can put your buffers in categories; each buffer is shown only once (apparently, the first match), and you can match on &lt;code&gt;mode&lt;/code&gt; (the Emacs-mode of the buffer), &lt;code&gt;name&lt;/code&gt; (the buffer name), &lt;code&gt;filename&lt;/code&gt; (the full path to the file being visited, if any), and a couple of others (see &lt;a href="http://www.emacswiki.org/emacs/IbufferMode"&gt;EmacsWiki&lt;/a&gt;).&lt;br /&gt;
&lt;br /&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;ibuffer&lt;/span&gt;) 
(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; ibuffer-saved-filter-groups
  (quote ((&lt;span class="org-string"&gt;"default"&lt;/span&gt;      
            (&lt;span class="org-string"&gt;"Org"&lt;/span&gt; &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;all org-related buffers
&lt;/span&gt;              (mode . org-mode))  
            (&lt;span class="org-string"&gt;"Mail"&lt;/span&gt;
              (or  &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;mail-related buffers
&lt;/span&gt;               (mode . message-mode)
               (mode . mail-mode)
               &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;etc.; all your mail related modes
&lt;/span&gt;               ))
            (&lt;span class="org-string"&gt;"MyProject1"&lt;/span&gt;
              (filename . &lt;span class="org-string"&gt;"src/myproject1/"&lt;/span&gt;))
            (&lt;span class="org-string"&gt;"MyProject2"&lt;/span&gt;
              (filename . &lt;span class="org-string"&gt;"src/myproject2/"&lt;/span&gt;))
            (&lt;span class="org-string"&gt;"Programming"&lt;/span&gt; &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;prog stuff not already in MyProjectX
&lt;/span&gt;              (or
                (mode . c-mode)
                (mode . perl-mode)
                (mode . python-mode)
                (mode . emacs-lisp-mode)
                &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;etc
&lt;/span&gt;                )) 
            (&lt;span class="org-string"&gt;"ERC"&lt;/span&gt;   (mode . erc-mode))))))

(&lt;span class="org-keyword"&gt;add-hook&lt;/span&gt; 'ibuffer-mode-hook
  (&lt;span class="org-keyword"&gt;lambda&lt;/span&gt; ()
    (ibuffer-switch-to-saved-filter-groups &lt;span class="org-string"&gt;"default"&lt;/span&gt;)))
&lt;/pre&gt;If you like &lt;code&gt;ibuffer&lt;/code&gt;, you can even override the &lt;code&gt;buffer-menu&lt;/code&gt; key binding for&lt;br /&gt;
it:&lt;br /&gt;
&lt;pre class="src src-emacs-lisp"&gt;(global-set-key (kbd &lt;span class="org-string"&gt;"C-x C-b"&lt;/span&gt;) 'ibuffer)
&lt;/pre&gt;As with &lt;code&gt;buffer-menu&lt;/code&gt;, you can do various funky things with those buffers, and also filter them further; see the documentation. I am mostly using it for its buffer-navigational qualities, and it's good at that.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-6216475401649621541?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/6216475401649621541/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=6216475401649621541' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/6216475401649621541'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/6216475401649621541'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2010/02/dealing-with-many-buffers-ibuffer.html' title='dealing with many buffers: ibuffer'/><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/_kGFGcbwevHE/S34nHxJF0kI/AAAAAAAAAe8/XyQF9LWUTUw/s72-c/Screenshot-emacs%40cthulhu.png' height='72' width='72'/><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-1562631001441862325</id><published>2010-02-08T00:44:00.002+02:00</published><updated>2010-02-08T15:16:31.494+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'>interactive replacement</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;br /&gt;
&lt;br /&gt;
&lt;p&gt;I recently found an interesting little package called &lt;a href="http://permalink.gmane.org/gmane.emacs.sources/3377"&gt;iedit.el&lt;/a&gt;, which allows&lt;br /&gt;
you to interactive replacements on multiple strings at the same time. That is,&lt;br /&gt;
as you do one replace, you can see how all the same matches being replaced as&lt;br /&gt;
you type. It's hard to explain in words, you just have to try it out.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;So, how to install this package?&lt;br /&gt;
&lt;/p&gt;&lt;ul&gt;&lt;li&gt;First, download the package (see the link above)&lt;/li&gt;
&lt;li&gt;Put it in a directory where &lt;code&gt;emacs&lt;/code&gt; can find it; for example,&lt;br /&gt;
&lt;code&gt;~/.emacs.d/elisp&lt;/code&gt;. If you haven't done so already, you can tell &lt;code&gt;emacs&lt;/code&gt; to look in that directory by adding to your &lt;code&gt;.emacs&lt;/code&gt;:&lt;br /&gt;
&lt;pre class="src src-emacs-lisp"&gt;(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; load-path (cons &lt;span class="org-string"&gt;"~/emacs.d/elisp/"&lt;/span&gt; load-path))
&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Then, tell emacs to load this specific module; you can add&lt;br /&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;iedit&lt;/span&gt;)
&lt;/pre&gt;to your &lt;code&gt;.emacs&lt;/code&gt; to load it  (alternatively, you could use the &lt;a href="http://www.gnu.org/software/emacs/elisp/html_node/Autoload.html"&gt;autoload facility)&lt;/a&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;then, define a key binding for this:&lt;br /&gt;
&lt;pre class="src src-emacs-lisp"&gt;(define-key global-map (kbd &lt;span class="org-string"&gt;"C-;"&lt;/span&gt;) 'iedit-mode)
&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Now, search for some strings that appears multiple times in your buffer, select it,&lt;br /&gt;
press &lt;code&gt;C-;&lt;/code&gt; (&lt;code&gt;Ctrl+;&lt;/code&gt;), and watch how all other matching strings are&lt;br /&gt;
changing at the same time.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Very nice.&lt;br /&gt;
&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-1562631001441862325?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/1562631001441862325/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=1562631001441862325' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/1562631001441862325'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/1562631001441862325'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2010/02/interactive-replacement.html' title='interactive replacement'/><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>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-923434516280360941</id><published>2010-01-21T21:37:00.003+02:00</published><updated>2010-01-22T00:18:59.110+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><title type='text'>duplicating lines and commenting them</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;Someone on the &lt;i&gt;Emacs Help&lt;/i&gt; mailing list asked for an easy way to duplicate a line&lt;br /&gt;
and, optionally, comment-out the first one.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;Let's first look at simple duplication of a line. This is a common operation,&lt;br /&gt;
and &lt;code&gt;vi&lt;/code&gt;-users might use something like &lt;code&gt;Yp&lt;/code&gt; for that. In emacs, one way to do&lt;br /&gt;
this is by typing &lt;code&gt;C-a C-k C-k C-y C-y&lt;/code&gt;, which is actually not as bizarre as&lt;br /&gt;
it looks if you try it. When using &lt;i&gt;slick copy&lt;/i&gt;, as explained &lt;a href="http://emacs-fu.blogspot.com/2009/11/copying-lines-without-selecting-them.html"&gt;in another post&lt;/a&gt;,&lt;br /&gt;
it's as easy as &lt;code&gt;M-w C-n C-y&lt;/code&gt;; and of course it's easy to define a shorter key&lt;br /&gt;
binding.&lt;br /&gt;
&lt;br /&gt;
&lt;/p&gt;&lt;pre class="src src-text"&gt;repeat after me
repeat after me
&lt;/pre&gt;&lt;p&gt;However, neither of these methods works correctly when you're on the last line&lt;br /&gt;
of the buffer (by default at least). Also, it puts the point (cursor) &lt;i&gt;below&lt;/i&gt;&lt;br /&gt;
the duplicated line, while I'd like to put it at the start of it. It seems we&lt;br /&gt;
need something a little smarter.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;While we're at it, let's also consider the second question: commenting-out the&lt;br /&gt;
first line of the duplicates. This is a quite common thing to do when writing&lt;br /&gt;
programs or configuration files; you want to try the effect of a small&lt;br /&gt;
variation of a line, but want to keep the original so it can be restored when&lt;br /&gt;
the variation turns out not to be as good as expected.&lt;br /&gt;
&lt;br /&gt;
&lt;/p&gt;&lt;pre class="src src-c"&gt;&lt;span class="org-comment-delimiter"&gt;/* &lt;/span&gt;&lt;span class="org-comment"&gt;for (;;) fork (); &lt;/span&gt;&lt;span class="org-comment-delimiter"&gt;*/&lt;/span&gt;
&lt;span class="org-keyword"&gt;for&lt;/span&gt; (;;) fork ();
&lt;/pre&gt;&lt;p&gt;I hacked up something quickly to solve both questions, and it has evolved a&lt;br /&gt;
little bit since &amp;ndash; to answer both of the questions. The bit of weirdness in&lt;br /&gt;
the end is because of the special case of the last line in a buffer. It&lt;br /&gt;
defines key bindings &lt;code&gt;C-c y&lt;/code&gt; for duplicating a line, and &lt;code&gt;C-c c&lt;/code&gt; for&lt;br /&gt;
duplicating + commenting &amp;ndash; but of course you can change those.&lt;br /&gt;
&lt;br /&gt;
&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;djcb-duplicate-line&lt;/span&gt; (&lt;span class="org-type"&gt;&amp;amp;optional&lt;/span&gt; commentfirst)
  &lt;span class="org-doc"&gt;"comment line at point; if COMMENTFIRST is non-nil, comment the original"&lt;/span&gt; 
  (interactive)
  (beginning-of-line)
  (push-mark)
  (end-of-line)
  (&lt;span class="org-keyword"&gt;let&lt;/span&gt; ((str (buffer-substring (region-beginning) (region-end))))
    (&lt;span class="org-keyword"&gt;when&lt;/span&gt; commentfirst
    (comment-region (region-beginning) (region-end)))
    (insert-string
      (concat (&lt;span class="org-keyword"&gt;if&lt;/span&gt; (= 0 (forward-line 1)) &lt;span class="org-string"&gt;""&lt;/span&gt; &lt;span class="org-string"&gt;"\n"&lt;/span&gt;) str &lt;span class="org-string"&gt;"\n"&lt;/span&gt;))
    (forward-line -1)))

&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;or choose some better bindings....
&lt;/span&gt;
&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;duplicate a line
&lt;/span&gt;(global-set-key (kbd &lt;span class="org-string"&gt;"C-c y"&lt;/span&gt;) 'djcb-duplicate-line)

&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;duplicate a line and comment the first
&lt;/span&gt;(global-set-key (kbd &lt;span class="org-string"&gt;"C-c c"&lt;/span&gt;) (&lt;span class="org-keyword"&gt;lambda&lt;/span&gt;()(interactive)(djcb-duplicate-line t)))
&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-923434516280360941?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/923434516280360941/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=923434516280360941' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/923434516280360941'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/923434516280360941'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2010/01/duplicating-lines-and-commenting-them.html' title='duplicating lines and commenting them'/><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-5147188348017517901</id><published>2010-01-16T18:54:00.003+02:00</published><updated>2010-01-21T21:54:21.055+02:00</updated><title type='text'>rectangles and cua</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;CUA-mode is a minor-mode that enables the use of &lt;code&gt;Ctrl-X/C/V&lt;/code&gt; for cut/copy/paste, as is customary in many computer programs. Of course, it's a bit different in emacs, as it predates CUA and all of those programs. With esp. &lt;code&gt;Ctrl-X&lt;/code&gt; (&lt;code&gt;C-x&lt;/code&gt;) being in heavy use as a prefix-key already, it's unlikely to change. &lt;/p&gt;&lt;p&gt;CUA-mode has a clever trick to solve that problem &amp;ndash; &lt;code&gt;C-x&lt;/code&gt; for &lt;i&gt;cut&lt;/i&gt; only works when a selection is active, and when no other key is pressed shortly. Otherwise, &lt;code&gt;C-x&lt;/code&gt; behaves as usual. This works quite nicely, but personally, I don't use it, as I already have the Emacs key bindings in my muscle memory. Still, it can be useful for people migrating from other CUA-based editors. See e.g. &lt;a href="http://www.emacswiki.org/emacs/CuaMode"&gt;CuaMode&lt;/a&gt; for more information. &lt;/p&gt;&lt;p&gt; However, apart from the &lt;code&gt;C-x&lt;/code&gt;-trick, CUA also has some nice functionality for &lt;i&gt;rectangular selections&lt;/i&gt;. These are sometimes quite useful, and during emacs-fu's prehistory there was already an &lt;a href="http://emacs-fu.blogspot.com/2008/12/working-with-rectangular-selections.html"&gt;article about it&lt;/a&gt;. The method there works, but with CUA, it is much easier. &lt;/p&gt;&lt;p&gt;So, let's turn it on; put the following in your &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; cua-enable-cua-keys nil) &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;only for rectangles
&lt;/span&gt;(cua-mode t)
&lt;/pre&gt;&lt;p&gt;Now, just put your cursor anywhere, and press &lt;code&gt;C-RET&lt;/code&gt; (Ctrl + Enter). You have now started a rectangular selection! There rest is pretty straightforward, you can cut, copy and paste with the normal Emacs key bindings.. &lt;/p&gt;&lt;p&gt;I could go into more detail, but the best way is to see it in action in this wonderful &lt;a href="http://www.vimeo.com/1168225?pg=embed&amp;amp;sec=1168225"&gt;screen cast&lt;/a&gt; by Mark Mansour. I especially like the way you can add numbered lists. &lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-5147188348017517901?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/5147188348017517901/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=5147188348017517901' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/5147188348017517901'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/5147188348017517901'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2010/01/rectangles-and-cua.html' title='rectangles and cua'/><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-1826706243483115857</id><published>2009-12-30T17:09:00.002+02:00</published><updated>2009-12-31T15:21:02.241+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><title type='text'>automatically checking your spelling</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_kGFGcbwevHE/SzttdRaLDAI/AAAAAAAAAe0/qvTPwsS5toY/s1600-h/flyspell.png"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 194px;" src="http://2.bp.blogspot.com/_kGFGcbwevHE/SzttdRaLDAI/AAAAAAAAAe0/qvTPwsS5toY/s400/flyspell.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5421046926127336450" /&gt;&lt;/a&gt;
&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div class="outline-text-2" id="text-1"&gt;

&lt;p&gt;
When I'm typing fast, it's easy to make spelling mistakes (as you may have
noticed reading &lt;a href="http://emacs-fu.blogspot.com"&gt;Emacs-Fu&lt;/a&gt;). It's not so much that I don't &lt;i&gt;know&lt;/i&gt; how to write
things, but sometimes there seems to be a bit of a disconnect between brain
and fingers.
&lt;/p&gt;
&lt;p&gt;
One tool that helps me to make fewer mistakes is &lt;i&gt;automatic spelling checking&lt;/i&gt;, and in particular &lt;i&gt;on-the-fly&lt;/i&gt; spelling checking. Spell-checking in
emacs is taken care of by the &lt;code&gt;ispell&lt;/code&gt;-package.  Traditionally, this was a way
to interface emacs with the &lt;code&gt;ispell&lt;/code&gt;-program on Unix, but nowadays it's often
used with other programs, such as &lt;code&gt;aspell&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://aspell.net/"&gt;aspell&lt;/a&gt; is GNU's intended replacement for &lt;code&gt;ispell&lt;/code&gt;, and has been for a long
time. In the meantime, other spelling checkers have come up; in the Free
Software world, the most prominent one is probably &lt;a href="http://hunspell.sourceforge.net/"&gt;hunspell&lt;/a&gt;, which is used by
e.g. Mozilla and OpenOffice. As I said, Emacs supports all of those; I'm using
&lt;code&gt;aspell&lt;/code&gt;, which works well for me. To use &lt;code&gt;aspell&lt;/code&gt; for spelling-checking, I
have 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; ispell-program-name &lt;span class="org-string"&gt;"aspell"&lt;/span&gt;
  ispell-extra-args '(&lt;span class="org-string"&gt;"--sug-mode=ultra"&lt;/span&gt;))
&lt;/pre&gt;


&lt;p&gt;
Please consult the &lt;code&gt;aspell&lt;/code&gt; documentation for the details.
&lt;/p&gt;
&lt;p&gt;
You can spell-check your text with &lt;code&gt;ispell-buffer&lt;/code&gt; and friends, which are also
available through the menu (&lt;code&gt;Tools/Spell Checking/...&lt;/code&gt;). This works fine, but
it makes spelling checking a separate step you have to go through and you may
forget. So, I like to do the spelling-checking &lt;i&gt;on-the-fly&lt;/i&gt;, that is, while I
am typing. This can be done using &lt;code&gt;flyspell-mode&lt;/code&gt; (you can also use
&lt;code&gt;flyspell-prog-mode&lt;/code&gt;, to do spell checking inside comments in computer
programs, but I find that a bit over the top).
&lt;/p&gt;
&lt;p&gt;
When &lt;code&gt;flyspell-mode&lt;/code&gt; is enabled, it will mark
&lt;font color="red"&gt;&lt;u&gt;misspelt&lt;/u&gt;&lt;/font&gt;
eh misspelled words by painting them in a different color while you are typing --
the common way many word processing programs do it. A common way to enable
&lt;code&gt;flyspell-mode&lt;/code&gt; is to put it the the &lt;code&gt;mode-hook&lt;/code&gt; for the modes where you want
to use it. For example, to enable &lt;code&gt;flyspell-mode&lt;/code&gt; for all your &lt;code&gt;org-mode&lt;/code&gt;
buffers, you can add something like the following to your &lt;code&gt;.emacs&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; 'org-mode-hook
  (&lt;span class="org-keyword"&gt;lambda&lt;/span&gt;()
    (flyspell-mode 1)))
&lt;/pre&gt;


&lt;p&gt;
Note, you can use the middle mouse button to get alternatives for a misspelled
word.
&lt;/p&gt;

&lt;p&gt;
By default, it uses the English dictionary, but it's easy to switch to another
using &lt;code&gt;M-x ispell-change-dictionary&lt;/code&gt;. To make it easier, I have defined the
&lt;code&gt;C-c N&lt;/code&gt; key binding to activate Dutch-language ("nederlands") spelling
checking, and update the buffer.
&lt;/p&gt;


&lt;pre class="src src-emacs-lisp"&gt;(global-set-key (kbd &lt;span class="org-string"&gt;"C-c N"&lt;/span&gt;) 
  (&lt;span class="org-keyword"&gt;lambda&lt;/span&gt;()(interactive)
    (ispell-change-dictionary &lt;span class="org-string"&gt;"nederlands"&lt;/span&gt;)
    (flyspell-buffer))) 
&lt;/pre&gt;



&lt;p&gt;
Now, there's another category of mistakes &amp;ndash; &lt;i&gt;their-they're-there&lt;/i&gt;, &lt;i&gt;its-it's&lt;/i&gt;
or &lt;i&gt;to-too-two&lt;/i&gt; that require a spelling checker that's a bit smarter. There
are some free implementations in OpenOffice and Abiword; it'd be interesting
to see if those could be integrated with emacs as well.
&lt;/p&gt;
&lt;p&gt;
Now, laugh about the sweet irony of the spelling errors that I failed to
notice :)
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-1826706243483115857?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/1826706243483115857/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=1826706243483115857' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/1826706243483115857'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/1826706243483115857'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2009/12/automatically-checking-your-spelling.html' title='automatically checking your spelling'/><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/_kGFGcbwevHE/SzttdRaLDAI/AAAAAAAAAe0/qvTPwsS5toY/s72-c/flyspell.png' height='72' width='72'/><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-2113402687085325239</id><published>2009-12-13T15:46:00.002+02:00</published><updated>2009-12-13T18:46:27.698+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'>scrolling</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;
Scrolling It's an integral part of just about any graphical user interface,
including emacs. However, I always found that the default way scrolling works
in emacs left something to be desired. It puts the scroll bar on the left (!),
and when scrolling around, it does not scroll smoothly, but instead it seem to
do so in bursts. But, this being emacs, we can change it!
&lt;/p&gt;
&lt;p&gt;

First, the position of the scroll bar. Presumably for historical reasons,
emacs puts the scroll bar on the &lt;i&gt;left&lt;/i&gt; of the window, unlike most other
programs. We can easily change that, by putting the following in &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;(set-scroll-bar-mode 'right)
&lt;/pre&gt;



&lt;p&gt;
Instead of &lt;code&gt;right&lt;/code&gt;, you can also use &lt;code&gt;left&lt;/code&gt;, or &lt;code&gt;nil&lt;/code&gt; to hide the scroll bar
completely. You can also do this through the menu (Options / Show/Hide /
Scroll bar). Note that on X, when the cursor (point) reaches the end of the
document, the slider on the scroll bar may not be at the bottom; I understand
this is because of some disagreement between Emacs and the toolkit (GTK+ in
this case).
&lt;/p&gt;
&lt;p&gt;
Now, what about the other issue, the non-smoothness when scrolling with the
cursor-keys or with &lt;code&gt;C-n&lt;/code&gt;, &lt;code&gt;C-p&lt;/code&gt;? Below are my settings for making scrolling a
bit smoother, and the explanation. Of course, these are just my personal
preferences.
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;(&lt;span class="org-keyword"&gt;setq&lt;/span&gt;
  scroll-margin 0                  
  scroll-conservatively 100000
  scroll-preserve-screen-position 1)
&lt;/pre&gt;




&lt;ul&gt;
&lt;li&gt;
The &lt;code&gt;scroll-margin&lt;/code&gt;. This determines when scrolling should start; by
setting it to 0, emacs will start to scroll whenever you are entering the
top or bottom line of the window. You can also this to, say, 5 to let
scrolling start whenever you're getting closer than 5 lines from top or bottom

&lt;/li&gt;
&lt;li&gt;
Then, &lt;code&gt;scroll-conservatively&lt;/code&gt; determines how far the cursor is allowed to
be distanced from the center of the screen when scrolling start. The
default sets this to 0, which means that whenever you start scrolling, the
cursor jumps to the center of the screen. I find that quite annoying, so I
set it to some big number (the 'effective maximum' for that is
lines-in-window / 2, but you can put any bigger number there to avoid the
jumpiness)
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;scroll-preserve-screen-position&lt;/code&gt; tries to maintain the current screen
position when you scroll using Page-Up/Page-Down. I like that.

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

&lt;p&gt;There are also the variables &lt;code&gt;scroll-up-aggressively&lt;/code&gt; and

&lt;code&gt;scroll-down-aggressively&lt;/code&gt;. Normally, they determine how far emacs will scroll
(up and down, respectively) when it does so. However, they don't make any
difference with a big &lt;code&gt;scroll-conservatively&lt;/code&gt; like I am using. Still, if you
want to play with it, their values are fractions between 0.0 and 1.0
(inclusive); a value of 1 means that it will move a full screen when scrolling
starts, a value of 0.0 causes a move of only one single line.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-2113402687085325239?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/2113402687085325239/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=2113402687085325239' title='16 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/2113402687085325239'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/2113402687085325239'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2009/12/scrolling.html' title='scrolling'/><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-6505554049788431497</id><published>2009-12-06T20:17:00.008+02:00</published><updated>2009-12-07T20:13:39.085+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><title type='text'>changing the cursor color and shape dynamically</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_kGFGcbwevHE/Sxv1tWMu0pI/AAAAAAAAAeA/ChfdCkUoIQw/s1600-h/cursor-normal.png"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 398px; height: 139px;" src="http://1.bp.blogspot.com/_kGFGcbwevHE/Sxv1tWMu0pI/AAAAAAAAAeA/ChfdCkUoIQw/s400/cursor-normal.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5412189536617681554" /&gt;&lt;/a&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_kGFGcbwevHE/Sxv1zZvMArI/AAAAAAAAAeI/2RsbqFOPrx8/s1600-h/cursor-overwrite.png"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 398px; height: 139px;" src="http://3.bp.blogspot.com/_kGFGcbwevHE/Sxv1zZvMArI/AAAAAAAAAeI/2RsbqFOPrx8/s400/cursor-overwrite.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5412189640646722226" /&gt;&lt;/a&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_kGFGcbwevHE/Sxv15lr1QzI/AAAAAAAAAeQ/vXB-vU7Ajuo/s1600-h/cursor-readonly.png"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 152px;" src="http://1.bp.blogspot.com/_kGFGcbwevHE/Sxv15lr1QzI/AAAAAAAAAeQ/vXB-vU7Ajuo/s400/cursor-readonly.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5412189746933089074" /&gt;&lt;/a&gt;


&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div class="outline-text-2" id="text-1"&gt;

&lt;p&gt;
When typing some text, it's often useful to know what mode we're in &amp;ndash; are we in

&lt;i&gt;overwrite-mode&lt;/i&gt;, in &lt;i&gt;read-only-mode&lt;/i&gt;, or in normal &lt;i&gt;insert-mode&lt;/i&gt;. The
information is available in the mode-line &amp;ndash; but wouldn't it be nicer to get
some small visual cue, for example by changing the cursor color or style?
&lt;/p&gt;
&lt;p&gt;
That indeed is possible. There are some existing ways to do this, &lt;a href="http://www.emacswiki.org/emacs/ChangingCursorDynamically"&gt;described in EmacsWiki&lt;/a&gt;. However, I want to be able to control both the cursor color
and cursor shape, and also distinguish between overwrite, read-only and
'normal' mode. Below is my attempt.
&lt;/p&gt;
&lt;p&gt;
By putting the following snippet in your &lt;code&gt;.emacs&lt;/code&gt;, the cursor becomes a
yellow vertical bar during normal mode, it becomes a red block when you're
in overwrite-mode and it becomes a gray vertical bar when you're in
read-only mode.

&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;Change cursor color according to mode; inspired by
&lt;/span&gt;&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;http://www.emacswiki.org/emacs/ChangingCursorDynamically
&lt;/span&gt;(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; djcb-read-only-color       &lt;span class="org-string"&gt;"gray"&lt;/span&gt;)
&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;valid values are t, nil, box, hollow, bar, (bar . WIDTH), hbar,
&lt;/span&gt;&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;(hbar. HEIGHT); see the docs for set-cursor-type

&lt;/span&gt;(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; djcb-read-only-cursor-type 'hbar)
(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; djcb-overwrite-color       &lt;span class="org-string"&gt;"red"&lt;/span&gt;)
(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; djcb-overwrite-cursor-type 'box)
(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; djcb-normal-color          &lt;span class="org-string"&gt;"yellow"&lt;/span&gt;)
(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; djcb-normal-cursor-type    'bar)

(&lt;span class="org-keyword"&gt;defun&lt;/span&gt; &lt;span class="org-function-name"&gt;djcb-set-cursor-according-to-mode&lt;/span&gt; ()
  &lt;span class="org-doc"&gt;"change cursor color and type according to some minor modes."&lt;/span&gt;

  (&lt;span class="org-keyword"&gt;cond&lt;/span&gt;
    (buffer-read-only
      (set-cursor-color djcb-read-only-color)
      (&lt;span class="org-keyword"&gt;setq&lt;/span&gt; cursor-type djcb-read-only-cursor-type))
    (overwrite-mode
      (set-cursor-color djcb-overwrite-color)
      (&lt;span class="org-keyword"&gt;setq&lt;/span&gt; cursor-type djcb-overwrite-cursor-type))
    (t 
      (set-cursor-color djcb-normal-color)
      (&lt;span class="org-keyword"&gt;setq&lt;/span&gt; cursor-type djcb-normal-cursor-type))))

(&lt;span class="org-keyword"&gt;add-hook&lt;/span&gt; 'post-command-hook 'djcb-set-cursor-according-to-mode)

&lt;/pre&gt;




&lt;p&gt;
You can change the colors and cursor types by modifying the various
variables.
&lt;/p&gt;
&lt;p&gt;
I should probably turn this into a proper minor mode, but for now this seems
to work well.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-6505554049788431497?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/6505554049788431497/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=6505554049788431497' title='14 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/6505554049788431497'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/6505554049788431497'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2009/12/changing-cursor-color-and-shape.html' title='changing the cursor color and shape dynamically'/><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/_kGFGcbwevHE/Sxv1tWMu0pI/AAAAAAAAAeA/ChfdCkUoIQw/s72-c/cursor-normal.png' height='72' width='72'/><thr:total>14</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-8986414839735218136</id><published>2009-11-29T14:52:00.002+02:00</published><updated>2009-11-29T14:58:08.780+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'>making buffer names unique</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 you open a file in emacs, the buffer gets the name of that file. That's
all fine, but what if you open multiple files with the same name? At least for
me, it's a fairly common to have a number of different &lt;code&gt;Makefile.am&lt;/code&gt; buffers

&lt;code&gt;Makefile.am&amp;lt;3&amp;gt;&lt;/code&gt; etc., but that does really help to find the right one
at the same time. Emacs does make those names unique &amp;ndash; &lt;code&gt;Makefile.am&amp;lt;2&amp;gt;&lt;/code&gt;,
quickly.
&lt;/p&gt;
&lt;p&gt;
To do that, emacs provides &lt;code&gt;uniquify&lt;/code&gt; &amp;ndash; it makes buffer names unique. In your
&lt;code&gt;.emacs&lt;/code&gt;:

&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;uniquify&lt;/span&gt;) 
(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; 
  uniquify-buffer-name-style 'post-forward
  uniquify-separator &lt;span class="org-string"&gt;":"&lt;/span&gt;)
&lt;/pre&gt;



&lt;p&gt;
This is emacs, so you can influence the way in which the names are made
unique. I prefer &lt;code&gt;post-forward&lt;/code&gt;, and as separator I use a &lt;code&gt;:&lt;/code&gt; rather than the
default &lt;code&gt;|&lt;/code&gt;.  Note, instead of &lt;code&gt;post-forward&lt;/code&gt; there are other bizarre styles,
please see the &lt;a href="http://www.gnu.org/software/emacs/manual/html_node/emacs/Uniquify.html"&gt;documentation&lt;/a&gt;.

&lt;/p&gt;
&lt;p&gt;
Anyway, now, when opening ('visiting') files &lt;code&gt;test/a/foo&lt;/code&gt; and &lt;code&gt;test/b/foo&lt;/code&gt;,
their buffers get the names &lt;code&gt;foo:a&lt;/code&gt; and &lt;code&gt;foo:b&lt;/code&gt;. In other words, the name
followed by a colon and part of the path. I think it's much clearer than the
default names &lt;code&gt;foo&lt;/code&gt; and &lt;code&gt;foo&amp;lt;2&amp;gt;&lt;/code&gt;. One could ask why emacs should not use

&lt;code&gt;uniquify&lt;/code&gt; as its default behavior; it seems a clear improvement.
&lt;/p&gt;
&lt;p&gt;
Uniquify is a small convenience that's been a documented part of emacs for 20
years. Still, somehow I missed it until this year. I suspect I am not the only
one - which is why I write this.
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-8986414839735218136?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/8986414839735218136/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=8986414839735218136' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/8986414839735218136'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/8986414839735218136'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2009/11/making-buffer-names-unique.html' title='making buffer names unique'/><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-8184896567058918882</id><published>2009-11-19T20:10:00.007+02:00</published><updated>2009-11-20T19:08:28.643+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='org-mode'/><category scheme='http://www.blogger.com/atom/ns#' term='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='wanderlust'/><title type='text'>showing pop-ups</title><content type='html'>&lt;p&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_kGFGcbwevHE/SwWKlLoseMI/AAAAAAAAAd4/IcakPnbhnRQ/s1600/popup.png"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 283px; height: 128px;" src="http://4.bp.blogspot.com/_kGFGcbwevHE/SwWKlLoseMI/AAAAAAAAAd4/IcakPnbhnRQ/s400/popup.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5405879299111418050" /&gt;&lt;/a&gt;
&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div class="outline-text-2" id="text-1"&gt;

&lt;strong&gt;Updated: yes, it's %s, not %d&lt;/strong&gt; Sometimes, it's nice when &lt;code&gt;emacs&lt;/code&gt; can warn you when something is happening or
should happen. For example, when a new e-mail has arrived, or when there's a
meeting in 15 minutes you should attend.

&lt;/p&gt;
&lt;p&gt;
As always, there are different way to do this, but here's what I've been using
for while. Various versions of this have been circulating around mailing
lists, so I don't know whom to credit with the original idea &amp;ndash; anyway, this
is the (modified) version that I'm using.
&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;djcb-popup&lt;/span&gt; (title msg &lt;span class="org-type"&gt;&amp;amp;optional&lt;/span&gt; icon sound)
  &lt;span class="org-doc"&gt;"Show a popup if we're on X, or echo it otherwise; TITLE is the title
of the message, MSG is the context. Optionally, you can provide an ICON and
a sound to be played"&lt;/span&gt;

  (interactive)
  (&lt;span class="org-keyword"&gt;when&lt;/span&gt; sound (shell-command
                (concat &lt;span class="org-string"&gt;"mplayer -really-quiet "&lt;/span&gt; sound &lt;span class="org-string"&gt;" 2&amp;gt; /dev/null"&lt;/span&gt;)))
  (&lt;span class="org-keyword"&gt;if&lt;/span&gt; (eq window-system 'x)
    (shell-command (concat &lt;span class="org-string"&gt;"notify-send "&lt;/span&gt;

                     (&lt;span class="org-keyword"&gt;if&lt;/span&gt; icon (concat &lt;span class="org-string"&gt;"-i "&lt;/span&gt; icon) &lt;span class="org-string"&gt;""&lt;/span&gt;)
                     &lt;span class="org-string"&gt;" '"&lt;/span&gt; title &lt;span class="org-string"&gt;"' '"&lt;/span&gt; msg &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;text only version

&lt;/span&gt;    (message (concat title &lt;span class="org-string"&gt;": "&lt;/span&gt; msg))))
&lt;/pre&gt;




&lt;p&gt;
A couple of notes:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
I'm using &lt;code&gt;notify-send&lt;/code&gt; for sending notifications; this assumes you are
using that system (it's part of the &lt;code&gt;libnotify-bin&lt;/code&gt; package in
Debian/Ubuntu). You can of course replace it with whatever is available on
your system. Alternatives are &lt;code&gt;zenity&lt;/code&gt; or &lt;code&gt;kdialog&lt;/code&gt; or &lt;code&gt;xmessage&lt;/code&gt; (for
old-timers) and their equivalents (?) on Windows, MacOS.

&lt;/li&gt;
&lt;li&gt;
I'm now using &lt;code&gt;mplayer&lt;/code&gt; for playing sounds. This is a bit heavy, but at
least plays all kinds of audio files. If you only care about &lt;code&gt;.wav&lt;/code&gt;-files,
you could replace it with e.g. &lt;code&gt;aplay&lt;/code&gt;;
&lt;/li&gt;
&lt;li&gt;
as always, please ignore my ego-centric function names :-)

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

&lt;p&gt;Now, we can use this function by evaluation e.g.

&lt;/p&gt;


&lt;pre class="src src-emacs-lisp"&gt;(djcb-popup &lt;span class="org-string"&gt;"Warning"&lt;/span&gt; &lt;span class="org-string"&gt;"The end is near"&lt;/span&gt;
   &lt;span class="org-string"&gt;"/usr/share/icons/test.png"&lt;/span&gt; &lt;span class="org-string"&gt;"/usr/share/sounds/beep.ogg"&lt;/span&gt;)
&lt;/pre&gt;




&lt;/div&gt;

&lt;div id="outline-container-1.1" class="outline-3"&gt;
&lt;h3 id="sec-1.1"&gt;showing pop-ups from &lt;code&gt;org-mode&lt;/code&gt; appointments &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1.1"&gt;


&lt;p&gt;
The above popup function is most useful when it's does its work based on some
event. To be notified of appointments and the like, there is the &lt;a href="http://www.gnu.org/software/emacs/manual/html_node/emacs/Appointments.html"&gt;emacs appt facility&lt;/a&gt;. Here, we set up this &lt;code&gt;appt&lt;/code&gt;, and then hook it up with &lt;code&gt;org-mode&lt;/code&gt;, so

&lt;code&gt;appt&lt;/code&gt; can warn us when there's something happening soon&amp;hellip;
&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;the appointment notification facility
&lt;/span&gt;(&lt;span class="org-keyword"&gt;setq&lt;/span&gt;
  appt-message-warning-time 15 &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;warn 15 min in advance

&lt;/span&gt;  appt-display-mode-line t     &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;show in the modeline
&lt;/span&gt;  appt-display-format 'window) &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;use our func
&lt;/span&gt;(appt-activate 1)              &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;active appt (appointment notification)
&lt;/span&gt;(display-time)                 &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;time display is required for this...
&lt;/span&gt;
 &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;update appt each time agenda opened

&lt;/span&gt;(&lt;span class="org-keyword"&gt;add-hook&lt;/span&gt; 'org-finalize-agenda-hook 'org-agenda-to-appt)

&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;our little fa&amp;#231;ade-function for djcb-popup
&lt;/span&gt; (&lt;span class="org-keyword"&gt;defun&lt;/span&gt; &lt;span class="org-function-name"&gt;djcb-appt-display&lt;/span&gt; (min-to-app new-time msg)
    (djcb-popup (format &lt;span class="org-string"&gt;"Appointment in %s minute(s)"&lt;/span&gt; min-to-app) msg 
      &lt;span class="org-string"&gt;"/usr/share/icons/gnome/32x32/status/appointment-soon.png"&lt;/span&gt;

      &lt;span class="org-string"&gt;"/usr/share/sounds/ubuntu/stereo/phone-incoming-call.ogg"&lt;/span&gt;))
  (&lt;span class="org-keyword"&gt;setq&lt;/span&gt; appt-disp-window-function (function djcb-appt-display))
&lt;/pre&gt;




&lt;p&gt;
Of course, you can freely choose a icon / sound to your liking.
&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;showing pop-ups for new mail &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1.2"&gt;


&lt;p&gt;
Another event you might want to be warned about is new mail. There is
something to be set for &lt;i&gt;not&lt;/i&gt; letting yourself be disturbed for new mail, but
if you sufficiently filter your mails before they enter your inbox, it can be
a good way to periodically bring you back from your deep sl &lt;code&gt;^H^H&lt;/code&gt; thinking. For
&lt;a href="http://emacs-fu.blogspot.com/2009/06/e-mail-with-wanderlust.html"&gt;Wanderlust&lt;/a&gt;, I use something like this:

&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;(&lt;span class="org-keyword"&gt;add-hook&lt;/span&gt; 'wl-biff-notify-hook
    (&lt;span class="org-keyword"&gt;lambda&lt;/span&gt;()
      (djcb-popup &lt;span class="org-string"&gt;"Wanderlust"&lt;/span&gt; &lt;span class="org-string"&gt;"You have new mail!"&lt;/span&gt;
        &lt;span class="org-string"&gt;"/usr/share/icons/gnome/32x32/status/mail-unread.png"&lt;/span&gt;
        &lt;span class="org-string"&gt;"/usr/share/sounds/ubuntu/stereo/phone-incoming-call.ogg"&lt;/span&gt;)))
&lt;/pre&gt;




&lt;p&gt;
Exercise for the reader: adapt this for your chosen mail client.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-8184896567058918882?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/8184896567058918882/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=8184896567058918882' title='18 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/8184896567058918882'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/8184896567058918882'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2009/11/showing-pop-ups.html' title='showing pop-ups'/><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://4.bp.blogspot.com/_kGFGcbwevHE/SwWKlLoseMI/AAAAAAAAAd4/IcakPnbhnRQ/s72-c/popup.png' height='72' width='72'/><thr:total>18</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-7902853816255222152</id><published>2009-11-12T21:03:00.004+02:00</published><updated>2009-11-12T21:27:32.410+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><title type='text'>copying lines without selecting them</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 I'm programming, I often need to copy a line. Normally, this requires me
to first select ('mark') the line I want to copy. That does not seem like a
big deal, but when I'm in the 'flow' I want to avoid any little obstacle that
can slow me down.
&lt;/p&gt;
&lt;p&gt;
So, how can I copy the current line without selection? I found a nice trick by
&lt;i&gt;MacChan&lt;/i&gt; on &lt;a href="http://www.emacswiki.org/emacs/SlickCopy"&gt;EmacsWiki&lt;/a&gt; to accomplish this. It also adds ta function to kill
(cut) the current line (similar to &lt;code&gt;kill-line&lt;/code&gt; (&lt;code&gt;C-k&lt;/code&gt;), but kills the whole
line, not just from point (cursor) to the end.
&lt;/p&gt;
&lt;p&gt;
The code below simply embellishes the normal functions with the functionality
'if nothing is selected, assume we mean the current line'. The key bindings
stay the same (&lt;code&gt;M-w&lt;/code&gt;, &lt;code&gt;C-w&lt;/code&gt;).
&lt;/p&gt;
&lt;p&gt;
To enable this, put the following in your &lt;code&gt;.emacs&lt;/code&gt;:
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;(&lt;span class="org-keyword"&gt;defadvice&lt;/span&gt; &lt;span class="org-function-name"&gt;kill-ring-save&lt;/span&gt; (before slick-copy activate compile) &lt;span class="org-doc"&gt;"When called
  interactively with no active region, copy a single line instead."&lt;/span&gt;
  (interactive (&lt;span class="org-keyword"&gt;if&lt;/span&gt; mark-active (list (region-beginning) (region-end)) (message
  &lt;span class="org-string"&gt;"Copied line"&lt;/span&gt;) (list (line-beginning-position) (line-beginning-position
  2)))))

(&lt;span class="org-keyword"&gt;defadvice&lt;/span&gt; &lt;span class="org-function-name"&gt;kill-region&lt;/span&gt; (before slick-cut activate compile)
  &lt;span class="org-doc"&gt;"When called interactively with no active region, kill a single line instead."&lt;/span&gt;
  (interactive
    (&lt;span class="org-keyword"&gt;if&lt;/span&gt; mark-active (list (region-beginning) (region-end))
      (list (line-beginning-position)
        (line-beginning-position 2)))))
&lt;/pre&gt;




&lt;p&gt;
It also shows the power of Emacs-Lisp with the &lt;code&gt;defadvice&lt;/code&gt;-macro &amp;ndash; see the
&lt;a href="http://www.gnu.org/software/emacs/elisp/html_node/Advising-Functions.html"&gt;fine documentation&lt;/a&gt;. Using &lt;code&gt;defadvice&lt;/code&gt;, you can 'decorate' any function with
your own modifications. This great power should be used with caution, of
course, as to not break other usage that assumes the undecorated versions. In
this case, that seem unlikely. And note that the 'advise' only applies when
the functions are called interactively.
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-7902853816255222152?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/7902853816255222152/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=7902853816255222152' title='14 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/7902853816255222152'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/7902853816255222152'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2009/11/copying-lines-without-selecting-them.html' title='copying lines without selecting them'/><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-4980646546758164848</id><published>2009-11-05T21:52:00.002+02:00</published><updated>2009-11-05T21:54:42.850+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='basic'/><title type='text'>bookmarks</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 has a very useful system for &lt;b&gt;bookmarks&lt;/b&gt; &amp;ndash; shortcuts to often-used
files. It's also one of those features I only really started using after years
of emacs &amp;ndash; there seem to be many of such &lt;i&gt;obvious&lt;/i&gt; features&amp;hellip;
&lt;/p&gt;
&lt;p&gt;
Bookmarks are especially handy if you have long file names, or for examples
the special file names for &lt;a href="http://emacs-fu.blogspot.com/2009/10/editing-files-owned-by-root.html"&gt;editing root-owned files&lt;/a&gt; discussed here before.
&lt;/p&gt;
&lt;p&gt;
To start using bookmarks effectively, there are only a few important key
bindings to memorize: &lt;code&gt;C-x r m&lt;/code&gt; ('make') will create a new bookmark,
defaulting to the current file. Then, you can jump to an existing bookmark
with &lt;code&gt;C-x r b&lt;/code&gt; ('bookmark') Finally, you can see the list of your bookmarks
with &lt;code&gt;C-x r l&lt;/code&gt; ('list').
&lt;/p&gt;
&lt;p&gt;
There are a few customizations you can put in your &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; 
  bookmark-default-file &lt;span class="org-string"&gt;"~/.emacs.d/bookmarks"&lt;/span&gt; &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;keep my ~/ clean
&lt;/span&gt;  bookmark-save-flag 1)                        &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;autosave each change)
&lt;/span&gt;&lt;/pre&gt;




&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-4980646546758164848?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/4980646546758164848/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=4980646546758164848' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/4980646546758164848'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/4980646546758164848'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2009/11/bookmarks.html' title='bookmarks'/><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-50158655016531588</id><published>2009-10-21T23:08:00.008+03:00</published><updated>2009-10-24T11:22:54.710+03:00</updated><title type='text'>editing files owned by root with tramp</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;
One of the times when many emacs-users still reach for &lt;code&gt;vi&lt;/code&gt; is when editing
system configuration files &amp;ndash; the stuff in &lt;code&gt;/etc/&lt;/code&gt;, etc. I think that is
because of the &lt;a href="#http://emacs-fu.blogspot.com/2009/02/emacs-daemon.html"&gt;now mostly false&lt;/a&gt; impression that &lt;code&gt;emacs&lt;/code&gt; startup is slow, and
because people don't want to run an open-ended program as emacs as &lt;code&gt;root&lt;/code&gt;.

&lt;/p&gt;
&lt;p&gt;
There is truth in that last point &amp;ndash; but it applies just as well to, say,
&lt;a href="http://vim.org"&gt;vim&lt;/a&gt;. Anyway, running &lt;code&gt;emacs&lt;/code&gt; as root is not a good idea.
&lt;/p&gt;
&lt;p&gt;
So how what can we do it? Easy! Using the &lt;code&gt;tramp&lt;/code&gt; package (included with
GNU/Emacs since version 22), you can run emacs as a normal user, but edit
root-and-other-owned files. It does its magic using &lt;a href="http://www.sudo.ws/"&gt;sudo&lt;/a&gt;, but you won't
normally notice. It does require you to have &lt;code&gt;sudo&lt;/code&gt;-rights of course.

&lt;/p&gt;
&lt;p&gt;
How does this work? Well, instead of
&lt;/p&gt;



&lt;pre class="src src-txt"&gt;C-x C-f /etc/hosts
&lt;/pre&gt;




&lt;p&gt;
to open a file as a normal user, you use:
&lt;/p&gt;


&lt;pre class="src src-txt"&gt;C-x C-f /sudo:root@localhost:/etc/hosts
&lt;/pre&gt;




&lt;p&gt;
or even shorter, as noted by Alexander Kojevnikov (because Tramp defaults to
&lt;code&gt;root@localhost&lt;/code&gt;):
&lt;/p&gt;



&lt;pre class="src src-txt"&gt;C-x C-f /sudo::/etc/hosts

&lt;/pre&gt;




&lt;p&gt;
It asks for a password - and you should use your &lt;b&gt;user password&lt;/b&gt; for that (not
the root password!). This usually works fine, but due to way Tramp works, it
can get confused if root has some very weird command prompt. If
so, you of course &lt;a href="http://www.gnu.org/software/tramp/#Remote-shell-setup"&gt;configure tramp&lt;/a&gt;. Also note that &lt;b&gt;sudo&lt;/b&gt; usually remembers
that you logged in, an does not require you to re-enter you password when
opening ('visiting') another file for some time period &amp;ndash; but you can change
this. See the &lt;code&gt;sudo(8)&lt;/code&gt;.

&lt;/p&gt;
&lt;p&gt;
This automatically invokes &lt;code&gt;tramp&lt;/code&gt; which does all the magic for you. If you
don't like the somewhat longer (pseudo)paths for files, you can of course use
the emacs &lt;a href="http://www.emacswiki.org/emacs/BookMarks"&gt;bookmarks&lt;/a&gt; facilty. After you load the file, you can use it like any
other file.
&lt;/p&gt;
&lt;p&gt;
Note, this is only of the &lt;b&gt;many&lt;/b&gt; useful things you can do with Tramp. &lt;a href="http://www.gnu.org/software/tramp/"&gt;Tramp&lt;/a&gt;

was actually written for editing files on remote machines (using &lt;code&gt;ssh&lt;/code&gt; or
other protocol), and I very happily used it to edit files on some European
machine whilst in Australia. It caches the file locally, and only sends it
over when you save it, so it very fast &amp;ndash; it simply makes you forget your file
is so far away.
&lt;/p&gt;





&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-50158655016531588?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/50158655016531588/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=50158655016531588' title='19 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/50158655016531588'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/50158655016531588'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2009/10/editing-files-owned-by-root.html' title='editing files owned by root with tramp'/><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>19</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-4010982812325550896</id><published>2009-10-18T15:22:00.009+03:00</published><updated>2009-11-14T10:16:35.168+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='org-mode'/><category scheme='http://www.blogger.com/atom/ns#' term='presentations'/><category scheme='http://www.blogger.com/atom/ns#' term='updated'/><category scheme='http://www.blogger.com/atom/ns#' term='beamer'/><title type='text'>writing presentations with org-mode and beamer</title><content type='html'>&lt;div id="outline-container-1" class="outline-3"&gt;
&lt;div class="outline-text-3" id="text-1"&gt;

&lt;p&gt;
[&lt;strong&gt;Updated&lt;/strong&gt;:fixed an error in the template]
Things have been a bit quiet at &lt;a href="http://emacs-fu.blogspot.com"&gt;Emacs-Fu&lt;/a&gt; lately; this is mostly because I
have been very &lt;i&gt;busy&lt;/i&gt; with work, traveling, traveling for work
etc. Emacs-wise, this has been a &lt;i&gt;very&lt;/i&gt; intensive time, and I have been able
to move more and more task to emacs &amp;ndash; both professionally and
privately. This is mostly because thing become easier when I can do all my
things in one place.

&lt;/p&gt;
&lt;p&gt;
&lt;i&gt;Anyhow&lt;/i&gt;, one of the tricks I picked up recently is to write &lt;b&gt;presentations&lt;/b&gt;
with the combination of &lt;code&gt;org-mode&lt;/code&gt; and a LaTeX-package called &lt;code&gt;beamer&lt;/code&gt;. The
most common tool for doing presentations is Microsoft's &lt;i&gt;Powerpoint&lt;/i&gt;
program. It gets a lot of criticism, most famously from prof. Tufte in his
&lt;a href="http://www.wired.com/wired/archive/11.09/ppt2.html"&gt;Powerpoint is Evil&lt;/a&gt; essay. Of course, the problem is in misuse of the tool,
not so much the tool itself.

&lt;/p&gt;
&lt;p&gt;
Still, I didn't want to use Powerpoint (or Powerpoint-wannabees, like
OpenOffice's &lt;i&gt;Impress&lt;/i&gt;). For the technically-inclined, the knee-jerk
reaction to this kind of problem is to shout 'LaTeX!'. Indeed - the LaTeX
text-processing system offers a package called &lt;a href="http://latex-beamer.sourceforge.net/"&gt;Beamer&lt;/a&gt;, which allows you to
write presentations with LaTeX. It is quite powerful, and even allows for
all kinds of fancy graphical bling (fade-in, fade out etc.); even better, it
generates PDF-files, which can be viewed just about anywhere. The various
themes and color settings it offers are quite nice, even though they tend to
fill only a small corner of the design-universe&amp;hellip;
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-2" class="outline-3"&gt;
&lt;h3 id="sec-2"&gt;beamer and org-mode &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-2"&gt;


&lt;p&gt;
Now, while I am no stranger to LaTeX, especially for writing a quick
presentation, it can be a painful to remember the various directives and
options. I am not really a daily LaTeX-user, so I tend to forget these
things. I &lt;b&gt;am&lt;/b&gt; a daily &lt;code&gt;org-mode&lt;/code&gt; user though, and &lt;code&gt;org-mode&lt;/code&gt; can export to
LaTeX (which then, in turn, are translated into PDFs). So why not use
&lt;code&gt;org-mode&lt;/code&gt; to generate presentations?
&lt;/p&gt;

&lt;p&gt;
It turns out that that is &lt;i&gt;quite easy&lt;/i&gt;.
&lt;/p&gt;
&lt;p&gt;
First, we need to define some of the LaTeX-boilerplate, and tell &lt;code&gt;org-mode&lt;/code&gt;
about it, so we never need to think about it again. Put the following in
your &lt;code&gt;.emacs&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;allow for export=&amp;gt;beamer by placing

&lt;/span&gt;&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;#+LaTeX_CLASS: beamer in org files
&lt;/span&gt;(&lt;span class="org-keyword"&gt;unless&lt;/span&gt; (boundp 'org-export-latex-classes)
  (&lt;span class="org-keyword"&gt;setq&lt;/span&gt; org-export-latex-classes nil))
(add-to-list 'org-export-latex-classes
  &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;beamer class, for presentations
&lt;/span&gt;  '(&lt;span class="org-string"&gt;"beamer"&lt;/span&gt;
     &lt;span class="org-string"&gt;"\\documentclass[11pt]{beamer}\n
      \\mode&amp;lt;{{{beamermode}}}&amp;gt;\n
      \\usetheme{{{{beamertheme}}}}\n
      \\usecolortheme{{{{beamercolortheme}}}}\n
      \\beamertemplateballitem\n
      \\setbeameroption{show notes}
      \\usepackage[utf8]{inputenc}\n
      \\usepackage[T1]{fontenc}\n
      \\usepackage{hyperref}\n
      \\usepackage{color}
      \\usepackage{listings}
      \\lstset{numbers=none,language=[ISO]C++,tabsize=4,
  frame=single,
  basicstyle=\\small,
  showspaces=false,showstringspaces=false,
  showtabs=false,
  keywordstyle=\\color{blue}\\bfseries,
  commentstyle=\\color{red},
  }\n
      \\usepackage{verbatim}\n
      \\institute{{{{beamerinstitute}}}}\n          
       \\subject{{{{beamersubject}}}}\n"&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;"\\begin{frame}[fragile]\\frametitle{%s}"&lt;/span&gt;
       &lt;span class="org-string"&gt;"\\end{frame}"&lt;/span&gt;
       &lt;span class="org-string"&gt;"\\begin{frame}[fragile]\\frametitle{%s}"&lt;/span&gt;
       &lt;span class="org-string"&gt;"\\end{frame}"&lt;/span&gt;)))

  &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;letter class, for formal letters

&lt;/span&gt;  (add-to-list 'org-export-latex-classes

  '(&lt;span class="org-string"&gt;"letter"&lt;/span&gt;
     &lt;span class="org-string"&gt;"\\documentclass[11pt]{letter}\n
      \\usepackage[utf8]{inputenc}\n
      \\usepackage[T1]{fontenc}\n
      \\usepackage{color}"&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;
This is based on the template by &lt;a href="http://www.mail-archive.com/emacs-orgmode@gnu.org/msg17712.html"&gt;Thomas S. Dye&lt;/a&gt; on the &lt;code&gt;org-mode&lt;/code&gt; mailing
list. You can of course add other packages to it with &lt;code&gt;\usepackage&lt;/code&gt;. In my
version, I have add the &lt;a href="http://en.wikibooks.org/wiki/LaTeX/Packages/Listings"&gt;Listings&lt;/a&gt;-package for including syntax-highlighted
snippets of source code in my presentations. Importantly, I added the

&lt;code&gt;[fragile]&lt;/code&gt; options to the &lt;code&gt;frame&lt;/code&gt;-settings, otherwise you cannot include
such source code fragments without LaTeX complaining in various unhelpful
ways.
&lt;/p&gt;
&lt;p&gt;
Note, you can customize the way the Listings package works by changing the
template above; or by setting the options in the &lt;code&gt;org&lt;/code&gt;-file; this involves
some 'raw LaTeX' though. It might make sense to define some macros for
that.
&lt;/p&gt;
&lt;p&gt;
Now, we can easily make a presentation in &lt;code&gt;org-mode&lt;/code&gt;; simply start the file
with something like:
&lt;/p&gt;


&lt;pre class="src src-org"&gt;&lt;span class="org-org-meta-line"&gt;#+LaTeX_CLASS: beamer&lt;/span&gt;
&lt;span class="org-org-meta-line"&gt;#+MACRO: BEAMERMODE presentation&lt;/span&gt;
&lt;span class="org-org-meta-line"&gt;#+MACRO: BEAMERTHEME Antibes&lt;/span&gt;
&lt;span class="org-org-meta-line"&gt;#+MACRO: BEAMERCOLORTHEME lily&lt;/span&gt;
&lt;span class="org-org-meta-line"&gt;#+MACRO: BEAMERSUBJECT RMRF&lt;/span&gt;
&lt;span class="org-org-meta-line"&gt;#+MACRO: BEAMERINSTITUTE Miskatonic University, Astrology Dept.&lt;/span&gt;
&lt;span class="org-org-meta-line"&gt;#+TITLE: Presentation with Org-Mode and Beamer&lt;/span&gt;
&lt;span class="org-org-meta-line"&gt;#+AUTHOR: Someone&lt;/span&gt;

&lt;/pre&gt;




&lt;p&gt;
Of course, you can change these parameters; for example, you might want to
change the &lt;code&gt;BEAMERTHEME&lt;/code&gt; into &lt;i&gt;Madrid&lt;/i&gt; or &lt;i&gt;Warsaw&lt;/i&gt;, or &amp;hellip; &amp;ndash; see the &lt;a href="http://www.ctan.org/tex-archive/macros/latex/contrib/beamer/doc/beameruserguide.pdf"&gt;Beamer User Guide&lt;/a&gt; (PDF). 

&lt;/p&gt;
&lt;p&gt;
After having set up these things, you can write presentations in the familiar
&lt;code&gt;org-mode&lt;/code&gt; mark-up.
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

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


&lt;p&gt;
As mentioned before, you can use the &lt;code&gt;listings&lt;/code&gt;-package to include source
code snippets in your presentation. You'd write this something like:
&lt;/p&gt;



&lt;pre class="src src-org"&gt;&lt;span class="org-org-meta-line"&gt;#+BEGIN_LaTeX
&lt;/span&gt;&lt;span class="org-org-block"&gt;\begin{lstlisting}[language=c]
for (int i = 1; i != 10; ++i) 
    std::cout &amp;lt;&amp;lt; i &amp;lt;&amp;lt; ": hello, world!"
              &amp;lt;&amp;lt; std::endl;
\end{lstlisting}&lt;/span&gt;&lt;span class="org-org-meta-line"&gt;

#+END_LaTeX&lt;/span&gt;
&lt;/pre&gt;




&lt;p&gt;
In other words, we include some 'raw' LaTeX to do this. Now, the
&lt;code&gt;org-mode&lt;/code&gt;-way of doing this, would be to use something like 
&lt;/p&gt;



&lt;pre class="example"&gt;#+BEGIN_SRC c
  /* code */
#+END_SRC
&lt;/pre&gt;




&lt;p&gt;
as &lt;a href="http://emacs-fu.blogspot.com/2009/05/writing-and-blogging-with-org-mode.html"&gt;discussed before&lt;/a&gt;. This works well when exporting to HTML, but at this
moment this will simply translate into a &lt;code&gt;verbatim&lt;/code&gt; environment in LaTeX - so
we use &lt;code&gt;lstlisting&lt;/code&gt; to get some syntax-highlighting.
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

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


&lt;p&gt;
Of course, the full arsenal of &lt;code&gt;org-mode&lt;/code&gt; tools is available as well, for
example &lt;i&gt;Ditaa&lt;/i&gt;, as &lt;a href="http://emacs-fu.blogspot.com/2009/01/drawing-pictures.html"&gt;discussed before&lt;/a&gt;. Ditaa is now shipped as part of

&lt;code&gt;org-mode&lt;/code&gt;, and you can use it to create picture which are then included in
your presentation. Very nice.
&lt;/p&gt;
&lt;p&gt;
For including existing images (PNGs, JPGs etc.), it's probably easiest to
put use some raw LaTeX for that, e.g., something like
&lt;/p&gt;



&lt;pre class="src src-org"&gt;&lt;span class="org-org-meta-line"&gt;#+LaTeX:&lt;/span&gt;&lt;span class="org-org-block"&gt;\includegraphics{/some/path/emacs.png}&lt;/span&gt;
&lt;/pre&gt;




&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-5" class="outline-3"&gt;
&lt;h3 id="sec-5"&gt;putting it together &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-5"&gt;


&lt;p&gt;
Now, let's put it all together. Below is an example presentation. Assuming
you have everything installed (ie., LaTeX with the &lt;code&gt;listings&lt;/code&gt; package, a
fairly recent &lt;code&gt;org-mode&lt;/code&gt;, ditaa), you create your &lt;code&gt;presentation.org&lt;/code&gt; and
then press &lt;code&gt;C-c C-e d&lt;/code&gt; and your presentation (&lt;code&gt;presentation.pdf&lt;/code&gt;) is
generated and automatically shown in your PDF-viewer. Easy!

&lt;/p&gt;
&lt;p&gt;
The intermediate files (such as &lt;code&gt;presentation.tex&lt;/code&gt;) are there as well, so
you can check them if something went wrong.
&lt;/p&gt;
&lt;p&gt;
I have uploaded the resulting PDF &lt;a href="http://www.slideshare.net/djcb/example-presentation-using-orgmode-and-beamer"&gt;to Slideshare&lt;/a&gt;, so you can see what it
looks like. However, the Slideshare-converted version is &lt;i&gt;extremely&lt;/i&gt;
blurry, unlike the crisp PDF I &lt;i&gt;actually&lt;/i&gt; created. I'd be happy to upload
the file somewhere else if someone can point me to a good place, thanks!
&lt;/p&gt;

&lt;p&gt;
So hopefully this shows that you can quite easily make presentations with
&lt;code&gt;org-mode&lt;/code&gt;, with some help from Beamer, LaTeX etc. Beamer actually provides
a lot &lt;i&gt;more&lt;/i&gt;, such as funky slide-transitions and other tricks &amp;ndash; but the
things here should give you a good starting point. 
&lt;/p&gt;



&lt;pre class="src src-org"&gt;&lt;span class="org-org-meta-line"&gt;#+LaTeX_CLASS: beamer&lt;/span&gt;
&lt;span class="org-org-meta-line"&gt;#+MACRO: BEAMERMODE presentation&lt;/span&gt;
&lt;span class="org-org-meta-line"&gt;#+MACRO: BEAMERTHEME Antibes&lt;/span&gt;

&lt;span class="org-org-meta-line"&gt;#+MACRO: BEAMERCOLORTHEME lily&lt;/span&gt;
&lt;span class="org-org-meta-line"&gt;#+MACRO: BEAMERSUBJECT RMRF&lt;/span&gt;
&lt;span class="org-org-meta-line"&gt;#+MACRO: BEAMERINSTITUTE Miskatonic University, Astrology Dept.&lt;/span&gt;
&lt;span class="org-org-meta-line"&gt;#+TITLE: Presentation with Org-Mode and Beamer&lt;/span&gt;
&lt;span class="org-org-meta-line"&gt;#+AUTHOR: Someone&lt;/span&gt;

&lt;span class="org-org-level-1"&gt;* My presentation&lt;/span&gt;

&lt;span class="org-org-hide"&gt;*&lt;/span&gt;&lt;span class="org-org-level-2"&gt;* Overview&lt;/span&gt;

   1. Introduction

   2. Main part

   3. Questions
    
    
&lt;span class="org-org-hide"&gt;*&lt;/span&gt;&lt;span class="org-org-level-2"&gt;* Some interesting stuff&lt;/span&gt;
    
&lt;span class="org-org-hide"&gt;**&lt;/span&gt;&lt;span class="org-org-level-3"&gt;* an important point&lt;/span&gt;
    
    - subpoint a
      
    - subpoint b

&lt;span class="org-org-hide"&gt;*&lt;/span&gt;&lt;span class="org-org-level-2"&gt;* Graphics&lt;/span&gt;

&lt;span class="org-org-hide"&gt;**&lt;/span&gt;&lt;span class="org-org-level-3"&gt;* a picture&lt;/span&gt;

&lt;span class="org-org-meta-line"&gt;#+begin_ditaa blue.png -r -S
&lt;/span&gt;&lt;span class="org-org-block"&gt;+---------+
| cBLU    |
|    +----+
|    |cPNK|
+----+----+&lt;/span&gt;&lt;span class="org-org-meta-line"&gt;
#+end_ditaa&lt;/span&gt;

&lt;span class="org-org-hide"&gt;**&lt;/span&gt;&lt;span class="org-org-level-3"&gt;* another picture&lt;/span&gt;
&lt;span class="org-org-meta-line"&gt;#+LaTeX:&lt;/span&gt;&lt;span class="org-org-block"&gt;\includegraphics{emacs.png}&lt;/span&gt;

&lt;span class="org-org-hide"&gt;*&lt;/span&gt;&lt;span class="org-org-level-2"&gt;* More interesting stuff&lt;/span&gt;

&lt;span class="org-org-hide"&gt;**&lt;/span&gt;&lt;span class="org-org-level-3"&gt;* some C++ code&lt;/span&gt;
&lt;span class="org-org-meta-line"&gt;#+begin_LaTeX
&lt;/span&gt;&lt;span class="org-org-block"&gt;\begin{lstlisting}[language=c]
for (int i = 1; i != 10; ++i) 
    std::cout &amp;lt;&amp;lt; i &amp;lt;&amp;lt; ": hello, world!"
              &amp;lt;&amp;lt; std::endl;
\end{lstlisting}&lt;/span&gt;&lt;span class="org-org-meta-line"&gt;
#+end_LaTeX&lt;/span&gt;

&lt;span class="org-org-hide"&gt;**&lt;/span&gt;&lt;span class="org-org-level-3"&gt;* and some Python...&lt;/span&gt;

&lt;span class="org-org-meta-line"&gt;#+begin_LaTeX
&lt;/span&gt;&lt;span class="org-org-block"&gt;\begin{lstlisting}[language=python]
for i in range(1,10):
        print i, "hello, world!"
\end{lstlisting}&lt;/span&gt;&lt;span class="org-org-meta-line"&gt;
#+end_LaTeX&lt;/span&gt;
&lt;/pre&gt;



&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-4010982812325550896?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/4010982812325550896/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=4010982812325550896' title='34 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/4010982812325550896'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/4010982812325550896'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2009/10/writing-presentations-with-org-mode-and.html' title='writing presentations with org-mode and beamer'/><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>34</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-8920694292512517102</id><published>2009-09-19T12:24:00.002+03:00</published><updated>2009-09-19T12:36:36.018+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='wanderlust'/><title type='text'>wanderlust tips and tricks</title><content type='html'>&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div id="text-1"&gt;


&lt;p&gt;
&lt;a href="http://emacs-fu.blogspot.com/2009/06/e-mail-with-wanderlust.html"&gt;Earlier&lt;/a&gt;, I spoke of the wonderful &lt;a href="http://www.gohome.org/wl/"&gt;Wanderlust&lt;/a&gt; e-mail client. After years of
using &lt;a href="http://www.mutt.org"&gt;mutt&lt;/a&gt;, I am a quite happy Wanderlust-user now.  Now, it's few months
since my conversion, time to discuss some of the customizations I did. Not all
the defaults are so well-chosen (in my opinion), but fortunately, the package
is &lt;i&gt;very&lt;/i&gt; configurable. 

&lt;/p&gt;
&lt;p&gt;
If you are interested in Wanderlust, this entry might save you some time in
figuring out such customizations and some other tricks. If you haven't
done so before, I'd recommend you to read the &lt;a href="http://emacs-fu.blogspot.com/2009/06/e-mail-with-wanderlust.html"&gt;older entry&lt;/a&gt; first. Also, the
entry &lt;a href="http://emacs-fu.blogspot.com/2009/08/managing-e-mail-addresses-with-bbdb.html"&gt;about BBDB&lt;/a&gt; may be useful.
&lt;/p&gt;
&lt;p&gt;
Before going into the customizations, let me first answer a question I got
asked a couple of times: why I am using Wanderlust and not, say, &lt;a href="http://www.nongnu.org/viewmail/"&gt;VM&lt;/a&gt;, &lt;a href="http://www.gnus.org/"&gt;gnus&lt;/a&gt;,
&lt;a href="http://www.mew.org/en/"&gt;Mew&lt;/a&gt; or even &lt;a href="http://www.mutt.org"&gt;mutt&lt;/a&gt; or some other client? 

&lt;/p&gt;
&lt;p&gt;
To start with the last part, an emacs-based client fits in very well with my
workflow, which is (duh) revolves around emacs. Doing my email there as well
makes a lot of sense - a little return-on-investment for the time spent taming
emacs and its bag of tricks.
&lt;/p&gt;
&lt;p&gt;
The reason I particularly like Wanderlust, is that it works very well with
mail stored in maildirs - as you may know, maildir is a one-file-per-message
way of storing your mail on disk. That's great for backing up things, and
sync'ing different machines.
&lt;/p&gt;
&lt;p&gt;
Unlike &lt;code&gt;VM&lt;/code&gt; and &lt;code&gt;gnus&lt;/code&gt;, Wanderlust keeps the mail in the maildir as-is, and
does not use a separate spoolfile &amp;ndash; thus, all changes are reflected in the
maildir itself, making it possible to use different clients (ie., use &lt;code&gt;mutt&lt;/code&gt;

when needed). Even more important, the wonderful tool &lt;a href="http://software.complete.org/software/projects/show/offlineimap"&gt;offlineimap&lt;/a&gt; does
&lt;i&gt;two-way synchronization&lt;/i&gt; with IMAP-servers, and downloads everything into a
maildir. So, I can download all the mail on my laptop machine, go offline and
work on the messages (delete, move, reply etc.) during a flight, and when I'm
back online, I can synchronize things. All this 'cloud'-stuff is nice, but I
like to have my mails on my side of the intertubes.
&lt;/p&gt;
&lt;p&gt;
Ok, now let's take a look at some of the customizations and tricks. All of
these are little snippets to add to your &lt;code&gt;~/.wl&lt;/code&gt;-file.
&lt;/p&gt;

&lt;/div&gt;

&lt;div id="outline-container-1.1" class="outline-3"&gt;

&lt;h3 id="sec-1.1"&gt;Forwarded mails should use 'Fwd:', not 'Forward:' &lt;/h3&gt;
&lt;div id="text-1.1"&gt;


&lt;p&gt;
I wonder why this is not the default.
&lt;/p&gt;


&lt;pre class="src src-emacs-lisp"&gt;(&lt;span class="org-keyword"&gt;setq&lt;/span&gt;
  wl-forward-subject-prefix &lt;span class="org-string"&gt;"Fwd: "&lt;/span&gt; )    &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;use "Fwd: " not "Forward: "

&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;Reply-to-all should not be the default &lt;/h3&gt;
&lt;div id="text-1.2"&gt;


&lt;p&gt;
By default, Wanderlust uses &lt;i&gt;Reply-to-All&lt;/i&gt;; that is usually not what we (well,
I) want.  The code below makes &lt;i&gt;Reply-to-Sender&lt;/i&gt; the default, with

&lt;i&gt;Reply-to-All&lt;/i&gt; behind &lt;code&gt;C-u&lt;/code&gt;; ie. &lt;code&gt;A&lt;/code&gt; or &lt;code&gt;a&lt;/code&gt; will reply to &lt;i&gt;sender&lt;/i&gt;, &lt;code&gt;C-u A&lt;/code&gt;
and &lt;code&gt;C-u a&lt;/code&gt; reply to &lt;i&gt;all&lt;/i&gt;.

&lt;/p&gt;
&lt;p&gt;
(Note, the uppercase &lt;code&gt;A&lt;/code&gt; is for replying with quoting the original message,
while the lowercase version starts the reply with an empty message)
&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;from a WL-mailinglist post by David Bremner
&lt;/span&gt;
&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;Invert behaviour of with and without argument replies.
&lt;/span&gt;&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;just the author
&lt;/span&gt;(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; wl-draft-reply-without-argument-list
  '((&lt;span class="org-string"&gt;"Reply-To"&lt;/span&gt; (&lt;span class="org-string"&gt;"Reply-To"&lt;/span&gt;) nil nil)
     (&lt;span class="org-string"&gt;"Mail-Reply-To"&lt;/span&gt; (&lt;span class="org-string"&gt;"Mail-Reply-To"&lt;/span&gt;) nil nil)
     (&lt;span class="org-string"&gt;"From"&lt;/span&gt; (&lt;span class="org-string"&gt;"From"&lt;/span&gt;) nil nil)))


&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;bombard the world
&lt;/span&gt;(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; wl-draft-reply-with-argument-list
  '((&lt;span class="org-string"&gt;"Followup-To"&lt;/span&gt; nil nil (&lt;span class="org-string"&gt;"Followup-To"&lt;/span&gt;))
     (&lt;span class="org-string"&gt;"Mail-Followup-To"&lt;/span&gt; (&lt;span class="org-string"&gt;"Mail-Followup-To"&lt;/span&gt;) nil (&lt;span class="org-string"&gt;"Newsgroups"&lt;/span&gt;))
     (&lt;span class="org-string"&gt;"Reply-To"&lt;/span&gt; (&lt;span class="org-string"&gt;"Reply-To"&lt;/span&gt;) (&lt;span class="org-string"&gt;"To"&lt;/span&gt; &lt;span class="org-string"&gt;"Cc"&lt;/span&gt; &lt;span class="org-string"&gt;"From"&lt;/span&gt;) (&lt;span class="org-string"&gt;"Newsgroups"&lt;/span&gt;))
     (&lt;span class="org-string"&gt;"From"&lt;/span&gt; (&lt;span class="org-string"&gt;"From"&lt;/span&gt;) (&lt;span class="org-string"&gt;"To"&lt;/span&gt; &lt;span class="org-string"&gt;"Cc"&lt;/span&gt;) (&lt;span class="org-string"&gt;"Newsgroups"&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;Setting up spam-handling &lt;/h3&gt;
&lt;div id="text-1.3"&gt;


&lt;p&gt;
If you're using &lt;code&gt;spamassassin&lt;/code&gt; for spamfiltering, you can quite easily
integrate it with Wanderlust:

&lt;pre class="src src-emacs-lisp"&gt;(&lt;span class="org-keyword"&gt;require&lt;/span&gt; '&lt;span class="org-constant"&gt;wl-spam&lt;/span&gt;)
(wl-spam-setup)
(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; elmo-spam-scheme 'sa)   &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;sa for spamassassin, see the elmo-spam-scheme
&lt;/span&gt;                              &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;docs for alternatives
&lt;/span&gt;(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; wl-spam-folder &lt;span class="org-string"&gt;".spam"&lt;/span&gt;) &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;maildir to store spam

&lt;/span&gt;&lt;/pre&gt;

After this, you quite easily handle spam in the 'Summary' with some
keybindings:
&lt;/p&gt;&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;k C&lt;/code&gt; : check whether spamassassin considers this message 'spam'
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;k m&lt;/code&gt; : mark message(s) as spam (move to spam folder)
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;k n&lt;/code&gt; : learn this message is 'ham'

&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;k s&lt;/code&gt; : learn this message is 'spam'

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

&lt;p&gt;Note, there are some hooks for other spamfiltering solutions 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;How to easily refile messages &lt;/h3&gt;

&lt;div id="text-1.4"&gt;


&lt;p&gt;
I receive all my messages in only two mailboxes: one for personal mail, and
one for mailing lists. If, after reading, I want to keep the message, I'll
refile it to some other folder (after all, it's good to &lt;a href="http://inboxzero.com/"&gt;empty your mailboxes&lt;/a&gt;
quite often. Wanderlust makes this refiling quite easy; the first way is to do
it semi-automatic, i.e., let Wanderlust 'guess' the folder for you, based on
the contents of the message. Then, when pressing '&lt;code&gt;o&lt;/code&gt;' in the summary, it will
suggest this folder, and you can refile (move) the message. You can set up
this 'guessing' something like this:
&lt;/p&gt;


&lt;pre class="src src-emacs-lisp"&gt;(&lt;span class="org-keyword"&gt;setq&lt;/span&gt;
  &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;refile rules determine the default where mails are put

&lt;/span&gt;  &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;when you mark them for refiling ('o'); cfg. save-hooks in mutt
&lt;/span&gt;   wl-refile-rule-alist  
  '(
     (&lt;span class="org-string"&gt;"Subject"&lt;/span&gt; &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;put more specific rules before more general ones.
&lt;/span&gt;       (&lt;span class="org-string"&gt;"emacs"&lt;/span&gt;   . &lt;span class="org-string"&gt;".emacs"&lt;/span&gt;)   &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;emacs-related mail

&lt;/span&gt;       (&lt;span class="org-string"&gt;"running"&lt;/span&gt; . &lt;span class="org-string"&gt;".running"&lt;/span&gt;) &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;running-related mail
&lt;/span&gt;       )
     
     ((&lt;span class="org-string"&gt;"To"&lt;/span&gt; &lt;span class="org-string"&gt;"Cc"&lt;/span&gt; &lt;span class="org-string"&gt;"Delivered-To"&lt;/span&gt;) 
       (&lt;span class="org-string"&gt;"myself@company.com"&lt;/span&gt;      . &lt;span class="org-string"&gt;".workmail"&lt;/span&gt;) 
       (&lt;span class="org-string"&gt;"myself@home.com"&lt;/span&gt;         . &lt;span class="org-string"&gt;".privatemail"&lt;/span&gt;))
     
     ((&lt;span class="org-string"&gt;"Precedence"&lt;/span&gt; &lt;span class="org-string"&gt;"Priority"&lt;/span&gt;)
       (&lt;span class="org-string"&gt;"bulk\|1\|2\|list"&lt;/span&gt;       . &lt;span class="org-string"&gt;".bulkmail"&lt;/span&gt;))))

&lt;/pre&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;Explicit refiling &lt;/h3&gt;
&lt;div id="text-1.5"&gt;


&lt;p&gt;
Semi-automatic refiling works fairly well, but you might &lt;i&gt;also&lt;/i&gt; want to have
some explicit shortcuts to move messages to specific folders. For example, to
move message from your inbox to your &lt;code&gt;Project X&lt;/code&gt;-folder, or your &lt;code&gt;Project Y&lt;/code&gt;-folder.

&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;djcb-wl-summary-refile&lt;/span&gt; (&lt;span class="org-type"&gt;&amp;amp;optional&lt;/span&gt; folder)
  &lt;span class="org-doc"&gt;"refile the current message to FOLDER; if FOLDER is nil, use the default"&lt;/span&gt;
  (interactive)
  (wl-summary-refile (wl-summary-message-number) folder)
  (wl-summary-next)
  (message (concat &lt;span class="org-string"&gt;"refiled to "&lt;/span&gt; folder)))

(define-key wl-summary-mode-map (kbd &lt;span class="org-string"&gt;"b x"&lt;/span&gt;) &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;=&amp;gt; Project X

&lt;/span&gt;  '(&lt;span class="org-keyword"&gt;lambda&lt;/span&gt;()(interactive)(djcb-wl-summary-refile &lt;span class="org-string"&gt;".project-x"&lt;/span&gt;))) 
(define-key wl-summary-mode-map (kbd &lt;span class="org-string"&gt;"b y"&lt;/span&gt;) &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;=&amp;gt; Project Y
&lt;/span&gt;  '(&lt;span class="org-keyword"&gt;lambda&lt;/span&gt;()(interactive)(djcb-wl-summary-refile &lt;span class="org-string"&gt;".project-y"&lt;/span&gt;)))

&lt;/pre&gt;


&lt;p&gt;
Assuming you have (Maildir) folders &lt;code&gt;project-x&lt;/code&gt; and &lt;code&gt;project-y&lt;/code&gt;.
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1.6" class="outline-3"&gt;
&lt;h3 id="sec-1.6"&gt;Check outgoing mail &lt;/h3&gt;

&lt;div id="text-1.6"&gt;


&lt;p&gt;
It's not uncommon to forget to add a subject or an attachment when you send a
mail (or at least, when &lt;b&gt;I&lt;/b&gt; send a mail&amp;hellip;). However, using
&lt;code&gt;wl-mail-send-pre-hook&lt;/code&gt; we can let Wanderlust warn us when something like that
happens.
&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;suggested by Masaru Nomiya on the WL mailing list

&lt;/span&gt;(&lt;span class="org-keyword"&gt;defun&lt;/span&gt; &lt;span class="org-function-name"&gt;djcb-wl-draft-subject-check&lt;/span&gt; ()
  &lt;span class="org-doc"&gt;"check whether the message has a subject before sending"&lt;/span&gt;
  (&lt;span class="org-keyword"&gt;if&lt;/span&gt; (and (&amp;lt; (length (std11-field-body &lt;span class="org-string"&gt;"Subject"&lt;/span&gt;)) 1)
        (null (y-or-n-p &lt;span class="org-string"&gt;"No subject! Send current draft?"&lt;/span&gt;)))
      (&lt;span class="org-warning"&gt;error&lt;/span&gt; &lt;span class="org-string"&gt;"Abort."&lt;/span&gt;)))


&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;note, this check could cause some false positives; anyway, better
&lt;/span&gt;&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;safe than sorry...
&lt;/span&gt;(&lt;span class="org-keyword"&gt;defun&lt;/span&gt; &lt;span class="org-function-name"&gt;djcb-wl-draft-attachment-check&lt;/span&gt; ()
  &lt;span class="org-doc"&gt;"if attachment is mention but none included, warn the the user"&lt;/span&gt;
  (&lt;span class="org-keyword"&gt;save-excursion&lt;/span&gt;
    (goto-char 0)
    (&lt;span class="org-keyword"&gt;unless&lt;/span&gt; &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;don't we have an attachment?

&lt;/span&gt;      (re-search-forward &lt;span class="org-string"&gt;"^Content-Disposition: attachment"&lt;/span&gt; nil t) 
     (&lt;span class="org-keyword"&gt;when&lt;/span&gt; &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;no attachment; did we mention an attachment?
&lt;/span&gt;        (re-search-forward &lt;span class="org-string"&gt;"attach"&lt;/span&gt; nil t)
        (&lt;span class="org-keyword"&gt;unless&lt;/span&gt; (y-or-n-p &lt;span class="org-string"&gt;"Possibly missing an attachment. Send current draft?"&lt;/span&gt;)
          (&lt;span class="org-warning"&gt;error&lt;/span&gt; &lt;span class="org-string"&gt;"Abort."&lt;/span&gt;))))))

(&lt;span class="org-keyword"&gt;add-hook&lt;/span&gt; 'wl-mail-send-pre-hook 'djcb-wl-draft-subject-check)
(&lt;span class="org-keyword"&gt;add-hook&lt;/span&gt; 'wl-mail-send-pre-hook 'djcb-wl-draft-attachment-check)

&lt;/pre&gt;


&lt;p&gt;
Ok, that's all for now&amp;hellip; I'll get back to Wanderlust in the future; of
course, feel free to add your own tricks in the comments-section.
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-8920694292512517102?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/8920694292512517102/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=8920694292512517102' title='17 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/8920694292512517102'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/8920694292512517102'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2009/09/wanderlust-tips-and-tricks.html' title='wanderlust tips and tricks'/><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>17</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-7667598000615337484</id><published>2009-08-16T21:32:00.002+03:00</published><updated>2009-08-17T20:39:07.124+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='e-mail'/><title type='text'>managing e-mail addresses with bbdb</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://bbdb.sourceforge.net/"&gt;BBDB&lt;/a&gt;, the &lt;i&gt;Insidious Big Brother Database&lt;/i&gt; is an Emacs addressbook application
that works particularly well with e-mail. It's one of the classic emacs
packages, written in &lt;a href="http://www.jwz.org/bbdb/"&gt;1991 by Jamie Zawinski&lt;/a&gt;.
&lt;/p&gt;

&lt;p&gt;
Personally, I do not use BBDB as a general address book. Instead, I use it to
harvest the e-mail addresses of the people that send me mail, so that the next
time I'd like to send e-mail, I can auto-complete the names / e-mail
addresses. If you're not using some emacs-based email client, BBDB might not
be that useful in practice.
&lt;/p&gt;
&lt;p&gt;
Note that other people &lt;i&gt;are&lt;/i&gt; using BBDB for much more, see the &lt;a href="http://www.emacswiki.org/emacs/CategoryBbdb"&gt;Emacswiki-entry&lt;/a&gt;
for some examples of that. Here, I just give some basics to get you started;
please refer to the &lt;a href="http://bbdb.sourceforge.net/bbdb.html"&gt;fine manual&lt;/a&gt; for all the details.
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-2" class="outline-2"&gt;
&lt;h2 id="sec-2"&gt;configuration &lt;/h2&gt;
&lt;div class="outline-text-2" id="text-2"&gt;


&lt;p&gt;
So, after you've installed &lt;code&gt;bbdb&lt;/code&gt; (just follow the instructions; alternatively
Ubuntu/Debian users can simply install the &lt;code&gt;bbdb&lt;/code&gt; package), we can add the
following to &lt;code&gt;.emacs&lt;/code&gt; to set it up:

&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; bbdb-file &lt;span class="org-string"&gt;"~/.emacs.d/bbdb"&lt;/span&gt;)           &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;keep ~/ clean; set before loadin&lt;/span&gt;&lt;span class="org-comment"&gt;&lt;span class="org-warning"&gt;g&lt;/span&gt;&lt;/span&gt;&lt;span class="org-comment"&gt;
&lt;/span&gt;(&lt;span class="org-keyword"&gt;require&lt;/span&gt; '&lt;span class="org-constant"&gt;bbdb&lt;/span&gt;) 
(bbdb-initialize)
(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; 
    bbdb-offer-save 1                        &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;1 means save-without-asking

&lt;/span&gt;    
    bbdb-use-pop-up t                        &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;allow popups for addresses
&lt;/span&gt;    bbdb-electric-p t                        &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;be disposable with SPC
&lt;/span&gt;    bbdb-popup-target-lines  1               &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;very small
&lt;/span&gt;    
    bbdb-dwim-net-address-allow-redundancy t &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;always use full name
&lt;/span&gt;    bbdb-quiet-about-name-mismatches 2       &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;show name-mismatches 2 secs

&lt;/span&gt;    bbdb-always-add-address t                &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;add new addresses to existing...
&lt;/span&gt;                                             &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;...contacts automatically
&lt;/span&gt;    bbdb-canonicalize-redundant-nets-p t     &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;x@foo.bar.cx =&amp;gt; x@bar.cx
&lt;/span&gt;
    bbdb-completion-type nil                 &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;complete on anything

&lt;/span&gt;    bbdb-complete-name-allow-cycling t       &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;cycle through matches
&lt;/span&gt;                                             &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;this only works partially
&lt;/span&gt;
    bbbd-message-caching-enabled t           &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;be fast
&lt;/span&gt;    bbdb-use-alternate-names t               &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;use AKA
&lt;/span&gt;

    bbdb-elided-display t                    &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;single-line addresses
&lt;/span&gt;
    &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;auto-create addresses from mail
&lt;/span&gt;    bbdb/mail-auto-create-p 'bbdb-ignore-some-messages-hook   
    bbdb-ignore-some-messages-alist &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;don't ask about fake addresses
&lt;/span&gt;    &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;NOTE: there can be only one entry per header (such as To, From)
&lt;/span&gt;    &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;http://flex.ee.uec.ac.jp/texi/bbdb/bbdb_11.html

&lt;/span&gt;    '(( &lt;span class="org-string"&gt;"From"&lt;/span&gt; . &lt;span class="org-string"&gt;"no.?reply&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;DAEMON&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;daemon&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;facebookmail&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;twitter"&lt;/span&gt;)))
)

&lt;/pre&gt;




&lt;p&gt;
This will set up BBDB for you. I have commented the various settings; you can
of course get more information for each of them by putting your cursor on them
(in emacs) and issuing &lt;code&gt;C-h v&lt;/code&gt;.
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-3" class="outline-2"&gt;
&lt;h2 id="sec-3"&gt;integration with e-mail clients &lt;/h2&gt;

&lt;div class="outline-text-2" id="text-3"&gt;


&lt;p&gt;
Another important part is the integration with e-mail - which is why I am
using BBDB in the first place.
&lt;/p&gt;
&lt;p&gt;
As I mentioned &lt;a href="http://emacs-fu.blogspot.com/2009/06/e-mail-with-wanderlust.html"&gt;before&lt;/a&gt;, I am using the wonderful &lt;a href="http://www.gohome.org/wl/"&gt;Wanderlust&lt;/a&gt; e-mail client for
emacs, and you can easily integrate it with BBDB by putting the following in
your &lt;code&gt;.wl&lt;/code&gt;-file:
&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;bbdb-wl&lt;/span&gt;)
(bbdb-wl-setup)

&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;i don't want to store addresses from my mailing folders
&lt;/span&gt;(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; 
  bbdb-wl-folder-regexp    &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;get addresses only from these folders
&lt;/span&gt;  &lt;span class="org-string"&gt;"^\.inbox$&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;^.sent"&lt;/span&gt;)    &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;

&lt;/span&gt;
(define-key wl-draft-mode-map (kbd &lt;span class="org-string"&gt;"&amp;lt;C-tab&amp;gt;"&lt;/span&gt;) 'bbdb-complete-name)
&lt;/pre&gt;




&lt;p&gt;
For &lt;a href="http://gnus.org"&gt;gnus&lt;/a&gt;, you'd use something like:
&lt;/p&gt;

&lt;pre class="src src-emacs-lisp"&gt;(&lt;span class="org-keyword"&gt;add-hook&lt;/span&gt; 'gnus-startup-hook 'bbdb-insinuate-gnus)
&lt;/pre&gt;



&lt;p&gt;
(I am not using &lt;code&gt;gnus&lt;/code&gt; myself, feel free to add you setup in the comments)
&lt;/p&gt;
&lt;p&gt;
The &lt;a href="http://bbdb.sourceforge.net/bbdb.html#SEC19"&gt;BBDB-manual&lt;/a&gt; has the details for some other mail clients as well.

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

&lt;/div&gt;

&lt;div id="outline-container-4" class="outline-2"&gt;
&lt;h2 id="sec-4"&gt;Use &lt;/h2&gt;
&lt;div class="outline-text-2" id="text-4"&gt;


&lt;p&gt;
So, we have everything set up now &amp;ndash; but how does it work? Well, whenever you
read e-mails, BBDB stores the various e-mail addresses. Whenever you write an
e-mail, you can complete the names with &lt;code&gt;M-x bbdb-complete-name&lt;/code&gt;, by default
bound to &lt;code&gt;M-TAB&lt;/code&gt;. This keybinding conflicts with many window managers, which
already use &lt;code&gt;M-TAB&lt;/code&gt; (&lt;code&gt;Alt-TAB&lt;/code&gt;) for window switching. So, it's useful to
rebind it to something else, for example &lt;code&gt;C-TAB&lt;/code&gt; (I already did that for
Wanderlust, in the example above).

&lt;/p&gt;
&lt;p&gt;
I don't use BBDB too much directly, but you can manipulate the address; first
display one with &lt;code&gt;M-x bbdb-display-address&lt;/code&gt;, they you can edit a field by
pressing '&lt;code&gt;e&lt;/code&gt;', '&lt;code&gt;d&lt;/code&gt;' for deleting the field or record, &lt;code&gt;C-o&lt;/code&gt; for adding a new
field and so on &amp;ndash; see the &lt;a href="http://bbdb.sourceforge.net/bbdb.html#SEC33"&gt;whole list&lt;/a&gt;.
&lt;/p&gt;&lt;/div&gt;

&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-7667598000615337484?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/7667598000615337484/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=7667598000615337484' title='14 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/7667598000615337484'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/7667598000615337484'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2009/08/managing-e-mail-addresses-with-bbdb.html' title='managing e-mail addresses with bbdb'/><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-3896751953033645535</id><published>2009-08-03T19:55:00.004+03:00</published><updated>2009-08-03T20:01:34.639+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><category scheme='http://www.blogger.com/atom/ns#' term='interview'/><title type='text'>interview with Chong Yidong and Stefan Monnier</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;
Earlier this year, &lt;b&gt;Chong Yidong&lt;/b&gt; and &lt;b&gt;Stefan Monnier&lt;/b&gt; took over Emacs
maintainership from &lt;b&gt;Richard Stallman&lt;/b&gt;, and they successfully completed the

&lt;a href="http://emacs-fu.blogspot.com/2009/07/emacs-23-is-very-near.html"&gt;Emacs 23.1 release&lt;/a&gt;. I asked them a couple of questions about the process,
Emacs-development and some of the plans for the future.
&lt;/p&gt;
&lt;p&gt;
I'd like to thank Chong (&lt;b&gt;CYD&lt;/b&gt;) and Stefan (&lt;b&gt;SM&lt;/b&gt;) to take the time to answer my
(&lt;b&gt;djcb&lt;/b&gt;) questions and even more so for doing an excellent job bringing us
Emacs 23!
&lt;/p&gt;


&lt;hr&gt; 

&lt;em&gt;&lt;b&gt; 
&lt;p&gt;

&lt;b&gt;djcb&lt;/b&gt;: First of all, could you tell us a bit about yourself? For example,
what you do when &lt;b&gt;not&lt;/b&gt; hacking on Emacs?
&lt;/b&gt;&lt;/em&gt;&lt;p&gt;   

&lt;b&gt;CYD&lt;/b&gt;: I'm a postdoc in theoretical physics, specializing in photonic crystals
and other optical phenomena.
&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;SM&lt;/b&gt;: I'm a professor at the &lt;a href="http://www.umontreal.ca/english/index.htm"&gt;University of Montréal&lt;/a&gt;, teaching and researching
theory of computer languages.  More specifically, I design new type systems
and try and abuse existing type systems for "type based formal methods"
purposes.
&lt;/p&gt;


&lt;em&gt;&lt;b&gt;
&lt;p&gt;
&lt;b&gt;djcb&lt;/b&gt;: Earlier this year, the two of you took over the maintainership of Emacs from
Richard Stallman. How did you get involved in hacking on Emacs?  How has the
transition gone?
&lt;/b&gt;&lt;/em&gt;&lt;p&gt;


&lt;b&gt;CYD&lt;/b&gt;: My first involvement in Emacs-related development was around 2004 or
2005&amp;mdash;very recent by Emacs hacker standards&amp;mdash;when I found myself with some
free time on my hands after college.  At that time, I wrote &lt;a href="http://www.Emacswiki.org/Emacs/WikipediaMode"&gt;wikipedia-mode&lt;/a&gt;, a
major mode for editing Wikipedia articles, plus some word-wrapping code that
eventually became &lt;code&gt;longlines-mode&lt;/code&gt;, and patches to &lt;a href="http://lists.gnu.org/archive/html/emacs-devel/"&gt;emacs-devel&lt;/a&gt; fixing a few
minor bugs.  My level of involvement gradually grew, until eventually I was
helping Richard to roll the pretest tarballs for the Emacs 22 release.

&lt;/p&gt;
&lt;p&gt;
Because I was quite active in the Emacs 22 release process, I've been
pretty comfortable with my role in Emacs 23.  It helps, of course, that
many parts of Emacs have their own dedicated and experienced
maintainers, e.g. the major Lisp packages such as &lt;a href="http://cc-mode.sourceforge.net/"&gt;CC-mode&lt;/a&gt;, &lt;a href="http://www.gnus.org/"&gt;Gnus&lt;/a&gt;, and
&lt;a href="http://orgmode.org/"&gt;Org-mode&lt;/a&gt;.
&lt;/p&gt;

&lt;p&gt;
&lt;b&gt;SM&lt;/b&gt;: I started hacking on Emacs a fairly long time ago when I was waiting to
start my PhD, but it only got more serious during my PhD when I decided that
&lt;code&gt;PCL-CVS&lt;/code&gt; was a neat idea but unusable as it stood (for lack of
maintainership). It all went downhill from there.

&lt;/p&gt;
&lt;p&gt;
The transition to maintainership happened very smoothly.  I had already
considered maintaining Emacs when Gerd [ &lt;b&gt;Gerd Moellmann&lt;/b&gt; ] left (i.e. when
21.1 was released; at which point Richard ended up regaining maintainership
for lack of any other volunteer), but it was a pretty busy time for me, so I
decided not to. This time Richard kept a very active role, which coupled with
the help of Chong made it very pleasant.
&lt;/p&gt;
&lt;p&gt;
There's a fair bit of pressure, of course, because it's a very old package, so
people have a lot invested in it, making some changes terribly delicate.  As a
maintainer, I did get to steer the direction of Emacs development, tho mostly
by my own contributions and by imposing some contentious new defaults.  The
role of a maintainer as I see it is mostly to make sure the package keeps its
integrity.
&lt;/p&gt;
&lt;p&gt;
But I have to say, that while Chong started maybe a bit more of a "rookie
maintainer" than I, he quickly took over and he deserves much of the credit
for 23.1, while I was too busy with my work to do much good.
&lt;/p&gt;


&lt;em&gt;&lt;b&gt; 
&lt;p&gt;

&lt;b&gt;djcb&lt;/b&gt;: Talking about Emacs development: there are of course many people
involved. Can you give a estimate of how many?
&lt;/b&gt;&lt;/em&gt;&lt;p&gt;

&lt;b&gt;CYD&lt;/b&gt;: There are about 120 people who have commit access to the code
repository; of these, I think around 20 contribute regularly.  This does
not count the packages that are maintained separately from Emacs.
&lt;/p&gt;
&lt;p&gt;
Additionally, we do of course receive a steady stream of small patches
from various users.
&lt;/p&gt;


&lt;em&gt;&lt;b&gt;
&lt;p&gt;
Emacs 23 has just been released (on July 29 2009), congratulations, a great
accomplishment indeed!  From your perspective, what are the most important
improvements in Emacs 23 for end-users?  And what about the internals? Are
there any big changes in the way Emacs operates?
&lt;/b&gt;&lt;/em&gt;&lt;p&gt;

&lt;b&gt;CYD&lt;/b&gt;: I'd describe the Emacs 23 release cycle as dominated by internals
changes, in contrast with Emacs 22, where most of the major improvements
occurred at the Lisp level.  There are two fundamental changes.  First, the
internal character representation is now &lt;a href="http://en.wikipedia.org/wiki/Unicode"&gt;Unicode&lt;/a&gt;-based, which simplifies
various aspects of multilingual editing.  Second, the font engine has been
revamped, and, among other things, we now support anti-aliasing on X.  Both
these changes are due largely to &lt;b&gt;Kenichi Handa&lt;/b&gt;, who deserves a huge amount
of credit for patiently developing the code a period of years.
&lt;/p&gt;
&lt;p&gt;
One other major internals change is a restructuring of the terminal
interaction code, by &lt;b&gt;Károly Lőrentey&lt;/b&gt;, which allows a single Emacs process to
display on X and text terminals simultaneously.  Building on this "multi-tty"
code, &lt;b&gt;Dan Nicolescu&lt;/b&gt; implemented a small but clever hack, allowing Emacs to
run as a daemon serving &lt;code&gt;emacsclient&lt;/code&gt; connections.

&lt;/p&gt;
&lt;p&gt;
There are several Lisp-level changes, large and small.  For instance, Stefan
revamped the minibuffer completion code, which is now more sophisticated about
generating completions.  And there are, as usual, new modes and packages:
&lt;a href="http://www.tsdh.de/cgi-bin/wiki.pl/doc-view.el"&gt;Doc-view mode&lt;/a&gt;, &lt;a href="http://www.emacswiki.org/emacs/RubyMode"&gt;Ruby mode&lt;/a&gt;, &lt;a href="http://www.emacswiki.org/emacs/NxmlMode"&gt;nXml mode&lt;/a&gt;, etc.
&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;SM&lt;/b&gt;: Better support for Unicode, and better support for fonts, multi-tty
support, plus lots of new modes as always.  Of course, I'm very happy with my
new completion code, which makes &lt;code&gt;partial-completion-mode&lt;/code&gt; obsolete (and
enabled by default).
&lt;/p&gt;

&lt;p&gt;
The new support for Unicode and for fonts required significant changes.  Big
thanks to Kenichi Handa for most of that.
&lt;/p&gt;


&lt;em&gt;&lt;b&gt;
&lt;p&gt;
&lt;b&gt;djcb&lt;/b&gt;: Are there any features that you would have liked to add, but that were somehow
not yet ready?
&lt;/b&gt;&lt;/em&gt;&lt;p&gt;

&lt;b&gt;CYD&lt;/b&gt;: One feature that I'd have liked to include into 23.1 is &lt;a href="http://cedet.sourceforge.net/"&gt;CEDET&lt;/a&gt;, a set of
packages by &lt;b&gt;Eric Ludlum&lt;/b&gt; (the author of &lt;a href="http://cedet.sourceforge.net/speedbar.shtml"&gt;Speedbar&lt;/a&gt;), which turns Emacs into an
IDE.  There was no time to merge it for 23.1, but hopefully it will be
included in 23.2.

&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;SM&lt;/b&gt;: Several packages were planned for inclusion, but didn't make it.
Support for &lt;a href="http://www.gnustep.org/"&gt;GNUstep&lt;/a&gt; was planned (and is actually in there) but doesn't work.
Also I hoped the new VC code would be developed further, but it sadly stayed
at the stage where it mostly provides the same features as the old one (with
all kinds of improvements in the way it supports them, tho).
&lt;/p&gt;


&lt;em&gt;&lt;b&gt;
&lt;p&gt;
&lt;b&gt;djcb&lt;/b&gt;: There is always a bit of tension in Emacs between keeping things as they are,
and changing things to be more like other programs - for example when thinking
about key bindings and various defaults. What is your take on this?  Should
Emacs try to accommodate new users, or instead try to keep things as they are?
&lt;/b&gt;&lt;/em&gt;&lt;p&gt;

&lt;b&gt;CYD&lt;/b&gt;: My impression is that I'm a little more conservative than Stefan with
regards to changes, though I'm not sure what he thinks ;-) That said, we seem
to arrive at the same conclusions with surprising frequency.

&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;SM&lt;/b&gt;: Emacs standard key bindings (like &lt;code&gt;C-x&lt;/code&gt; and &lt;code&gt;C-c&lt;/code&gt; prefixes) clash badly
with "standard" key bindings of other apps, so I don't think there's much hope
to make Emacs like other applications.  But yes, I generally believe that, all
things being equal, it's better to be like others than to be different in this
respect.  But since changing bindings (or behaviors) is disruptive, I only
consider it worthwhile if I believe the new default is really superior (not
just for new users).
&lt;/p&gt;


&lt;em&gt;&lt;b&gt;
&lt;p&gt;
&lt;b&gt;djcb&lt;/b&gt;: For example, in Emacs 23, &lt;code&gt;transient-mark-mode&lt;/code&gt; is the default, but

&lt;code&gt;delete-selection-mode&lt;/code&gt; is not. How do you decide such things?
&lt;/b&gt;&lt;/em&gt;&lt;p&gt;

&lt;b&gt;CYD&lt;/b&gt;: Typically, we try not to make flashy changes.  The transient mark mode
change is the exception that proves the rule: &lt;code&gt;transient-mark-mode&lt;/code&gt; is so
useful, and is so widely used (even Richard uses it), that it doesn't make
sense to leave it off by default.  But the rule of thumb is to improve Emacs
on Emacs' own terms; for instance, &lt;a href="http://www.Emacswiki.org/Emacs/CuaMode"&gt;CUA mode&lt;/a&gt; will not become the default
anytime soon, I think.
&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;SM&lt;/b&gt;: &lt;code&gt;transient-mark-mode&lt;/code&gt; is an enabler: it allows some commands to behave
differently depending on the activation state of the region.  So it's a clear
improvement.  delete-selection-mode is not as important in this regard.  We
may see something along the lines of &lt;code&gt;delete-selection-mode&lt;/code&gt; at some point,
tho probably something more minor that only caters to the few cases where

&lt;code&gt;delete-selection-mode&lt;/code&gt; is more than just a way to avoid hitting &lt;code&gt;C-w&lt;/code&gt;.
&lt;/p&gt;


&lt;em&gt;&lt;b&gt;
&lt;p&gt;
&lt;b&gt;djcb&lt;/b&gt;: How do you see the competition with other text editors? Do you look for
ideas elsewhere? Is there any other editor you would be using if Emacs did not
exist?
&lt;/b&gt;&lt;/em&gt;&lt;p&gt;

&lt;b&gt;CYD&lt;/b&gt;: I'm afraid I don't pay much attention to other editors.
&lt;/p&gt;

&lt;p&gt;
&lt;b&gt;SM&lt;/b&gt;: I used &lt;a href="http://en.wikipedia.org/wiki/Zmacs"&gt;Zmacs&lt;/a&gt;, &lt;a href="http://www.xEmacs.org/"&gt;XEmacs&lt;/a&gt;, and Epoch at some point. That's about it.  I do
like structured editors, and I think Emacs should and will move in this
direction (with more parsing going on).
&lt;/p&gt;


&lt;em&gt;&lt;b&gt;
&lt;p&gt;
&lt;b&gt;djcb&lt;/b&gt;: It's a bit premature of course, but it's always interesting to
speculate a bit about the future. Do you have any particular post-Emacs-23
plans? Obviously, this all depends on what people come up with, but are there
any directions you would like Emacs to go?
&lt;/b&gt;&lt;/em&gt;&lt;p&gt;

&lt;b&gt;CYD&lt;/b&gt;: The present plan is for Emacs 23.2 to contain a small number of new
features, in addition to bugfixes.  As mentioned above, I'd like to try to
include CEDET. In general, I hope to move to shorter, more disciplined
release cycles.  Emacs 23 was a good step in that direction, as it was shorter
than the previous cycle.

&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;SM&lt;/b&gt;: My main goal for Emacs-23 was to shorten the release cycle.  Hopefully,
the quality has not been reduced accordingly.  For 23.N there are several
improvements planned (or even done), mostly about inclusion of packages like
&lt;a href="http://code.google.com/p/js2-mode/"&gt;js2-mode&lt;/a&gt; and CEDET.  In the longer term, the main goals for me are the
integration of the &lt;a href="http://www.emacswiki.org/emacs/DynamicBindingVsLexicalBinding"&gt;lexical-scoped&lt;/a&gt; branch, the support for bidirectional
display, and adding more parsing technology (basically replace syntax-tables
with something like &lt;code&gt;lex&lt;/code&gt; &amp;amp; &lt;code&gt;yacc&lt;/code&gt;, maybe).
&lt;/p&gt;

&lt;em&gt;&lt;b&gt;
&lt;p&gt;
Thanks a lot Stefan and Chong!
&lt;/b&gt;&lt;/em&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-3896751953033645535?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/3896751953033645535/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=3896751953033645535' title='15 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/3896751953033645535'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/3896751953033645535'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2009/08/interview-with-chong-yidong-and-stefan.html' title='interview with Chong Yidong and Stefan Monnier'/><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>15</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-1623045079395274179</id><published>2009-07-28T23:01:00.006+03:00</published><updated>2009-07-30T08:13:48.134+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='emacs23'/><title type='text'>emacs 23 has been released!</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_kGFGcbwevHE/Sm9ZSHvk4sI/AAAAAAAAAcc/YP5RnSqMnVw/s1600-h/e23.png"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 270px; height: 320px;" src="http://2.bp.blogspot.com/_kGFGcbwevHE/Sm9ZSHvk4sI/AAAAAAAAAcc/YP5RnSqMnVw/s320/e23.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5363603849072665282" /&gt;&lt;/a&gt;

&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div class="outline-text-2" id="text-1"&gt;


&lt;p&gt;
Emacs 23(.1) has &lt;a href="http://lists.gnu.org/archive/html/emacs-devel/2009-07/msg01526.html"&gt;been released&lt;/a&gt;! After only just over two years since the
previous version, emacs 23 has been released on July 29 2009. Time to
celebrate! And a big thanks all the talented hackers that made it possible!
&lt;/p&gt;
&lt;p&gt;
Emacs 23 brings &lt;i&gt;many&lt;/i&gt; new features. Some of those have been discussed before
in emacs-fu, and of course you can get the full list from the &lt;code&gt;NEWS&lt;/code&gt;-file
(&lt;code&gt;C-h n&lt;/code&gt;). This is just a list of some of the highlights, in particular the
end-user-visible ones. Let's go through them - of course I cannot mention all
of them, so feel free to add your favorite one in the comments.

&lt;/p&gt;

&lt;/div&gt;

&lt;div id="outline-container-1.1" class="outline-3"&gt;
&lt;h3 id="sec-1.1"&gt;fonts &amp;amp; anti-aliasing &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1.1"&gt;


&lt;p&gt;
Finally, emacs 23 brings support for anti-aliased fonts to X (Mac/Windows
users have had this for a while). If you're running emacs on X, this one
change is enough to &lt;i&gt;never&lt;/i&gt; want to go back to an older version of Emacs
again. 

&lt;/p&gt;
&lt;p&gt;
The new font system mentioned in some posts before: &lt;a href="http://emacs-fu.blogspot.com/2009/06/setting-fonts.html"&gt;setting fonts&lt;/a&gt; and &lt;a href="http://emacs-fu.blogspot.com/2009/01/emacs-23.html"&gt;emacs 23&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;support for D-Bus and Zeroconf &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1.2"&gt;


&lt;p&gt;
You can now call other services on the desktop using the DBUS IPC system
(popular on X); &lt;a href="http://emacs-fu.blogspot.com/2009/01/using-d-bus-example.html"&gt;using d-bus: an example&lt;/a&gt; shows how to communicate with the
&lt;i&gt;Tomboy&lt;/i&gt; note taker program from emacs. As more and more desktop services
are accessible using D-BUS, this offers great opportunities for better
integrating emacs with the rest of the desktop. For example, one could
imagine that emacs could communicate with a network manager when it needs a
connection. Or it could show a desktop notification when an appointment is
near. And all without adding hard dependencies or calling external
binaries.
&lt;/p&gt;
&lt;p&gt;
Using &lt;i&gt;Zeroconf&lt;/i&gt; is also quite easy; for example, to get a list of all
zeroconf-support printers, you could do something silly like:
&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;zeroconf&lt;/span&gt;)
(zeroconf-init)
(&lt;span class="org-keyword"&gt;dolist&lt;/span&gt; (srv (zeroconf-list-services &lt;span class="org-string"&gt;"_printer._tcp"&lt;/span&gt;))
  (insert (format &lt;span class="org-string"&gt;"\nprinter: %s"&lt;/span&gt; (nth 2 srv))))

&lt;/pre&gt;




&lt;p&gt;
to insert a list of the available printers in your current buffer. As with
D-Bus, it's really an enabler for a lot of cool things.
&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;support for 'headless' emacs-daemon &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1.3"&gt;


&lt;p&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_kGFGcbwevHE/Sm9ZcC0WL9I/AAAAAAAAAck/XBI56e-Xqok/s1600-h/e23-2.png"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 279px; height: 320px;" src="http://4.bp.blogspot.com/_kGFGcbwevHE/Sm9ZcC0WL9I/AAAAAAAAAck/XBI56e-Xqok/s320/e23-2.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5363604019549188050" /&gt;&lt;/a&gt;
If you have a lot of support packages, emacs startup can be a bit slow.
However, emacs 23 brings &lt;code&gt;emacs --daemon&lt;/code&gt;, which enables you to start emacs
in the background (for example when you log in). You can instantly pop up
new emacs windows (frames) with &lt;code&gt;emacsclient&lt;/code&gt;. Of course, you could already
have an emacs 'server' in older versions, but being able to start it in the
background makes this a much nicer solution.
&lt;/p&gt;
&lt;p&gt;
The Emacs-daemon was discussed in emacs-fu in &lt;a href="http://emacs-fu.blogspot.com/2009/02/emacs-daemon.html"&gt;emacs &amp;ndash;daemon&lt;/a&gt; and &lt;a href="http://emacs-fu.blogspot.com/2009/03/windows-and-daemons.html"&gt;windows and daemons&lt;/a&gt; (for MS-Windows). Popping up new emacs windows is so fast that
you can use emacs for any editing job, for example as an &lt;a href="http://emacs-fu.blogspot.com/2009/01/e-mail-with-emacs-using-mutt.html"&gt;editor for an email program&lt;/a&gt;, or for quick &lt;a href="http://emacs-fu.blogspot.com/2009/04/remember.html"&gt;rememember notes&lt;/a&gt;.

&lt;/p&gt;
&lt;p&gt;
You can even combine X and console clients in one session now.
&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;Emacs now support Xembed &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1.4"&gt;


&lt;p&gt;
This enables you to embed emacs in other programs (on X) using
&lt;i&gt;XEmbed&lt;/i&gt;. Haven't played with that yet. There is some more information in

&lt;a href="http://www.emacswiki.org/emacs/EmacsXembed"&gt;EmacsWiki/Xembed&lt;/a&gt;.
&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;Support for frame opacity &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1.5"&gt;


&lt;p&gt;
You can now make you emacs frames transparent. Discussed before in
&lt;a href="http://emacs-fu.blogspot.com/2009/02/transparent-emacs.html"&gt;transparent emacs&lt;/a&gt;. Not sure how useful this is, but it surely looks nice :)

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

&lt;/div&gt;

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


&lt;p&gt;
Emacs's character set is a &lt;b&gt;superset&lt;/b&gt; of Unicode, with &lt;i&gt;about four times&lt;/i&gt;

the space available. That should be enough for the foreseeable
future&amp;hellip; There are also many new character sets available, as well as new
language environments, such as Chinese-GB18030, Khmer, Bengali, Punjabi,
Gujarati, Oriya, Telugu, Sinhala, and TaiViet.
&lt;/p&gt;
&lt;p&gt;
Note that, internally, emacs uses UTF-8 now.
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-1.7" class="outline-3"&gt;
&lt;h3 id="sec-1.7"&gt;New defaults &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1.7"&gt;


&lt;ul&gt;
&lt;li&gt;
Screen motion now goes by &lt;i&gt;screen lines&lt;/i&gt; by default, that is when you
move the cursor up or down, it follows the line as you see them. Nice.

&lt;/li&gt;
&lt;li&gt;
Transient mark mode (visible selection) is now on by default, so no need
for &lt;code&gt;(transient-mark-mode t)&lt;/code&gt; in your &lt;code&gt;.emacs&lt;/code&gt; anymore. However, you
still need to put &lt;code&gt;(delete-selection-mode t)&lt;/code&gt; if you like replace the
current selection with your typing.


&lt;/li&gt;
&lt;li&gt;
Also shift-select mode is enabled by default, so you can select with
shift + the arrow keys.

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

&lt;/div&gt;

&lt;div id="outline-container-1.8" class="outline-3"&gt;
&lt;h3 id="sec-1.8"&gt;New modes and packages, and updated ones &lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1.8"&gt;


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

&lt;code&gt;docview-mode&lt;/code&gt; enables you to open PDF/DVI/PS files within emacs;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;M-x butterfly&lt;/code&gt; (see &lt;a href="http://xkcd.com/378/"&gt;http://xkcd.com/378/&lt;/a&gt;)
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;EasyPG&lt;/code&gt;; access &lt;code&gt;GNUPG&lt;/code&gt;, available under &lt;code&gt;Tools/Encryption/Decryption&lt;/code&gt;

&lt;/li&gt;
&lt;li&gt;
fast line numbers with &lt;code&gt;linum&lt;/code&gt;; see &lt;a href="http://emacs-fu.blogspot.com/2008/12/showing-line-numbers.html"&gt;showing line numbers&lt;/a&gt;;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;proced&lt;/code&gt;: dired for processes (&lt;code&gt;M-x proced&lt;/code&gt;);
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;remember-mode&lt;/code&gt;, for jotting down things to remember; see &lt;a href="http://emacs-fu.blogspot.com/2009/04/remember.html"&gt;remember&lt;/a&gt;;

&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ruby-mode&lt;/code&gt;, &lt;code&gt;xesam-mode&lt;/code&gt;, &lt;code&gt;zeroconf&lt;/code&gt;, &amp;hellip;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;abbrev&lt;/code&gt; has been rewritten
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;gdb&lt;/code&gt; can be very fancy now: &lt;a href="http://emacs-fu.blogspot.com/2009/02/fancy-debugging-with-gdb.html"&gt;fancy debugging with gdb&lt;/a&gt;;

&lt;/li&gt;
&lt;li&gt;
file deletion can use the system 'Trash'; see &lt;a href="http://emacs-fu.blogspot.com/2009/05/using-systems-trash-when-deleting-files.html"&gt;using the system's trash when deleting files&lt;/a&gt;.

&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-1623045079395274179?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/1623045079395274179/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=1623045079395274179' title='13 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/1623045079395274179'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/1623045079395274179'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2009/07/emacs-23-is-very-near.html' title='emacs 23 has been released!'/><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/_kGFGcbwevHE/Sm9ZSHvk4sI/AAAAAAAAAcc/YP5RnSqMnVw/s72-c/e23.png' height='72' width='72'/><thr:total>13</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-8770008443738509713</id><published>2009-07-13T22:59:00.002+03:00</published><updated>2009-07-13T23:52:21.374+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><title type='text'>stepping through your window configurations</title><content type='html'>&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div id="text-1"&gt;


&lt;p&gt;
As a small addendum to the entry about &lt;a href="http://emacs-fu.blogspot.com/2009/07/keeping-related-buffers-together-with.html"&gt;keeping related buffers together&lt;/a&gt; (with
Elscreen): there is also &lt;code&gt;winner-mode&lt;/code&gt;, as was mentioned by
&lt;a href="http://www.blogger.com/profile/12171124992468174311"&gt;ustunozgur&lt;/a&gt;. &lt;code&gt;winner-mode&lt;/code&gt; is a bit simpler than Elscreen. It allows you to
step through the various window configuration you had before - instead of
having separate 'tabs' as in elscreen, you just step through your history.

&lt;/p&gt;
&lt;p&gt;
I have 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;require&lt;/span&gt; '&lt;span class="org-constant"&gt;winner&lt;/span&gt;)
(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; winner-dont-bind-my-keys t) &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;default bindings conflict with org-mode

&lt;/span&gt;(global-set-key (kbd &lt;span class="org-string"&gt;"&amp;lt;C-s-left&amp;gt;"&lt;/span&gt;) 'winner-undo)
(global-set-key (kbd &lt;span class="org-string"&gt;"&amp;lt;C-s-right&amp;gt;"&lt;/span&gt;) 'winner-redo)
(winner-mode t) &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;turn on the global minor mode
&lt;/span&gt;&lt;/pre&gt;




&lt;p&gt;

As you see, I am using the &lt;a href="http://emacs-fu.blogspot.com/2009/07/keyboard-shortcuts.html"&gt;windows-key&lt;/a&gt; in the key bindings once more, but of
course you can use something else as well.
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-8770008443738509713?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/8770008443738509713/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=8770008443738509713' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/8770008443738509713'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/8770008443738509713'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2009/07/stepping-through-your-window.html' title='stepping through your window configurations'/><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>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-3109898975148292477</id><published>2009-07-09T00:14:00.003+03:00</published><updated>2009-07-09T00:25:04.714+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><title type='text'>keeping related buffers together with elscreen</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_kGFGcbwevHE/SlUOrRlfAKI/AAAAAAAAAcU/Hz2TwX21o8I/s1600-h/elscreen.png"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 111px;" src="http://4.bp.blogspot.com/_kGFGcbwevHE/SlUOrRlfAKI/AAAAAAAAAcU/Hz2TwX21o8I/s400/elscreen.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5356203468444860578" /&gt;&lt;/a&gt;

&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div id="text-1"&gt;


&lt;p&gt;
I wrote about switching buffers a &lt;a href="http://emacs-fu.blogspot.com/2008/12/easy-switching-between-visible-buffers.html"&gt;couple&lt;/a&gt; of &lt;a href="http://emacs-fu.blogspot.com/2009/02/switching-buffers.html"&gt;times&lt;/a&gt;. Switching buffers is one of
the things I do a lot when using emacs &amp;ndash; switching between e-mail, IRC and
some blog entry. Or simply between a couple of source files in a project.

&lt;/p&gt;
&lt;p&gt;
With some of the tricks mentioned, switching buffers can be made pretty
easy. 
&lt;/p&gt;
&lt;p&gt;
However, what about programs that consist of &lt;i&gt;multiple&lt;/i&gt; buffers? For example,
my e-mail program (&lt;a href="http://emacs-fu.blogspot.com/2009/06/e-mail-with-wanderlust.html"&gt;Wanderlust&lt;/a&gt;) splits the screen in separate buffers with mail
headers, mail folders and the contents of one message. The same for &lt;a href="http://emacs-fu.blogspot.com/2009/02/fancy-debugging-with-gdb.html"&gt;fancy debugging with gdb&lt;/a&gt;, or simply when I have split my screen in two (&lt;code&gt;C-x 2&lt;/code&gt;) to
view two files at the same time. When I then try to switch buffers, only one
of the related buffers will be switched &amp;ndash; which is usually not what I want.

&lt;/p&gt;
&lt;p&gt;
I'd like to treat a set of related buffers plus their screen layout as a
logical unit.
&lt;/p&gt;
&lt;p&gt;
There are different ways to do that in emacs. One obvious way is to use
multiple frames (windows). But I prefer to keep everything in one - and I
found the that the easiest solution is &lt;a href="http://www.morishima.net/~naoto/software/elscreen/"&gt;elscreen&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Installation is simple; download &lt;a href="ftp://ftp.morishima.net/pub/morishima.net/naoto/ElScreen/"&gt;from here&lt;/a&gt;, and follow the instructions in the
package. I've set up some easy key-bindings in my &lt;code&gt;.emacs&lt;/code&gt;:
&lt;/p&gt;


&lt;pre class="src src-emacs-lisp"&gt;
(load &lt;span class="org-string"&gt;"elscreen"&lt;/span&gt; &lt;span class="org-string"&gt;"ElScreen"&lt;/span&gt; )

&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;F9 creates a new elscreen, shift-F9 kills it
&lt;/span&gt;(global-set-key (kbd &lt;span class="org-string"&gt;"&amp;lt;f9&amp;gt;"&lt;/span&gt;    ) 'elscreen-create)
(global-set-key (kbd &lt;span class="org-string"&gt;"S-&amp;lt;f9&amp;gt;"&lt;/span&gt;  ) 'elscreen-kill)  


&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;Windowskey+PgUP/PgDown switches between elscreens
&lt;/span&gt;(global-set-key (kbd &lt;span class="org-string"&gt;"&amp;lt;s-prior&amp;gt;"&lt;/span&gt;) 'elscreen-previous) 
(global-set-key (kbd &lt;span class="org-string"&gt;"&amp;lt;s-next&amp;gt;"&lt;/span&gt;)  'elscreen-next) 
&lt;/pre&gt;




&lt;p&gt;

Now, whenever I want to switch to a new task, say, read e-mail, I press &lt;code&gt;F9&lt;/code&gt;,
and a new elscreen will appear (it's visible as a sort-of 'tab' at the top of
your screen), and start e-mail there. I can then switch to other elscreens,
and all of them maintain their buffers and window layout. I have found this
very useful. There are some more tricks, and some add-on packages, but this
should give you a good start.
&lt;/p&gt;
&lt;p&gt;
There is one small item on my todo-list. Example: when I push &lt;code&gt;M-x wl&lt;/code&gt;, emacs
automatically switches to the Wanderlust-buffer &amp;ndash; or starts it. Now, when
using elscreen, I'd like to automatically switch to the correct screen instead
of switching the current buffer.
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-3109898975148292477?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/3109898975148292477/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=3109898975148292477' title='15 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/3109898975148292477'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/3109898975148292477'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2009/07/keeping-related-buffers-together-with.html' title='keeping related buffers together with elscreen'/><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://4.bp.blogspot.com/_kGFGcbwevHE/SlUOrRlfAKI/AAAAAAAAAcU/Hz2TwX21o8I/s72-c/elscreen.png' height='72' width='72'/><thr:total>15</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-5665846641446989540</id><published>2009-07-03T22:46:00.003+03:00</published><updated>2009-07-03T22:49:31.096+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><title type='text'>keyboard shortcuts</title><content type='html'>&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div id="text-1"&gt;


&lt;p&gt;
Emacs has &lt;i&gt;many&lt;/i&gt; useful functions, but for the most efficient use you really
need to make keybindings (as &lt;a href="http://emacs-fu.blogspot.com/2008/12/binding-keys.html"&gt;previously discussed&lt;/a&gt;) for the ones you use
often. There's no shortage of &lt;i&gt;possible shortcuts&lt;/i&gt;, but the number of
easy-to-remember bindings is fairly limited.

&lt;/p&gt;
&lt;p&gt;
I can remember bindings that I use &lt;i&gt;all the time&lt;/i&gt; like &lt;code&gt;M-w&lt;/code&gt; for copy (well,
&lt;code&gt;kill-ring-save&lt;/code&gt;), or &lt;code&gt;M-q&lt;/code&gt; (&lt;code&gt;fill-paragraph&lt;/code&gt;) to word-wrap a paragraph, even
if they're not &lt;i&gt;that&lt;/i&gt; mnemonic (interestingly, it can be hard to verbalize
these bindings when someone ask me &amp;ndash; but my fingers have no such
trouble).

&lt;/p&gt;
&lt;p&gt;
For functions that I use every minute, any weird key binding will do (as long
as it is short). And functions that I use seldomly I can look up in a
menu. The trouble is with those functions in between :)
&lt;/p&gt;
&lt;p&gt;
Bindings that involve the arrow-keys are attractive, but I've found that
e.g. &lt;code&gt;org-mode&lt;/code&gt; binds many of those already. And in the &lt;i&gt;olden days&lt;/i&gt;, the
&lt;code&gt;C-c&lt;/code&gt;-prefix was reserved for user-defined key bindings &amp;ndash; but again,
&lt;code&gt;org-mode&lt;/code&gt; and other packages have overtaken that those. So what's left?
Recently, I have been using the Windows-key a bit more. Under (my) X, it's
bound to &lt;code&gt;super&lt;/code&gt;, and emacs does not use it for anything else, so I have been
using it to create a set of useful key bindings. I am trying to be a bit

&lt;i&gt;systematic&lt;/i&gt;, where &lt;code&gt;super&lt;/code&gt; + lowercase letter starts some 'application':
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;
(global-set-key (kbd &lt;span class="org-string"&gt;"s-a"&lt;/span&gt;) 'org-agenda-list) &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;Agenda
&lt;/span&gt;(global-set-key (kbd &lt;span class="org-string"&gt;"s-n"&lt;/span&gt;) 'org-todo-list)   &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;todo-list (nextactions)

&lt;/span&gt;&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;program shortcuts
&lt;/span&gt;(global-set-key (kbd &lt;span class="org-string"&gt;"s-b"&lt;/span&gt;) 'browse-url)  &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;Browse (W3M)
&lt;/span&gt;(global-set-key (kbd &lt;span class="org-string"&gt;"s-f"&lt;/span&gt;) 'browse-url-firefox)  &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;Firefox...
&lt;/span&gt;(global-set-key (kbd &lt;span class="org-string"&gt;"s-t"&lt;/span&gt;) 'twitter-get-friends-timeline) &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;Twitter
&lt;/span&gt;(global-set-key (kbd &lt;span class="org-string"&gt;"s-w"&lt;/span&gt;) 'wl)            &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;Wanderlust
&lt;/span&gt;&lt;/pre&gt;




&lt;p&gt;
and &lt;code&gt;super&lt;/code&gt; + uppercase opens a file / special buffer, for example:
&lt;/p&gt;


&lt;pre class="src src-emacs-lisp"&gt;
(global-set-key (kbd &lt;span class="org-string"&gt;"s-S"&lt;/span&gt;) &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;scratch
&lt;/span&gt;  (&lt;span class="org-keyword"&gt;lambda&lt;/span&gt;()(interactive)(switch-to-buffer &lt;span class="org-string"&gt;"*scratch*"&lt;/span&gt;)))
(global-set-key (kbd &lt;span class="org-string"&gt;"s-E"&lt;/span&gt;) &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;.emacs
&lt;/span&gt;  (&lt;span class="org-keyword"&gt;lambda&lt;/span&gt;()(interactive)(find-file &lt;span class="org-string"&gt;"~/.emacs"&lt;/span&gt;)))
(global-set-key (kbd &lt;span class="org-string"&gt;"s-G"&lt;/span&gt;) &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;gtd.org
&lt;/span&gt;  (&lt;span class="org-keyword"&gt;lambda&lt;/span&gt;()(interactive)(find-file &lt;span class="org-string"&gt;"~/.emacs.d/org/agenda/gtd.org"&lt;/span&gt;))) 
&lt;/pre&gt;




&lt;p&gt;
&lt;code&gt;super&lt;/code&gt; + arrow keys I now use for &lt;code&gt;windmove&lt;/code&gt; (see &lt;a href="http://emacs-fu.blogspot.com/2008/12/easy-switching-between-visible-buffers.html"&gt;here&lt;/a&gt;).
&lt;/p&gt;
&lt;p&gt;
The windows-keys are not &lt;i&gt;perfect&lt;/i&gt; of course &amp;ndash; they don't work from the
console (easily) or, ironically, on Windows. But they &lt;i&gt;are&lt;/i&gt; mnemonic &amp;ndash; I can
remember &lt;code&gt;s-t&lt;/code&gt; for twitter; contrast this with &lt;code&gt;C-x 5 2&lt;/code&gt; to create a new
frame.

&lt;/p&gt;
&lt;p&gt;
So, I wonder, does anyone have some clever scheme for their key bindings? I
think I am getting much of the efficiency from emacs from the fact that I can
do just about anything with some quick actions on the keyboard, so I'm very
interested.
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-5665846641446989540?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/5665846641446989540/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=5665846641446989540' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/5665846641446989540'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/5665846641446989540'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2009/07/keyboard-shortcuts.html' title='keyboard shortcuts'/><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>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-1232044400492915164</id><published>2009-06-25T22:17:00.003+03:00</published><updated>2009-06-25T22:28:10.233+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><title type='text'>jumping back to past locations</title><content type='html'>&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div id="text-1"&gt;


&lt;p&gt;
With the &lt;code&gt;pop-global-mark&lt;/code&gt;-command, you can quickly jump back to the
locations you were before, like tracking back your bread crumbs.
&lt;/p&gt;
&lt;p&gt;
A typical example of this is when doing some programming and looking up some
function in another file, which refers to a function in yet another file, and
so on &amp;ndash; for example, see &lt;a href="http://emacs-fu.blogspot.com/2009/01/navigating-through-source-code-using.html"&gt;navigating through source code using tags&lt;/a&gt;.

&lt;/p&gt;
&lt;p&gt;
Press &lt;code&gt;C-x C-SPC&lt;/code&gt; (the default key binding for &lt;code&gt;pop-global-mark&lt;/code&gt;) to make your
journey back to where you came from; it works in a cyclical fashion as well,
so you can go on and on.
&lt;/p&gt;
&lt;p&gt;
Quite useful &amp;ndash; you may want to use a more convenient key binding
though. Admittedly, it's hard to come up with any intuitive keybinding which
is not already taken by something else&amp;hellip;
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-1232044400492915164?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/1232044400492915164/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=1232044400492915164' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/1232044400492915164'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/1232044400492915164'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2009/06/jumping-back-to-past-locations.html' title='jumping back to past locations'/><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>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-6212417962535190839</id><published>2009-06-23T20:26:00.004+03:00</published><updated>2009-06-24T01:01:43.082+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><title type='text'>setting fonts</title><content type='html'>&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div id="text-1"&gt;

&lt;p&gt;
&lt;b&gt;NOTE&lt;/b&gt;: if you like &lt;a href="http://emacs-fu.blogspot.com/2009/05/writing-and-blogging-with-org-mode.html"&gt;Org-Mode&lt;/a&gt;, please go and &lt;a href="http://sourceforge.net/community/cca09/vote/"&gt;vote for it&lt;/a&gt; in SourceForge
&lt;i&gt;Community Choice Award&lt;/i&gt; &amp;ndash; it's in the &lt;i&gt;Most Likely to Change Change the Way You Do Everything&lt;/i&gt;-category.

&lt;HR&gt;

For pleasant working with emacs, one of the more important things is choosing
the right &lt;i&gt;font&lt;/i&gt; ('face'). Especially within a windowing system, and
especially with Emacs 23, there are a lot of possibilities. I am thinking from
the Linux/X-Window perspective here &amp;ndash; the support for anti-aliased fonts
makes things look so much nicer &amp;ndash; &lt;a href="http://emacs-fu.blogspot.com/2009/01/emacs-23.html"&gt;as discussed before&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
On X, there are different ways to set your font. One way is through the menu
(&lt;code&gt;Options/Set default font.../&lt;/code&gt;). We can also set it in our &lt;code&gt;.emacs&lt;/code&gt;, with

&lt;code&gt;(set-default-font "&amp;lt;font&amp;gt;")&lt;/code&gt;, or using &lt;code&gt;~/.Xdefaults&lt;/code&gt;. The latter method
makes emacs-startup quite a bit faster, but this may have become less
important in the &lt;a href="http://emacs-fu.blogspot.com/2009/02/emacs-daemon.html"&gt;age of emacs &amp;ndash;daemon&lt;/a&gt; (Emacs 23).
&lt;/p&gt;

&lt;/div&gt;

&lt;div id="outline-container-1.1" class="outline-3"&gt;
&lt;h3 id="sec-1.1"&gt;barb wire &lt;/h3&gt;

&lt;div id="text-1.1"&gt;


&lt;p&gt;
In either case &amp;ndash; &lt;code&gt;.emacs&lt;/code&gt; or &lt;code&gt;.Xdefaults&lt;/code&gt; &amp;ndash; you must provide some string
describing the font. Up to Emacs-23, under X you had to use the 'barb
wire'-style X font description, which you could get from a tool like
UI-designers' dream &lt;code&gt;xfontsel&lt;/code&gt;; the font description would then
look something like:
&lt;/p&gt;

&lt;pre class="example"&gt;
  -*-bitstream vera sans mono-medium-r-*-*-*-120-*-*-*-*-iso8859-*
&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;emacs 23 &lt;/h3&gt;
&lt;div id="text-1.2"&gt;


&lt;p&gt;
In the brave new world of Emacs 23, on X, you can also use the somewhat
clearer &lt;code&gt;Fontname-&amp;lt;size&amp;gt;&lt;/code&gt; format. You can get a list of the fonts installed on
your system with the &lt;code&gt;fc-list&lt;/code&gt; commond; if you only want to get the monospaced
fonts, use
&lt;/p&gt;


&lt;pre class="example"&gt;
 $ fc-list :spacing=mono

&lt;/pre&gt;



&lt;p&gt;
For details, see the &lt;a href="http://fontconfig.org/fontconfig-user.html"&gt;FontConfig user manual&lt;/a&gt;. 
&lt;/p&gt;
&lt;p&gt;
Note that &lt;i&gt;installing&lt;/i&gt; fonts under X is rather easy as well these days; in
most cases all you need to do is put the &lt;code&gt;.ttf&lt;/code&gt;-files in your &lt;code&gt;~/.fonts&lt;/code&gt;

directory and all will be find, although some program might require a restart.
&lt;/p&gt;
&lt;p&gt;
Once you have chosen a font, you can put it in your &lt;code&gt;~/.Xdefaults&lt;/code&gt;:
&lt;/p&gt;


&lt;pre class="src src-text"&gt;
Emacs.font: Envy Code R-10
&lt;/pre&gt;



&lt;p&gt;
and don't forget to run &lt;code&gt;xrdb ~/.Xdefaults&lt;/code&gt; afterwards, to tell X about the changes.
All of this should happen &lt;b&gt;before&lt;/b&gt; you start emacs.

&lt;/p&gt;
&lt;p&gt;
Alternatively, you can put in your &lt;code&gt;.emacs&lt;/code&gt; something like:
&lt;/p&gt;


&lt;pre class="src src-emacs-lisp"&gt;
(&lt;span class="org-keyword"&gt;if&lt;/span&gt; (eq system-type 'windows-nt)
  (set-default-font &lt;span class="org-string"&gt;"-outline-Consolas-normal-r-normal-normal-14-97-96-96-c-*-is&lt;/span&gt;&lt;span class="org-string"&gt;&lt;span class="org-warning"&gt;o8859-1"&lt;/span&gt;&lt;/span&gt;&lt;span class="org-warning"&gt;))&lt;/span&gt;

(&lt;span class="org-keyword"&gt;if&lt;/span&gt; (eq window-system 'x)
  (set-default-font &lt;span class="org-string"&gt;"Inconsolata-11"&lt;/span&gt;))
&lt;/pre&gt;



&lt;p&gt;
This will set a different default font, based on whether you are running on
Windows or X. You can freely adapt it to your own desires of course. 
&lt;/p&gt;
&lt;p&gt;
Side note: if there is &lt;i&gt;yellow&lt;/i&gt; in the code snippet above, that is because of

&lt;a href="http://emacs-fu.blogspot.com/2008/12/highlighting-lines-that-are-too-long.html"&gt;hightlighting lines that are too long&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;face value &lt;/h3&gt;
&lt;div id="text-1.3"&gt;


&lt;p&gt;
There are many fonts; which one is the 'best' for you, obviously depends on
personal taste and also what you want to with it. As I use emacs for coding
but also for reading e-mails and writing documents, there are some things that
are important for &lt;i&gt;me&lt;/i&gt;:

&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
monospace
&lt;/li&gt;
&lt;li&gt;
most important: clear and crisp, even when using smaller font sizes;
&lt;/li&gt;
&lt;li&gt;
clearly separate O (capital O) and 0 (zero);
&lt;/li&gt;
&lt;li&gt;
support italic display;
&lt;/li&gt;
&lt;li&gt;
support the characters I might use (incl. accented characters and some
greek ones).

&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;Following these rules, I found the &lt;a href="http://damieng.com/blog/2008/05/26/envy-code-r-preview-7-coding-font-released"&gt;Envy Code R&lt;/a&gt; font to work very nicely. It's
not fully Free though: &lt;i&gt;Free to use but distribution prohibited&lt;/i&gt;. Raph
Levien's &lt;a href="http://www.levien.com/type/myfonts/inconsolata.html"&gt;Inconsolata&lt;/a&gt; is nice as well and &lt;i&gt;truly&lt;/i&gt; Free; it does not provide an
italic font though (at least it does not show in Emacs). Here's a &lt;a href="http://hivelogic.com/articles/view/top-10-programming-fonts"&gt;list of programming fonts&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;more &lt;/h3&gt;
&lt;div id="text-1.4"&gt;


&lt;p&gt;
Hmmm&amp;hellip; I wanted to write some small entry&amp;hellip; And there is &lt;i&gt;so much more&lt;/i&gt; to
say about fonts. As often, EmacsWiki has &lt;a href="http://www.emacswiki.org/emacs/FontSets"&gt;a lot of information&lt;/a&gt;; for example
about &lt;a href="http://www.emacswiki.org/emacs/FontSets"&gt;FontSets&lt;/a&gt;, which allow you to use a sort-of combination-font, which is
nice if you have to work with mixed character sets (Latin, Arabic, CJK etc.).

&lt;/p&gt;
&lt;p&gt;
Also, the emacs-fu entry on &lt;a href="http://emacs-fu.blogspot.com/2008/12/zooming-inout.html"&gt;zooming in/out&lt;/a&gt; is useful in this context, even
though Emacs 23 has gained something similar by default.
&lt;/p&gt;
&lt;p&gt;
Also, the entry on &lt;a href="http://emacs-fu.blogspot.com/2009/03/color-theming.html"&gt;color theming&lt;/a&gt; may be interesting, in this entry we only
look at the &lt;i&gt;default font&lt;/i&gt;, but you can change fonts governing only part of
emacs as well; see &lt;code&gt;M-x list-faces-display&lt;/code&gt;. 
&lt;/p&gt;

&lt;p&gt;
Or get information about the font at point with &lt;code&gt;C-u C-x =&lt;/code&gt;.
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-6212417962535190839?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/6212417962535190839/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=6212417962535190839' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/6212417962535190839'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/6212417962535190839'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2009/06/setting-fonts.html' title='setting fonts'/><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-8202379143854590612</id><published>2009-06-19T14:18:00.005+03:00</published><updated>2009-06-19T16:23:48.326+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><title type='text'>search and replace in files</title><content type='html'>&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div id="text-1"&gt;


&lt;p&gt;
I always try to do more things from within emacs; as said before, it's all
about &lt;i&gt;return on investment&lt;/i&gt; for all the time spent mastering emacs. One of
the things I sometimes still used a separate terminal for, was &lt;i&gt;search and replace&lt;/i&gt; of text in files &amp;ndash; a quick &lt;code&gt;grep&lt;/code&gt; or &lt;code&gt;sed&lt;/code&gt; from the command line.

&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: tags &lt;/h3&gt;
&lt;div id="text-1.1"&gt;

&lt;p&gt;If you're searching (not replacing) symbols in source code, the most
convenient way is to use a &lt;i&gt;tagfile&lt;/i&gt;. A while ago, I discussed
&lt;a href="http://emacs-fu.blogspot.com/2009/01/navigating-through-source-code-using.html"&gt;navigating through source code using tags&lt;/a&gt; (using
&lt;a href="http://www.gnu.org/software/global/"&gt;GNU Global&lt;/a&gt;). I still often see people
writing code in emacs, and then opening a terminal open to &lt;code&gt;grep&lt;/code&gt; for function
names, definition and so on&amp;hellip; There is really no need for that; see the
linked entry.

&lt;/p&gt;
&lt;p&gt;
The GNU Global tagfile system unfortunately does not have a search-and-replace
function; if you are using &lt;code&gt;etags&lt;/code&gt;, however, you can use &lt;code&gt;M-x tags-query-replace&lt;/code&gt; to replace the symbols in all files in the tagfile.
&lt;/p&gt;
&lt;p&gt;
GNU Global users can of course still use the other search-and-replace
mechanisms below.
&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;other files: rgrep &lt;/h3&gt;
&lt;div id="text-1.2"&gt;

&lt;p&gt;For searching recursively for some strings (regexps) in a file tree, there is
the very useful &lt;code&gt;M-x rgrep&lt;/code&gt;. It will ask what you want to search for, some
pattern for the files to match, and the top of the directory to search.
&lt;/p&gt;
&lt;p&gt;
So, for example, if you want to find all occurences of the string '&lt;code&gt;FIXME&lt;/code&gt;' in
&lt;code&gt;txt&lt;/code&gt;-files in your &lt;code&gt;~/Documents&lt;/code&gt; directory tree, you would do something like:
&lt;/p&gt;


&lt;pre class="src src-text"&gt;
M-x rgrep
FIXME
*.txt
~/Documents
&lt;/pre&gt;



&lt;p&gt;
and you will get at buffer with all matches. For this, it uses the same kind
of buffer you use for compilation, and you can jump to the matching locations
just like you can jump to error locations in the compilation output - that is
why with &lt;code&gt;M-x next-error&lt;/code&gt; you can jump from match to match, even though of
course they are not really errors. The default shortcut for &lt;code&gt;next-error&lt;/code&gt; is
&lt;code&gt;C-x`&lt;/code&gt;, but you can of course remap that to something saner, exempli gratia:
&lt;/p&gt;


&lt;pre class="src src-emacs-lisp"&gt;
(global-set-key (kbd &lt;span class="org-string"&gt;"&amp;lt;M-prior&amp;gt;"&lt;/span&gt;) 'previous-error) 
(global-set-key (kbd &lt;span class="org-string"&gt;"&amp;lt;M-next&amp;gt;"&lt;/span&gt;)  'next-error)
&lt;/pre&gt;



&lt;p&gt;

so you can use &lt;code&gt;M-&lt;/code&gt; with &lt;code&gt;PgUp/PgDown&lt;/code&gt; to jump through the matches (or
errors).
&lt;/p&gt;
&lt;p&gt;
One final comment about &lt;code&gt;rgrep&lt;/code&gt;: in the above example, the &lt;code&gt;FIXME&lt;/code&gt; is a
&lt;i&gt;regular expression&lt;/i&gt; (as discussed in

&lt;a href="http://emacs-fu.blogspot.com/2009/05/building-regular-expression.html"&gt;building regular expressions&lt;/a&gt;, while the &lt;code&gt;*.txt&lt;/code&gt; is a &lt;i&gt;shell pattern&lt;/i&gt; (see e.g.
&lt;a href="http://www.gnu.org/software/findutils/manual/html_node/find_html/Shell-Pattern-Matching.html"&gt;the findutils manual&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;replacing: dired &lt;/h3&gt;

&lt;div id="text-1.3"&gt;

&lt;p&gt;If you want to &lt;b&gt;replace&lt;/b&gt; text in multiple files, your best bet is to use
&lt;code&gt;dired&lt;/code&gt;, the emacs file manager. 
&lt;/p&gt;
&lt;p&gt;
&lt;code&gt;dired&lt;/code&gt; deserves its own entry (and probably more than one), but if we just
look at search-replace, the steps are not too hard. Suppose we want to replace
all strings &lt;code&gt;FOO&lt;/code&gt; with &lt;code&gt;BAR&lt;/code&gt; in a bunch of files in &lt;code&gt;~/myfiles/&lt;/code&gt;. We open

&lt;code&gt;dired&lt;/code&gt; with &lt;code&gt;C-x d&lt;/code&gt;, enter &lt;code&gt;~/myfiles&lt;/code&gt;, and a list of the files in that
directory appears.
&lt;/p&gt;
&lt;p&gt;
Now, we mark the files we'd like to change by moving the cursor to them and
press &lt;code&gt;m&lt;/code&gt; (unmark with &lt;code&gt;u&lt;/code&gt;). You can also mark filenames matching some regexp
with &lt;code&gt;M-x dired-mark-files-regexp&lt;/code&gt; (or '&lt;code&gt;* %&lt;/code&gt;', obviously) or files

&lt;i&gt;containing&lt;/i&gt; some regexp with &lt;code&gt;M-x dired-mark-files-containing-regexp&lt;/code&gt; (or '&lt;code&gt;* g&lt;/code&gt;'). 
&lt;/p&gt;
&lt;p&gt;
After marking some files, you can use &lt;code&gt;M-x dired-do-query-replace-regexp&lt;/code&gt; to
interactively replace some regular expression in all of them &amp;ndash; you have to
press '&lt;code&gt;y&lt;/code&gt;' to confirm the changes. You can quit this process by pressing
'&lt;code&gt;q&lt;/code&gt;'.

&lt;/p&gt;
&lt;p&gt;
&lt;code&gt;dired&lt;/code&gt; can even work recursively, as an anonymous commenter remarked
(thanks!); slightly edited:
You can type '&lt;code&gt;i&lt;/code&gt;' to insert a subdirectory to the dired buffer. You can also
run &lt;code&gt;M-x find-name-dired&lt;/code&gt; or &lt;code&gt;M-x find-dired&lt;/code&gt; to generate a &lt;code&gt;dired&lt;/code&gt; buffer
with the results of the &lt;code&gt;find&lt;/code&gt;-command. Then you can mark wanted files and
perform query replace with '&lt;code&gt;Q&lt;/code&gt;'. Also see: &lt;a href="http://atomized.org/2009/05/emacs-nerdery-search-replace-across-files/"&gt;Emacs Nerdery: Search &amp;amp; replace across files&lt;/a&gt;.

&lt;/p&gt;

&lt;p&gt;
As an alternative, you can use an external package like &lt;a href="http://www.emacswiki.org/emacs/FindrPackage"&gt;FindR&lt;/a&gt; for recursive
search &amp;amp; replace.  I haven't used that one myself though, as I haven't had the
need yet.
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-8202379143854590612?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/8202379143854590612/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=8202379143854590612' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/8202379143854590612'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/8202379143854590612'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2009/06/search-and-replace-in-files.html' title='search and replace in files'/><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-7491792775744224205</id><published>2009-06-16T23:40:00.005+03:00</published><updated>2009-06-16T23:47:27.877+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new'/><category scheme='http://www.blogger.com/atom/ns#' term='meta'/><title type='text'>emacs-fu feed updated</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_kGFGcbwevHE/SjgD8M3ozHI/AAAAAAAAAbA/-XlB0IwEiJA/s1600-h/feed.png"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 320px; height: 291px;" src="http://3.bp.blogspot.com/_kGFGcbwevHE/SjgD8M3ozHI/AAAAAAAAAbA/-XlB0IwEiJA/s320/feed.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5348028890284084338" /&gt;&lt;/a&gt;
&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div id="text-1"&gt;

&lt;p&gt;
At one point in your life, you reach the conclusion that you are &lt;i&gt;not perfect&lt;/i&gt;. Even I did :-). For example, some of the &lt;a href="http://emacs-fu.blogspot.com"&gt;Emacs-Fu&lt;/a&gt; posts contain
errors (typos, out-of-context copy-past etc.), which are usually quickly found
by some attentive reader. I do attempt to test things of course, but sometimes
things slip through.
&lt;/p&gt;
&lt;p&gt;

Of course, I can quickly fix those mistakes; I do know how to use a text
editor after all. The trouble with that is that it provokes aggregators like
&lt;a href="http://planet.emacsen.org/"&gt;Planet Emacsen&lt;/a&gt; and others to consider this as a new post, which is shown as
such on the main page. Of course I don't want to spam the poor Planet Emacsen
readers with updates just because I fixed a typo in some old entry.
&lt;/p&gt;
&lt;p&gt;
The problem is not with those aggregators &amp;ndash; it's with &lt;code&gt;blogger.com&lt;/code&gt;, which
does not invoke the right formula to say that something is &lt;code&gt;updated&lt;/code&gt; instead
of &lt;code&gt;published&lt;/code&gt;. And my power to change &lt;code&gt;blogger.com&lt;/code&gt; is rather limited.

&lt;/p&gt;
&lt;p&gt;
Blogger &lt;i&gt;does&lt;/i&gt; support tag-specific feeds though; so, my workaround is the
following:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The feed with all &lt;b&gt;new&lt;/b&gt; posts:
&lt;a href="http://emacs-fu.blogspot.com/feeds/posts/default/-/new"&gt;http://emacs-fu.blogspot.com/feeds/posts/default/-/new&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;A feed with &lt;b&gt;all updates&lt;/b&gt; (this is the current one):
&lt;a href="http://emacs-fu.blogspot.com/atom.xml"&gt;http://emacs-fu.blogspot.com/atom.xml&lt;/a&gt;

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

&lt;p&gt;When I update an entry, I will &lt;i&gt;remove&lt;/i&gt; the &lt;code&gt;new&lt;/code&gt;-tag, so aggregators that use
the first feed will not be bombarded with these small changes - and I am
planning a few..
&lt;/p&gt;

&lt;p&gt;
So, if you only want to get the new posts, I'd recommend changing to the 
&lt;i&gt;first&lt;/i&gt; feed. Planet Emacsen has already done so (thanks &lt;a href="http://edward.oconnor.cx/tags/emacs"&gt;Edward&lt;/a&gt;!).
&lt;/p&gt;

&lt;p&gt;
Now keeping my fingers crossed it'll all work as expected...
&lt;/p&gt;




&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-7491792775744224205?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/7491792775744224205/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=7491792775744224205' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/7491792775744224205'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/7491792775744224205'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2009/06/feed.html' title='emacs-fu feed updated'/><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/_kGFGcbwevHE/SjgD8M3ozHI/AAAAAAAAAbA/-XlB0IwEiJA/s72-c/feed.png' height='72' width='72'/><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-4232338125405844707</id><published>2009-06-13T22:37:00.005+03:00</published><updated>2009-06-14T00:46:12.050+03: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'>ERC: the emacs IRC client</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_kGFGcbwevHE/SjQAWFJ28dI/AAAAAAAAAa4/57kEaiNfpW8/s1600-h/erc.png"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 333px;" src="http://1.bp.blogspot.com/_kGFGcbwevHE/SjQAWFJ28dI/AAAAAAAAAa4/57kEaiNfpW8/s400/erc.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5346899036936270290" /&gt;&lt;/a&gt;

&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;h2 id="sec-1"&gt;ERC: IRC with emacs &lt;/h2&gt;
&lt;div id="text-1"&gt;


&lt;p&gt;
I am migrating more and more of my computer tasks to &lt;code&gt;emacs&lt;/code&gt;; I already
discussed &lt;a href="http://emacs-fu.blogspot.com/2009/03/twitter.html"&gt;Twitter&lt;/a&gt; and &lt;a href="http://emacs-fu.blogspot.com/2009/06/e-mail-with-wanderlust.html"&gt;e-mail&lt;/a&gt; (with &lt;i&gt;Wanderlust&lt;/i&gt;); I'm also using &lt;a href="http://w3m.sourceforge.net/"&gt;emacs-w3m&lt;/a&gt; for
some of my web browsing (more about that some other time).

&lt;/p&gt;
&lt;p&gt;
Reason for this ongoing emacsication is to get some &lt;i&gt;return on investment&lt;/i&gt; for
those countless hours spent on mastering the One True Editor. And it pays
off - I can manipulate and glue all these programs together so they fit my
workflow like a glove.
&lt;/p&gt;
&lt;p&gt;
Recently, I have also started use emacs for &lt;a href="http://en.wikipedia.org/wiki/Irc"&gt;IRC&lt;/a&gt;, another great Finnish
invention. I am not really an IRC power-user, but I do use; before, I used
&lt;a href="http://irssi.org/"&gt;irssi&lt;/a&gt; for that, in a &lt;code&gt;ansi-term&lt;/code&gt; console (&lt;a href="http://emacs-fu.blogspot.com/2008/12/running-console-programs-inside-emacs.html"&gt;as explained&lt;/a&gt;). But now I have
switched to &lt;a href="http://www.emacswiki.org/emacs/ERC"&gt;ERC&lt;/a&gt;, the emacs IRC-client. You can do just about &lt;i&gt;anything&lt;/i&gt; with
ERC &amp;ndash; I have only barely scratched the surface. But let me share my basic
setup.

&lt;/p&gt;
&lt;p&gt;
There first step is getting ERC; it's bundled with any recent emacs, so all
you need to do is to add it to your &lt;a href="http://emacs-fu.blogspot.com/2008/12/emacs.html"&gt;.emacs&lt;/a&gt;:
&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;erc&lt;/span&gt;)
&lt;/pre&gt;




&lt;p&gt;
That was not too hard, was it?
&lt;/p&gt;
&lt;p&gt;
Now, the thing this is to determine what irc-servers / channels you'd like to
join (of course you can do that later manually, but automate what we can). So,
we define &lt;code&gt;erc-autojoin-channels-alist&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;joining &amp;amp;&amp;amp; autojoing

&lt;/span&gt;&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;make sure to use wildcards for e.g. freenode as the actual server
&lt;/span&gt;&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;name can be be a bit different, which would screw up autoconnect
&lt;/span&gt;(erc-autojoin-mode t)
(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; erc-autojoin-channels-alist
  '((&lt;span class="org-string"&gt;".*\\.freenode.net"&lt;/span&gt; &lt;span class="org-string"&gt;"#emacs"&lt;/span&gt; &lt;span class="org-string"&gt;"#gnu"&lt;/span&gt; &lt;span class="org-string"&gt;"#gcc"&lt;/span&gt; &lt;span class="org-string"&gt;"#modest"&lt;/span&gt; &lt;span class="org-string"&gt;"#maemo"&lt;/span&gt;)
     (&lt;span class="org-string"&gt;".*\\.gimp.org"&lt;/span&gt; &lt;span class="org-string"&gt;"#unix"&lt;/span&gt; &lt;span class="org-string"&gt;"#gtk+"&lt;/span&gt;)))

&lt;/pre&gt;




&lt;p&gt;
So, the first element is the IRC-server (with appropriate wildcards), the
other elements are channels. This will make ERC automatically join the
channels when it notices you're connected to the IRC-server.
&lt;/p&gt;
&lt;p&gt;
And read the comment &amp;ndash; it took me some time to figure out why things weren't
working. Also, you might want to change these IRC-channels to your own
favorites.
&lt;/p&gt;
&lt;p&gt;
The next thing is &lt;i&gt;tracking&lt;/i&gt;: ERC can track the various channels you're in,
and notify you when there is something new in the channel (it will colorize
the channelname in your modeline). This is generally useful, but I don't
really care about when people join or leave, or other IRC-meta spam. So:

&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;check channels
&lt;/span&gt;(erc-track-mode t)
(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; erc-track-exclude-types '(&lt;span class="org-string"&gt;"JOIN"&lt;/span&gt; &lt;span class="org-string"&gt;"NICK"&lt;/span&gt; &lt;span class="org-string"&gt;"PART"&lt;/span&gt; &lt;span class="org-string"&gt;"QUIT"&lt;/span&gt; &lt;span class="org-string"&gt;"MODE"&lt;/span&gt;

                                 &lt;span class="org-string"&gt;"324"&lt;/span&gt; &lt;span class="org-string"&gt;"329"&lt;/span&gt; &lt;span class="org-string"&gt;"332"&lt;/span&gt; &lt;span class="org-string"&gt;"333"&lt;/span&gt; &lt;span class="org-string"&gt;"353"&lt;/span&gt; &lt;span class="org-string"&gt;"477"&lt;/span&gt;))
&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;don't show any of this
&lt;/span&gt;(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; erc-hide-list '(&lt;span class="org-string"&gt;"JOIN"&lt;/span&gt; &lt;span class="org-string"&gt;"PART"&lt;/span&gt; &lt;span class="org-string"&gt;"QUIT"&lt;/span&gt; &lt;span class="org-string"&gt;"NICK"&lt;/span&gt;))

&lt;/pre&gt;



&lt;p&gt;
Note, the last line has nothing to do with this &lt;i&gt;tracking&lt;/i&gt;, that's just
telling ERC that I am not interested in those things &lt;i&gt;at all&lt;/i&gt;, so it should
hide them.
&lt;/p&gt;
&lt;p&gt;
Almost there. Now, I have some function to actually start ERC; it's based on
some code in found &lt;i&gt;somewhere&lt;/i&gt;, but cannot find right now. The function will
start ERC, or switch to it if it's already running &amp;ndash; it will actually switch
to the &lt;i&gt;most recently active ERC-buffer&lt;/i&gt;, which makes things a bit easier to manage.

&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;djcb-erc-start-or-switch&lt;/span&gt; ()
  &lt;span class="org-doc"&gt;"Connect to ERC, or switch to last active buffer"&lt;/span&gt;
  (interactive)
  (&lt;span class="org-keyword"&gt;if&lt;/span&gt; (get-buffer &lt;span class="org-string"&gt;"irc.freenode.net:6667"&lt;/span&gt;) &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;ERC already active?

&lt;/span&gt;    (erc-track-switch-buffer 1) &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;yes: switch to last active
&lt;/span&gt;    (&lt;span class="org-keyword"&gt;when&lt;/span&gt; (y-or-n-p &lt;span class="org-string"&gt;"Start ERC? "&lt;/span&gt;) &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;no: maybe start ERC
&lt;/span&gt;      (erc &lt;span class="org-builtin"&gt;:server&lt;/span&gt; &lt;span class="org-string"&gt;"irc.freenode.net"&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;"foo"&lt;/span&gt; &lt;span class="org-builtin"&gt;:full-name&lt;/span&gt; &lt;span class="org-string"&gt;"bar"&lt;/span&gt;)
      (erc &lt;span class="org-builtin"&gt;:server&lt;/span&gt; &lt;span class="org-string"&gt;"irc.gimp.org"&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;"foo"&lt;/span&gt; &lt;span class="org-builtin"&gt;:full-name&lt;/span&gt; &lt;span class="org-string"&gt;"bar"&lt;/span&gt;))))

&lt;/pre&gt;




&lt;p&gt;
&lt;b&gt;Note&lt;/b&gt;: don't forget to replace the &lt;code&gt;:server&lt;/code&gt;-value as well as &lt;code&gt;foo&lt;/code&gt; and
&lt;code&gt;bar&lt;/code&gt; with your own preferences. It should be clear what they mean&amp;hellip;

&lt;/p&gt;
&lt;p&gt;
You can bind this function to some easy key, and things get really convenient;
for example:
&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;switch to ERC with Ctrl+c e
&lt;/span&gt;(global-set-key (kbd &lt;span class="org-string"&gt;"C-c e"&lt;/span&gt;) 'djcb-erc-start-or-switch) &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;ERC
&lt;/span&gt;&lt;/pre&gt;



&lt;p&gt;
Once you have started ERC and are connected to some channels, things work
pretty much as in any &lt;a href="http://en.wikipedia.org/wiki/Internet_Relay_Chat"&gt;IRC-client&lt;/a&gt;. For each channel, a buffer is opened, and
from their on it is up to you to have enlightening conversations with other
people around the globe&amp;hellip;
&lt;/p&gt;
&lt;p&gt;
Once more, I have only barely scratched the surface of ERC. These are just
some basic instructions for getting things working. After that, there are a
million things you can do; EmacsWiki has an &lt;a href="http://www.emacswiki.org/emacs/ERC"&gt;extensive section&lt;/a&gt; on it, with more
information and customization then you'll probably ever need.
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-4232338125405844707?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/4232338125405844707/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=4232338125405844707' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/4232338125405844707'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/4232338125405844707'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2009/06/erc-emacs-irc-client.html' title='ERC: the emacs IRC client'/><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/_kGFGcbwevHE/SjQAWFJ28dI/AAAAAAAAAa4/57kEaiNfpW8/s72-c/erc.png' height='72' width='72'/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-3100804549251888041</id><published>2009-06-08T21:35:00.006+03:00</published><updated>2010-06-13T18:25:09.677+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='wanderlust'/><title type='text'>e-mail with wanderlust</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_kGFGcbwevHE/Si1ajctajoI/AAAAAAAAAaw/VnA_PZBsIOk/s1600-h/Screenshot-emacs%40mindcrime.png"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 293px;" src="http://3.bp.blogspot.com/_kGFGcbwevHE/Si1ajctajoI/AAAAAAAAAaw/VnA_PZBsIOk/s400/Screenshot-emacs%40mindcrime.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5345027897807244930" /&gt;&lt;/a&gt;

&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;h2 id="sec-1"&gt;e-mail with wanderlust &lt;/h2&gt;
&lt;div class="outline-text-2" id="text-1"&gt;


&lt;p&gt;
(This is part I of entry on the &lt;i&gt;wanderlust&lt;/i&gt; e-mail client; part II will
appear &lt;i&gt;soon&lt;/i&gt;).
&lt;/p&gt;
&lt;p&gt;
Earlier, I have written about how I am using &lt;a href="http://mutt.org"&gt;mutt&lt;/a&gt; as my e-mailclient. I
discussed &lt;a href="http://emacs-fu.blogspot.com/2009/01/e-mail-with-emacs-using-mutt.html"&gt;running mutt inside emacs&lt;/a&gt; as well. Of course, mutt is an &lt;i&gt;external&lt;/i&gt;
program, which puts some limits on its integration with emacs. I did try
various emacs-based clients, such as &lt;a href="http://www.nongnu.org/viewmail/"&gt;VM&lt;/a&gt; (ViewMail) and &lt;a href="http://www.gnus.org/"&gt;GNUS&lt;/a&gt;, but they always
left me a bit unsatisfied.
&lt;/p&gt;
&lt;p&gt;
To start with, it was rather hard to set these programs up &amp;ndash; and I am an
Emacs-user, I &lt;i&gt;like&lt;/i&gt; tweaking things&amp;hellip; Still, it was hard to get even simple
things working. Maybe I have uncommon wishes, but my desired setup already
sent me to the edges of the googleable universe.
&lt;/p&gt;
&lt;p&gt;
But now I have found an emacs-based client that seems to work really well for
me. It's called &lt;a href="http://www.gohome.org/wl/"&gt;Wanderlust&lt;/a&gt;, and it's a fine piece of Japanese engineering. It
can be a little bit intimidating to set up at first, even though I found it
still much easier than the other emacs-based clients I tried. Anyway, I am
sharing a very basic setup here, enough to get you going.
&lt;/p&gt;
&lt;p&gt;
What about my setup? Well: I use maildirs &amp;ndash; that is, I download my mail into
a local &lt;code&gt;~/Maildir&lt;/code&gt; directory-tree, either with e.g. &lt;code&gt;fetchmail&lt;/code&gt; or with
&lt;code&gt;offlineimap&lt;/code&gt;. It's a particulary nice setup for offline-usage: whenever
there's a network connection, I suck up all the mails and have them available
offline. I work like this since the days when there was only expensive dial-up
access to the net, and later I found it very convenient when I was traveling
with a laptop and had only occasional net-access.
&lt;/p&gt;
&lt;p&gt;
So, &lt;code&gt;Maildir&lt;/code&gt; access is pretty important for me, and I'll describe my setup
for using Wanderlust with it here. If you're using IMAP instead of Maildirs,
you might be interested in the &lt;a href="http://box.matto.nl/emacsgmail.html"&gt;Emacs with Wanderlust and GMail&lt;/a&gt;-article.
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-2" class="outline-2"&gt;
&lt;h2 id="sec-2"&gt;Getting started &lt;/h2&gt;
&lt;div class="outline-text-2" id="text-2"&gt;


&lt;p&gt;
So, how to get started with Wanderlust?
&lt;/p&gt;
&lt;p&gt;
In short: install Wanderlust and put some stuff in two files (&lt;code&gt;~/.wl&lt;/code&gt; and
&lt;code&gt;~/.folders&lt;/code&gt;).
&lt;/p&gt;
&lt;p&gt;
A little bit longer:
&lt;/p&gt;&lt;ul&gt;
&lt;li&gt;
&lt;b&gt;get wanderlist&lt;/b&gt; - I am using the &lt;code&gt;wl-beta&lt;/code&gt; packages from Ubuntu/Debian,
which makes this a painless process, but you can also use &lt;a href="http://www.gohome.org/wl/#GET"&gt;source packages&lt;/a&gt;;
&lt;/li&gt;
&lt;li&gt;
put your Wanderlust-configuration in a special file: &lt;code&gt;~/.wl&lt;/code&gt;;
&lt;/li&gt;
&lt;li&gt;
put a list of the mail folders you're interested in, in a file called
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;~/.folders&lt;/code&gt;.  (yes, you can customize all this)
&lt;/p&gt;
&lt;p&gt;
For the rest of the discussion, let's assume we have a Maildir which contains
some folders:
&lt;/p&gt;&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;inbox&lt;/code&gt; for incoming e-mail
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;bulk&lt;/code&gt; for incoming Mailing List mail
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;drafts&lt;/code&gt; for drafts
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;sent&lt;/code&gt; for sent e-mail
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;trash&lt;/code&gt; for junk email

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

&lt;p&gt;All incoming mail is going to either &lt;code&gt;inbox&lt;/code&gt; or &lt;code&gt;bulk&lt;/code&gt;. I'm not going to
discuss how to get the mails there &amp;ndash; I assume you're already have these thing
set up; otherwise, you can take a look at tools like &lt;code&gt;fetchmail&lt;/code&gt;, &lt;code&gt;retchmail&lt;/code&gt;,
&lt;code&gt;procmail&lt;/code&gt; and friends. Note that much of the discussion here applies as well
if you're using Wanderlust with POP or IMAP.
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-3" class="outline-2"&gt;
&lt;h2 id="sec-3"&gt;What to put in &lt;code&gt;~/.wl&lt;/code&gt;? &lt;/h2&gt;
&lt;div class="outline-text-2" id="text-3"&gt;

&lt;p&gt;So, how to setup Wanderlust to use this? Well, our configuration goes into a
file called &lt;code&gt;~/.wl&lt;/code&gt;.  There's a million more things you can set up here , but
let's stick to the basics here. I'll discuss more tricks and extensions later.
&lt;/p&gt;



&lt;pre class="src src-emacs-list"&gt;;; mode:-*-emacs-lisp-*-
;; wanderlust 
(setq 
  elmo-maildir-folder-path &lt;span class="org-string"&gt;"~/Maildir"&lt;/span&gt;          ;; where i store my mail

  wl-stay-folder-window t                       ;; show the folder pane (left)
  wl-folder-window-width 25                     ;; toggle on/off with 'i'
  
  wl-smtp-posting-server &lt;span class="org-string"&gt;"localhost"&lt;/span&gt;            ;; put the smtp server here
  wl-local-domain &lt;span class="org-string"&gt;"myhost.example.com"&lt;/span&gt;          ;; put something here...
  wl-message-id-domain &lt;span class="org-string"&gt;"myhost.example.com"&lt;/span&gt;     ;; ...

  wl-from &lt;span class="org-string"&gt;"Me &amp;lt;&lt;a href="mailto:me&amp;#64;example.com"&gt;me&amp;#64;example.com&lt;/a&gt;&amp;gt;"&lt;/span&gt;                  ;; my From:

  ;; note: all below are dirs (Maildirs) under elmo-maildir-folder-path 
  ;; the '.'-prefix is for marking them as maildirs
  wl-fcc &lt;span class="org-string"&gt;".sent"&lt;/span&gt;                       ;; sent msgs go to the &lt;span class="org-string"&gt;"sent"&lt;/span&gt;-folder
  wl-fcc-force-as-read t               ;; mark sent messages as read 
  wl-default-folder &lt;span class="org-string"&gt;".inbox"&lt;/span&gt;           ;; my main inbox 
  wl-draft-folder &lt;span class="org-string"&gt;".drafts"&lt;/span&gt;            ;; store drafts in 'postponed'
  wl-trash-folder &lt;span class="org-string"&gt;".trash"&lt;/span&gt;             ;; put trash in 'trash'
  wl-spam-folder &lt;span class="org-string"&gt;".trash"&lt;/span&gt;              ;; ...spam as well
  wl-queue-folder &lt;span class="org-string"&gt;".queue"&lt;/span&gt;             ;; we don't use this

  ;; check this folder periodically, and update modeline
  wl-biff-check-folder-list '(&lt;span class="org-string"&gt;".todo"&lt;/span&gt;) ;; check every 180 seconds
                                       ;; (default: wl-biff-check-interval)

  ;; hide many fields from message buffers
  wl-message-ignored-field-list '(&lt;span class="org-string"&gt;"^.*:"&lt;/span&gt;)
  wl-message-visible-field-list
  '(&lt;span class="org-string"&gt;"^\\(To\\|Cc\\):"&lt;/span&gt;
    &lt;span class="org-string"&gt;"^Subject:"&lt;/span&gt;
    &lt;span class="org-string"&gt;"^\\(From\\|Reply-To\\):"&lt;/span&gt;
    &lt;span class="org-string"&gt;"^Organization:"&lt;/span&gt;
    &lt;span class="org-string"&gt;"^Message-Id:"&lt;/span&gt;
    &lt;span class="org-string"&gt;"^\\(Posted\\|Date\\):"&lt;/span&gt;
    )
  wl-message-sort-field-list
  '(&lt;span class="org-string"&gt;"^From"&lt;/span&gt;
    &lt;span class="org-string"&gt;"^Organization:"&lt;/span&gt;
    &lt;span class="org-string"&gt;"^X-Attribution:"&lt;/span&gt;
     &lt;span class="org-string"&gt;"^Subject"&lt;/span&gt;
     &lt;span class="org-string"&gt;"^Date"&lt;/span&gt;
     &lt;span class="org-string"&gt;"^To"&lt;/span&gt;
     &lt;span class="org-string"&gt;"^Cc"&lt;/span&gt;))
&lt;/pre&gt;



&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-4" class="outline-2"&gt;
&lt;h2 id="sec-4"&gt;What to put in &lt;code&gt;~/.folders&lt;/code&gt;? &lt;/h2&gt;
&lt;div class="outline-text-2" id="text-4"&gt;

&lt;p&gt;So, that was the basic setup. Now we need to tell wanderlust about the folders
we'd like to see in the user-interface: &lt;code&gt;~/.folders&lt;/code&gt;.  Wanderlust &lt;i&gt;does not&lt;/i&gt;
automatically use all the folder in your &lt;code&gt;~/Maildir&lt;/code&gt;. The folder names in
&lt;code&gt;~/.folders&lt;/code&gt; can refer to maildirs, newsgroups, POP-account, IMAP-folders and
a couple of other ones. In particular, you can &lt;i&gt;combine&lt;/i&gt; folders to show as
aggregate folders in Wanderlust.
&lt;/p&gt;
&lt;p&gt;
Wanderlust distinguishes the kind of folder something is by looking at a
special prefix character. For maildirs, this is a dot ('&lt;code&gt;.&lt;/code&gt;'), IMAP-folders get
a '&lt;code&gt;+&lt;/code&gt;', newsgroups get a '-' and so on. After the mailbox name, you can have
a 'friendly name' in quotes, which is what will show up in the user-interface.
&lt;/p&gt;
&lt;p&gt;
Something like this:
&lt;/p&gt;


&lt;pre class="src src-text-mode"&gt;# WL folders (put the '#' always at the beginning of the line)
.inbox     &lt;span class="org-string"&gt;"Inbox"&lt;/span&gt;
.bulk      &lt;span class="org-string"&gt;"Mailinglists"&lt;/span&gt;
.drafts    &lt;span class="org-string"&gt;"Drafts"&lt;/span&gt;
.sent      &lt;span class="org-string"&gt;"Sent Mail"&lt;/span&gt;
.trash     &lt;span class="org-string"&gt;"Junk"&lt;/span&gt;
&lt;/pre&gt;



&lt;p&gt;
Note, the little format has some more tricks; e.g., if you had some folders,
you cold have something like:
&lt;/p&gt;



&lt;pre class="src src-text-mode"&gt;# WL folders (put the '#' always at the beginning of the line)

# 'Lists' will be a tree node with three elements
Lists {
        .mailinglist1 &lt;span class="org-string"&gt;"A mailinglist"&lt;/span&gt;
        .mailinglist2 &lt;span class="org-string"&gt;"Another Mailinglist"&lt;/span&gt; 
        .mailinglist3 &lt;span class="org-string"&gt;"Yet one more mailinglist"&lt;/span&gt;
}

# you make virtual folders from combined lists with the '*'
AllMyMailingLists  *.mailinglist1,.mailinglist2,.mailinglist3
&lt;/pre&gt;


&lt;p&gt;
Anyway, there's plenty of room for experimentation here&amp;hellip;
&lt;/p&gt;
&lt;p&gt;
Now, we're ready! Start Wanderlust with &lt;code&gt;M-x wl&lt;/code&gt;. You will be greeted, and
things are relatively easy from there on. You might want to use the menu at
first at least, as the default keybindings are somewhat surprising (like &lt;code&gt;a&lt;/code&gt; for
reply, and &lt;code&gt;w&lt;/code&gt; to compose a new message).
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-5" class="outline-2"&gt;
&lt;h2 id="sec-5"&gt;What's next? &lt;/h2&gt;
&lt;div class="outline-text-2" id="text-5"&gt;

&lt;p&gt;As I said, there are 10E6 things to configure and to customize, but this
should give you a reasonable setup to start with; you might want to change
some details (like the folder names) to match your situation. Good luck!
&lt;/p&gt;
&lt;p&gt;
As a true emacs-mailer, Wanderlust nicely integrates with e.g. &lt;code&gt;BBDB&lt;/code&gt; (the
addressbook) and &lt;code&gt;org-mode&lt;/code&gt;. You can also use GPG (through &lt;code&gt;mailcrypt&lt;/code&gt;),
spamfiltering, and so on. I will discuss some of those things in the second
part of the discussion of Wanderlust.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-3100804549251888041?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/3100804549251888041/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=3100804549251888041' title='35 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/3100804549251888041'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/3100804549251888041'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2009/06/e-mail-with-wanderlust.html' title='e-mail with wanderlust'/><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/_kGFGcbwevHE/Si1ajctajoI/AAAAAAAAAaw/VnA_PZBsIOk/s72-c/Screenshot-emacs%40mindcrime.png' height='72' width='72'/><thr:total>35</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-3284059968335181844</id><published>2009-06-02T21:54:00.009+03:00</published><updated>2009-06-03T09:56:14.118+03:00</updated><title type='text'>tetris</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_kGFGcbwevHE/SiV27L5_jdI/AAAAAAAAAag/gPxXszhLa_E/s1600-h/Screenshot-1.png"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 224px;" src="http://3.bp.blogspot.com/_kGFGcbwevHE/SiV27L5_jdI/AAAAAAAAAag/gPxXszhLa_E/s400/Screenshot-1.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5342807292125351378" /&gt;&lt;/a&gt;
&lt;p&gt;
The game of &lt;a href="http://en.wikipedia.org/wiki/Tetris"&gt;Tetris&lt;/a&gt; has turned &lt;strike&gt;25&lt;/strike&gt; 24. I don't care very much about computer games,
but I've nevertheless spent quite a bit of time playing Tetris - its
brilliance is in its simplicity.
&lt;/p&gt;
&lt;p&gt;
Obviously, &lt;code&gt;emacs&lt;/code&gt; comes with a Tetris-clone; just type &lt;code&gt;M-x tetris RET&lt;/code&gt; and
there you go! There is very little useful things to customize about the game,
except maybe you'd like to keep your &lt;code&gt;~/&lt;/code&gt; clean and set:

&lt;/p&gt;


&lt;pre class="src src-emacs-lisp"&gt;
(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; tetris-score-file 
  &lt;span class="org-string"&gt;"~/.emacs.d/tetris-scores"&lt;/span&gt;)
&lt;/pre&gt;

&lt;p&gt;
I'd also like to point to the lisp source code, which is only 658 lines long -
almost &lt;a href="http://codegolf.com/"&gt;CodeGolf&lt;/a&gt;-worthy. It's an interesting read if you are that kind of person. To see the source code, access the help for &lt;code&gt;M-x tetris&lt;/code&gt;, i.e., press &lt;code&gt;C-h f tetris&lt;/code&gt; and &lt;code&gt;Enter&lt;/code&gt; (as discussed in &lt;a href="http://emacs-fu.blogspot.com/2009/02/helpful-emacs.html"&gt;Helpful Emacs&lt;/a&gt;). You'll get a help buffer then, which includes a link to &lt;code&gt;tetris.el&lt;/code&gt;,
the source code; obviously, you need to have the sources installed. In
Ubuntu/Debian, you can install the source code through the &lt;code&gt;emacs22-el&lt;/code&gt; or

&lt;code&gt;emacs-snapshot-el&lt;/code&gt; packages, depending on the version of emacs you're using.
&lt;/p&gt;
&lt;p&gt;
Thanks to emacs, you can actually read the source code in one buffer, while
playing tetris in the other one!
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-3284059968335181844?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/3284059968335181844/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=3284059968335181844' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/3284059968335181844'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/3284059968335181844'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2009/06/tetris.html' title='tetris'/><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/_kGFGcbwevHE/SiV27L5_jdI/AAAAAAAAAag/gPxXszhLa_E/s72-c/Screenshot-1.png' height='72' width='72'/><thr:total>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-7736417748880459472</id><published>2009-05-30T22:01:00.004+03:00</published><updated>2009-06-01T17:08:53.865+03:00</updated><title type='text'>finding commands with smex</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_kGFGcbwevHE/SiGFtn8e3iI/AAAAAAAAAaI/nJ68Ytz0ijk/s1600-h/Screenshot-emacs%40mindcrime.png"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 320px; height: 83px;" src="http://4.bp.blogspot.com/_kGFGcbwevHE/SiGFtn8e3iI/AAAAAAAAAaI/nJ68Ytz0ijk/s320/Screenshot-emacs%40mindcrime.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5341697651901390370" /&gt;&lt;/a&gt;
&lt;p&gt;
If you're like me, you'll usually have a lot of buffers open in &lt;code&gt;emacs&lt;/code&gt;. To
quickly switch between them, you press &lt;code&gt;C-x b&lt;/code&gt; (&lt;code&gt;Ctrl-X&lt;/code&gt; and &lt;code&gt;b&lt;/code&gt;), and type
the beginning of buffer name. This is made much more convenient with
e.g. &lt;code&gt;ido&lt;/code&gt; (see &lt;a href="http://emacs-fu.blogspot.com/2009/02/switching-buffers.html"&gt;Switching Buffers&lt;/a&gt;) or &lt;code&gt;icicles&lt;/code&gt;. They allow you switch to a
buffer by typing just some characters appearing anywhere in the buffer name,
autocompletion etc.

&lt;/p&gt;
&lt;p&gt;
The question for today is: what to do if am not searching for a buffer or
file, but for some emacs command?
&lt;/p&gt;
&lt;p&gt;
Often, I search for a certain command, ie. the ones that come after
&lt;code&gt;M-x&lt;/code&gt;. After typing &lt;code&gt;M-x&lt;/code&gt; there's autocompletion if you know the &lt;i&gt;beginning&lt;/i&gt;
of the command&amp;hellip; but maybe I remember only it was something with &lt;code&gt;string&lt;/code&gt;,
but exactly how? Was it &lt;code&gt;replace-string&lt;/code&gt; or &lt;code&gt;string-replace&lt;/code&gt;?

&lt;/p&gt;
&lt;p&gt;
For these deep problems, there is &lt;a href="http://github.com/nonsequitur/smex/tree/master"&gt;smex&lt;/a&gt; (think: &lt;i&gt;search-M-x&lt;/i&gt;). &lt;code&gt;smex&lt;/code&gt; brings
&lt;code&gt;ido&lt;/code&gt;-style completion to choosing commands.
&lt;/p&gt;
&lt;p&gt;
After &lt;a href="http://emacs-fu.blogspot.com/2008/12/installing-packages.html"&gt;installing&lt;/a&gt; the smex package, you can put something like the following 

&lt;a href="http://emacs-fu.blogspot.com/2008/12/emacs.html"&gt;in your .emacs&lt;/a&gt;:
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;
(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; smex-save-file &lt;span class="org-string"&gt;"~/.emacs.d/smex.save"&lt;/span&gt;) &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;keep my ~/ clean                &lt;/span&gt;&lt;span class="org-comment"&gt;&lt;span class="org-warning"&gt;                      &lt;/span&gt;&lt;/span&gt;&lt;span class="org-comment"&gt;
&lt;/span&gt;(&lt;span class="org-keyword"&gt;require&lt;/span&gt; '&lt;span class="org-constant"&gt;smex&lt;/span&gt;)                                                  
(smex-initialize)                                                               
(global-set-key (kbd &lt;span class="org-string"&gt;"M-X"&lt;/span&gt;) 'smex)                                             
&lt;/pre&gt;




&lt;p&gt;
As you can see, I have set the keybinding to &lt;code&gt;M-X&lt;/code&gt;, that is (for most people)

&lt;code&gt;Alt-Shift-x&lt;/code&gt;; of course you could override the normal &lt;code&gt;M-x&lt;/code&gt;
('&lt;code&gt;execute-extended-command&lt;/code&gt;', note the small &lt;code&gt;x&lt;/code&gt;), but &lt;i&gt;usually&lt;/i&gt; the normal
completion is fine.
&lt;/p&gt;
&lt;p&gt;
Admittedly, &lt;code&gt;smex&lt;/code&gt; serves a &lt;i&gt;niche&lt;/i&gt; use-case, but I still use it a couple of
times a day.

&lt;/p&gt;
&lt;p&gt;
[ Note that packages like &lt;code&gt;icicles&lt;/code&gt; and &lt;code&gt;anything&lt;/code&gt; can do similar things; they
do &lt;i&gt;much more&lt;/i&gt; as well, and I haven't had the chance to play with those in
detail, so for the time being I stay with &lt;code&gt;smex&lt;/code&gt;. ]
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-7736417748880459472?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/7736417748880459472/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=7736417748880459472' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/7736417748880459472'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/7736417748880459472'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2009/05/finding-commands-with-smex.html' title='finding commands with smex'/><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://4.bp.blogspot.com/_kGFGcbwevHE/SiGFtn8e3iI/AAAAAAAAAaI/nJ68Ytz0ijk/s72-c/Screenshot-emacs%40mindcrime.png' height='72' width='72'/><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-2252231966376468328</id><published>2009-05-26T22:33:00.006+03:00</published><updated>2009-06-19T14:43:57.039+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='updated'/><title type='text'>tracking changes</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_kGFGcbwevHE/ShxETeHnq0I/AAAAAAAAAaA/vEVR-vyHusc/s1600-h/Screenshot-emacs%40mindcrime.png"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 320px; height: 210px;" src="http://3.bp.blogspot.com/_kGFGcbwevHE/ShxETeHnq0I/AAAAAAAAAaA/vEVR-vyHusc/s320/Screenshot-emacs%40mindcrime.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5340218359447792450" /&gt;&lt;/a&gt;
&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;div id="text-1"&gt;
&lt;p&gt;
It's sometimes nice to see the changes you've made to a file. If the file is
under version control, you can use the '&lt;code&gt;diff&lt;/code&gt;'-features of the version
control system of course; or you can use &lt;code&gt;diff-buffer-with-file&lt;/code&gt; to compare
your buffer with the version on disk. That obviously only. works when you
&lt;i&gt;haven't&lt;/i&gt; saved the file yet.

&lt;/p&gt;
&lt;p&gt;
Anyway, a bit easier, straighforward way may be to use
&lt;code&gt;highlight-changes-mode&lt;/code&gt;. With that mode, emacs can give a special color to
parts of the text that you have changed.
&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;higlight changes in documents
&lt;/span&gt;(global-highlight-changes-mode t)
(&lt;span class="org-keyword"&gt;setq&lt;/span&gt; highlight-changes-visibility-initial-state nil)&lt;span class="org-comment-delimiter"&gt;; &lt;/span&gt;&lt;span class="org-comment"&gt;initially hide

&lt;/span&gt;&lt;/pre&gt;




&lt;p&gt;
The last line tells me that the changes should &lt;b&gt;not&lt;/b&gt; be visible unless I want
to see them. 
&lt;/p&gt;
&lt;p&gt;
I defined a key binding (&lt;code&gt;F6&lt;/code&gt;) so I can easily toggle between
visible/invisible changes:
&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;toggle visibility
&lt;/span&gt;(global-set-key (kbd &lt;span class="org-string"&gt;"&amp;lt;f6&amp;gt;"&lt;/span&gt;)      'highlight-changes-visible-mode) &lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;changes
&lt;/span&gt;&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;remove the change-highlight in region
&lt;/span&gt;(global-set-key (kbd &lt;span class="org-string"&gt;"S-&amp;lt;f6&amp;gt;"&lt;/span&gt;)    'highlight-changes-remove-highlight)

&lt;/pre&gt;




&lt;p&gt;
With this last keybinding &lt;code&gt;S-&amp;lt;f6&amp;gt;&lt;/code&gt; (Shift-F6), I can remove the
change-indication of the current region (selection). Here are some other
useful keybindings to quickly jump between various changes:
&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;alt-pgup/pgdown jump to the previous/next change

&lt;/span&gt;&lt;span class="org-comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="org-comment"&gt;if you're not already using it for something else...
&lt;/span&gt;(global-set-key (kbd &lt;span class="org-string"&gt;"&amp;lt;M-prior&amp;gt;"&lt;/span&gt;) 'highlight-changes-next-change)
(global-set-key (kbd &lt;span class="org-string"&gt;"&amp;lt;M-next&amp;gt;"&lt;/span&gt;)  'highlight-changes-previous-change)
&lt;/pre&gt;




&lt;p&gt;

Another interesting thing you can do is &lt;code&gt;M-x highlight-compare-with-file&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
The only remaining problem with &lt;code&gt;highlight-changes-mode&lt;/code&gt; is that the default
colors are, well, hideous. But of course, that can easily be fixed by changing
the &lt;i&gt;faces&lt;/i&gt;:
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;
(set-face-foreground 'highlight-changes nil)
(set-face-background 'highlight-changes &lt;span class="org-string"&gt;"#382f2f"&lt;/span&gt;)
(set-face-foreground 'highlight-changes-delete nil)
(set-face-background 'highlight-changes-delete &lt;span class="org-string"&gt;"#916868"&lt;/span&gt;)

&lt;/pre&gt;




&lt;p&gt;
Or adding to your color-scheme:
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;
(highlight-changes ((t (&lt;span class="org-builtin"&gt;:foreground&lt;/span&gt; nil &lt;span class="org-builtin"&gt;:background&lt;/span&gt; &lt;span class="org-string"&gt;"#382f2f"&lt;/span&gt;))))
(highlight-changes-delete ((t (&lt;span class="org-builtin"&gt;:foreground&lt;/span&gt; nil &lt;span class="org-builtin"&gt;:background&lt;/span&gt; &lt;span class="org-string"&gt;"#916868"&lt;/span&gt;)))) 

&lt;/pre&gt;




&lt;p&gt;
Now, with these color changes, the foreground stays the same, only the
background changes a bit. I am using a dark theme, you might want to change
the colors to fit in with your theme.
&lt;/p&gt;
&lt;p&gt;
There are some more features - for example, to rotate through changes of
different age. For such things I prefer to use a version control system, but
you might want to check it out.
&lt;/p&gt;
&lt;p&gt;
Tracking changes can be quite useful. And, unlike some word-processing
software, emacs does not hide your highly embarrassing modifications somewhere
in your document&amp;hellip;
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-2252231966376468328?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/2252231966376468328/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=2252231966376468328' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/2252231966376468328'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/2252231966376468328'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2009/05/tracking-changes.html' title='tracking changes'/><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/_kGFGcbwevHE/ShxETeHnq0I/AAAAAAAAAaA/vEVR-vyHusc/s72-c/Screenshot-emacs%40mindcrime.png' height='72' width='72'/><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-2177499631248590396</id><published>2009-05-21T15:25:00.008+03:00</published><updated>2010-04-28T21:55:51.693+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='org-mode'/><title type='text'>writing and blogging with org-mode</title><content type='html'>&lt;p&gt;Already in some &lt;a href="http://emacs-fu.blogspot.com/2009/03/in-praise-of-org-mode.html"&gt;previous entry&lt;/a&gt; I sang the praises about &lt;a href="http://org-mode.org"&gt;org-mode&lt;/a&gt;, the
emacs-mode that is such a nice, flexible way to organize your life. There is
&lt;i&gt;so much&lt;/i&gt; in &lt;code&gt;org-mode&lt;/code&gt; that it's quite hard to fit in here, but thankfully
org-mode is documented very well; there's not only the &lt;a href="http://orgmode.org/manual/index.html"&gt;reference manual&lt;/a&gt;, there
is also a lot of user-provided documentation about how they use &lt;code&gt;org-mode&lt;/code&gt;. A
nice recent example of that is &lt;i&gt;Bernt Hansen&lt;/i&gt;'s &lt;a href="http://doc.norang.ca/org-mode.html"&gt;Org Mode - Organize Your Life In Plain Text!&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
I use &lt;code&gt;org-mode&lt;/code&gt; for time-management too - I'm using it in a rather simple
fashion compared to Bernt Hansen, but find it very useful. I &lt;i&gt;also&lt;/i&gt; use
&lt;code&gt;org-mode&lt;/code&gt; for writing webpages and blogs (like this one), and that is what
I'd like to discuss here.
&lt;/p&gt;
&lt;p&gt;
Actually the first time I heard about this &lt;code&gt;org-mode&lt;/code&gt;-thing people were raving
about, it was for taking notes. Curious as I am, the next time I needed to
take notes, I uttered &lt;code&gt;M-x org-mode&lt;/code&gt; to try it out, and found how easy and
natural it is to write structured, semi-rich-text with &lt;code&gt;org-mode&lt;/code&gt;. Some
examples:
&lt;/p&gt;

&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;h2 id="sec-1"&gt;Markup &lt;/h2&gt;
&lt;div class="outline-text-2" id="text-1"&gt;

&lt;p&gt;I can write headings by starting lines with some stars, the number of stars
determining the heading level:
&lt;/p&gt;


&lt;pre class="src src-org"&gt;&lt;span class="org-org-level-1"&gt;* level 1 heading&lt;/span&gt;
  some text
&lt;span class="org-org-hide"&gt;*&lt;/span&gt;&lt;span class="org-org-level-2"&gt;* level 2 heading&lt;/span&gt;
   some more text
&lt;span class="org-org-hide"&gt;**&lt;/span&gt;&lt;span class="org-org-level-3"&gt;* level 3 heading&lt;/span&gt;
    even more
&lt;/pre&gt;


&lt;p&gt;
&lt;code&gt;org-mode&lt;/code&gt; helpfully gives them some different colors; by pressing &lt;code&gt;TAB&lt;/code&gt; when
I am on a heading, I can hide/show the lower levels and the contents. Nice!
&lt;/p&gt;
&lt;p&gt;
It's also easy to get all the basic markup by decorating your words a bit:
&lt;/p&gt;


&lt;pre class="src src-text"&gt;This is *bold* /italics/ _underline_ [[http:/emacs-fu.blogspot.com][Emacs-Fu]]
&lt;/pre&gt;


&lt;p&gt;
In &lt;code&gt;org-mode&lt;/code&gt; it looks like:
&lt;/p&gt;


&lt;pre class="src src-org"&gt;This is &lt;span class="org-bold"&gt;*bold*&lt;/span&gt; &lt;span class="org-italic"&gt;/italics/&lt;/span&gt; &lt;span class="org-underline"&gt;_underline_&lt;/span&gt; &lt;span class="org-org-link"&gt;Emacs-Fu&lt;/span&gt;
&lt;/pre&gt;



&lt;p&gt;
There are many more things; for example, there's &lt;a href="http://www.gnu.org/software/emacs/manual/html_node/org/Built_002din-table-editor.html"&gt;the table editor&lt;/a&gt;; I simply type
&lt;code&gt;|country|capital|&amp;lt;Enter&amp;gt;|-&amp;lt;Tab&amp;gt;&lt;/code&gt;
and I get:
&lt;/p&gt;


&lt;pre class="src src-org"&gt;&lt;span class="org-org-table"&gt;| country | capital |&lt;/span&gt;
&lt;span class="org-org-table"&gt;|---------+---------|&lt;/span&gt;
&lt;span class="org-org-table"&gt;|         |         |&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;
Now, I fill in the names in the colums, ending each line with &lt;code&gt;&amp;lt;Alt&amp;gt;&amp;lt;Enter&amp;gt;&lt;/code&gt;
(or &lt;code&gt;M-RET&lt;/code&gt;), and &lt;code&gt;org-mode&lt;/code&gt; takes care of making everything fit, so we get:
&lt;/p&gt;


&lt;pre class="src src-org"&gt;&lt;span class="org-org-table"&gt;| country     | capital   |&lt;/span&gt;
&lt;span class="org-org-table"&gt;|-------------+-----------|&lt;/span&gt;
&lt;span class="org-org-table"&gt;| finland     | helsinki  |&lt;/span&gt;
&lt;span class="org-org-table"&gt;| netherlands | amsterdam |&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;
You can even insert formulae in the cells, turning this into a simple kind of
&lt;a href="http://orgmode.org/manual/The-spreadsheet.html"&gt;spreadsheet&lt;/a&gt;. Haven't used that yet though.
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-2" class="outline-2"&gt;
&lt;h2 id="sec-2"&gt;Blogging &lt;/h2&gt;
&lt;div class="outline-text-2" id="text-2"&gt;

&lt;p&gt;Now, one of the things I use &lt;code&gt;org-mode&lt;/code&gt; for is &lt;i&gt;blogging&lt;/i&gt;; for that, I need to
convert the &lt;code&gt;org&lt;/code&gt;-text into HTML; this is simple &lt;code&gt;org-export-as-html&lt;/code&gt; (or &lt;code&gt;C-c C-e&lt;/code&gt;). I can then copy the HTML into &lt;code&gt;blogger.com&lt;/code&gt; or whatever (that might be
automatable). You can also export to plain-text, LaTex and other formats.
&lt;/p&gt;
&lt;p&gt;
I found that it makes me a much more productive blogger if can use &lt;code&gt;org-mode&lt;/code&gt;;
it's so much more convenient to write the mark-up than to write raw HTML. Now,
sometimes I might want still want to write some raw HTML, but that can be
easily done:
&lt;/p&gt;



&lt;pre class="src src-org"&gt;&lt;span class="org-org-meta-line"&gt;#+BEGIN_HTML
&lt;/span&gt;&lt;span class="org-org-block"&gt;   &amp;lt;button onclick="alert('you are!');"&amp;gt;I feel lucky!&amp;lt;/button&amp;gt; &lt;/span&gt;&lt;span class="org-org-meta-line"&gt;
#+END_HTML&lt;/span&gt;
&lt;/pre&gt;



&lt;p&gt;
in the export HTML this will become:
   &lt;button onclick="alert('you are!');"&gt;I feel lucky!&lt;/button&gt; 
How cool is that?!
&lt;/p&gt;
&lt;p&gt;
However, I only found out about the nicest trick very recently from the
&lt;code&gt;org&lt;/code&gt;-mailing list.
&lt;/p&gt;
&lt;p&gt;
In this blog, I often use blurbs of code; I'd like to show those blurbs with
the syntax-highlighting that emacs gives me. For that, I use the
&lt;code&gt;htmlize&lt;/code&gt;-package. For example, when showing some Emacs-Lisp code, I would
copy that to an Emacs-Lisp buffer, then run &lt;code&gt;htmlize-region&lt;/code&gt; on the code, and
finally copy the result back in a raw-html block (like the one for the &amp;lt;button&amp;gt;).
&lt;/p&gt;
&lt;p&gt;
I wondered - could I not do that automatically? I could mark code in
&lt;code&gt;org-mode&lt;/code&gt; as being 'Emacs-Lisp'-code (or Perl, or Python, or &amp;hellip;), and when
I'd export the html, &lt;code&gt;org-mode&lt;/code&gt; would go through the trouble of calling
&lt;code&gt;htmlize-region&lt;/code&gt; on it and use that in its output. Sounded like a nice idea, I
asked for some advise on how to do it.
&lt;/p&gt;
&lt;p&gt;
Five minutes after asking, I got a reply &amp;ndash; 'just use
&lt;code&gt;#+BEGIN_SRC/#+END_SRC&lt;/code&gt;'. Wow &amp;ndash; it was &lt;i&gt;already there&lt;/i&gt; in &lt;code&gt;org-mode&lt;/code&gt;, it's
even &lt;a href="http://orgmode.org/manual/Literal-examples.html#index-literal-examples_002c-markup-rules-870"&gt;documented&lt;/a&gt;, but somehow I missed that. So, now I can write:
&lt;/p&gt;



&lt;pre class="example"&gt;#+BEGIN_SRC perl
   for (my $i = 0; $i != 10; ++i) {
        print "hello, world!\n";
   }
#+END_SRC
&lt;/pre&gt;




&lt;pre class="example"&gt;#+BEGIN_SRC c++
  for (int i = 0; i != 10; ++i)
        std::cout &amp;lt;&amp;lt; "hello, world!" &amp;lt;&amp;lt; std::endl;
#+END_SRC
&lt;/pre&gt;



&lt;p&gt;
and in the export HTML, this will look like:
&lt;/p&gt;



&lt;pre class="src src-perl"&gt;&lt;span class="org-keyword"&gt;for&lt;/span&gt; (&lt;span class="org-keyword"&gt;my&lt;/span&gt; &lt;span class="org-variable-name"&gt;$i&lt;/span&gt; = 0; $i &lt;span class="org-negation-char"&gt;!&lt;/span&gt;= 10; ++i) {
      &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;pre class="src src-c++"&gt;&lt;span class="org-keyword"&gt;for&lt;/span&gt; (&lt;span class="org-type"&gt;int&lt;/span&gt; &lt;span class="org-variable-name"&gt;i&lt;/span&gt; = 0; i != 10; ++i)
      &lt;span class="org-constant"&gt;std&lt;/span&gt;::cout &amp;lt;&amp;lt; &lt;span class="org-string"&gt;"hello, world!"&lt;/span&gt; &amp;lt;&amp;lt; &lt;span class="org-constant"&gt;std&lt;/span&gt;::endl;
&lt;/pre&gt;



&lt;p&gt;
I am impressed.
&lt;/p&gt;
&lt;p&gt;
These were just some of the things I've discovered in the last few months of
using &lt;code&gt;org-mode&lt;/code&gt;, and I am only scratching the surface. Feel free to share
your &lt;code&gt;org-mode&lt;/code&gt;-writing tips in the comments :-)
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-2177499631248590396?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/2177499631248590396/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=2177499631248590396' title='21 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/2177499631248590396'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/2177499631248590396'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2009/05/writing-and-blogging-with-org-mode.html' title='writing and blogging with 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>21</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-2219316182558807040</id><published>2009-05-18T22:10:00.005+03:00</published><updated>2009-05-19T08:24:37.775+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>building regular expressions</title><content type='html'>&lt;div id="text-1"&gt;


&lt;p&gt;
This whole entry could be summarized as 'use &lt;code&gt;M-x re-builder&lt;/code&gt;' to build your
regular expressions. But let's see if I can stretch that wisdom over a couple
of lines&amp;hellip;
&lt;/p&gt;
&lt;p&gt;
For searching and replacing, regular expressions ('regexps') are a very useful
tool. For example, see the entry about &lt;a href="http://emacs-fu.blogspot.com/2009/05/getting-your-ip-address.html"&gt;getting your ip-number&lt;/a&gt;. I am &lt;b&gt;not&lt;/b&gt;

going to explain regexps here &amp;ndash; there are plenty of good &lt;a href="http://www.gnu.org/software/emacs/manual/html_node/elisp/Syntax-of-Regexps.html#Syntax-of-Regexps"&gt;references&lt;/a&gt; about
them. Of course, emacs supports regexps - but it's not always so easy,
compaired to e.g. &lt;a href="http://en.wikipedia.org/wiki/Perl"&gt;Perl&lt;/a&gt;. I am only providing some trivial examples here, please
see &lt;a href="http://steve-yegge.blogspot.com/2006/06/shiny-and-new-emacs-22.html"&gt;Steve Yegge's post&lt;/a&gt; on the regexp tricks possible with then-new Emacs 22 (I
can't remember ever needing that kind of regexp-pr0n in real life though&amp;hellip;)
&lt;/p&gt;

&lt;/div&gt;



&lt;div id="text-1.1"&gt;

&lt;p&gt;Back to regexps - on of the issues with regexps in Elisp is that they need
extra quoting, that is, lots of &lt;code&gt;\&lt;/code&gt;-escape characters; regexps can be hard to
comprehend, and this does not help&amp;hellip; Why the extra quoting? Let's look at a
simple example. Suppose we want to search for the word &lt;code&gt;cat&lt;/code&gt;. And not
&lt;code&gt;category&lt;/code&gt; or &lt;code&gt;concatenate&lt;/code&gt;. The regular expression would then be &lt;code&gt;\bcat\b&lt;/code&gt;.

&lt;/p&gt;
&lt;p&gt;
In Perl you could write this as &lt;code&gt;/\bcat\b\/&lt;/code&gt; (in Perl you specify regexps by
putting them between &lt;code&gt;/&lt;/code&gt;-characters).
&lt;/p&gt;
&lt;p&gt;
Not so in Emacs-Lisp. On the Lisp-level, there are no regexps; there are only
strings and only the regexp functions understand their true nature. But
&lt;i&gt;before&lt;/i&gt; the strings ever get those functions, the Lisp interpreter does what
it does best: &lt;b&gt;interpreting&lt;/b&gt;. And when it sees &lt;code&gt;\b&lt;/code&gt;, it interprets it as the

&lt;code&gt;backspace&lt;/code&gt;-character.
&lt;/p&gt;
&lt;p&gt;
To make it &lt;i&gt;not&lt;/i&gt; do that, you'll need to pay the 'slash-tax' and write
something like:
&lt;pre&gt;(re-search-forward "\\bcat\\b")&lt;/pre&gt;

Things can go ugly quickly from there - think of when you need search for
something with a backslash, like our regex &lt;code&gt;\bcat\b&lt;/code&gt; itself; you'd need to do:
&lt;pre&gt;(re-search-forward "\\\\bcat\\\\b")&lt;/pre&gt;

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

&lt;div id="outline-container-1.2" class="outline-3"&gt;
&lt;h3 id="sec-1.2"&gt;slash tax break &lt;/h3&gt;
&lt;div id="text-1.2"&gt;

&lt;p&gt;To make things even more interesting, in different contexts, different rules
apply. The above is all about regexps in strings in Emacs-Lisp. However,
things are different when you provide a string interactively. 
&lt;/p&gt;
&lt;p&gt;
Suppose you search through your buffer (with &lt;code&gt;M-x isearch-forward-regexp&lt;/code&gt; or

&lt;code&gt;C-M-s&lt;/code&gt;). Now, your input is not interpreted by the Lisp interpreter (after
all, it's just user input). So, you're exempt from the slash tax, and you can
use &lt;code&gt;\bcat\b&lt;/code&gt; to match, well, &lt;code&gt;\bcat\b&lt;/code&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;re-builder &lt;/h3&gt;
&lt;div id="text-1.3"&gt;

&lt;p&gt;So, regexps can be hard, and Emacs-Lisp makes it somewhat harder. A natural
way to come up with the regular expression you need, is to use
&lt;i&gt;trial-and-error&lt;/i&gt;, and this is exactly what &lt;code&gt;isearch-forward-regexp&lt;/code&gt; and
friends do. But what about the slash-taxed regexps that you need in your Lisp
code?
&lt;/p&gt;
&lt;p&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_kGFGcbwevHE/ShGzSJvZOyI/AAAAAAAAAZ4/TOwaF_fiClw/s1600-h/Screenshot-emacs%40mindcrime.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 148px;" src="http://1.bp.blogspot.com/_kGFGcbwevHE/ShGzSJvZOyI/AAAAAAAAAZ4/TOwaF_fiClw/s400/Screenshot-emacs%40mindcrime.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5337244157844470562" /&gt;&lt;/a&gt;
The answer is &lt;code&gt;M-x re-builder&lt;/code&gt;. I am sure many people are already using it,      
but even if there were only one person that finds out about this through       
this blog-post, it'd be worth it! And this is the whole trick here: whenever      
you need a regexp in your code, put the kind of string it should match in      
a buffer, and enter &lt;code&gt;M-x re-builder&lt;/code&gt;.                                            
&lt;/p&gt;
&lt;p&gt;
&lt;code&gt;re-builder&lt;/code&gt; will put some quotes in the minibuffer. You type your regexp
there, and it will show the matches in the buffer &lt;b&gt;as you type&lt;/b&gt;. It even supports different
regex-syntaxes. By default, re-builder will help you with the
strings-in-Emacs-lisp kind of regexps; this is called the read-syntax. But you
can switch to the user-input regexps with &lt;code&gt;C-c TAB string RET&lt;/code&gt; (yes, these are
called &lt;code&gt;string&lt;/code&gt; here). There are some other possible syntaxes as well.
&lt;/p&gt;
&lt;p&gt;
One final trick for &lt;code&gt;re-builder&lt;/code&gt; is the &lt;i&gt;subexpression mode&lt;/i&gt;, that you
activate with &lt;code&gt;C-c C-e&lt;/code&gt; (and leave with &lt;code&gt;q&lt;/code&gt;). You can than see what
subexpressions match (ie. if we can match &lt;code&gt;cat&lt;/code&gt;, &lt;code&gt;cut&lt;/code&gt;, &lt;code&gt;cot&lt;/code&gt; etc., with

&lt;code&gt;\\bc\\(.\\)t\\b&lt;/code&gt;, and the subexpression would then contain the middle
letter. &lt;code&gt;re-builder&lt;/code&gt; automatically converts between the syntaxes it supports,
so you could use 'string-mode' as well, &lt;code&gt;bc\(.\)t\b&lt;/code&gt;.
&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-2219316182558807040?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/2219316182558807040/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=2219316182558807040' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/2219316182558807040'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/2219316182558807040'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2009/05/building-regular-expression.html' title='building regular expressions'/><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/_kGFGcbwevHE/ShGzSJvZOyI/AAAAAAAAAZ4/TOwaF_fiClw/s72-c/Screenshot-emacs%40mindcrime.png' height='72' width='72'/><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-4687316892993493480</id><published>2009-05-15T21:03:00.004+03:00</published><updated>2009-05-15T21:06:37.822+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='emacs23'/><title type='text'>using the systems 'trash' when deleting files</title><content type='html'>&lt;p&gt;
A short tip today.
&lt;/p&gt;
&lt;p&gt;
When you delete files and directories in Emacs 23 (say, with &lt;code&gt;dired&lt;/code&gt;), instead
of losing the files until the end of times (or at least until the
singularity), you can move them to the 'trashcan', by whatever name that rose
comes in your system, '&lt;i&gt;Trash&lt;/i&gt;' or '&lt;i&gt;Recycle Bin&lt;/i&gt;'&amp;hellip;

&lt;/p&gt;
&lt;p&gt;
To enable this, put the following in your &lt;code&gt;.emacs&lt;/code&gt;:
&lt;pre&gt;(&lt;span class="keyword"&gt;setq&lt;/span&gt; delete-by-moving-to-trash t)&lt;/pre&gt;

There is one problem - a bug? I am using Ubuntu 9.04, which follows the
&lt;a href="http://www.freedesktop.org/wiki/Specifications/trash-spec"&gt;Freedesktop Trash Spec&lt;/a&gt;; it moves delete file in &lt;code&gt;~/.local/share/Trash&lt;/code&gt;,
together with some metadata, so it can restore the file to their original
location.  However, emacs follows some older convention, ie. to move the file
to &lt;code&gt;~/.Trash&lt;/code&gt;, and without any metadata. 
&lt;/p&gt;
&lt;p&gt;

You can partially fix this by making &lt;code&gt;~/.Trash&lt;/code&gt; a symlink to
&lt;code&gt;~/.local/share/Trash/files/&lt;/code&gt;, but of course that does not get you the
metadata.
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3992530807750384868-4687316892993493480?l=emacs-fu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://emacs-fu.blogspot.com/feeds/4687316892993493480/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3992530807750384868&amp;postID=4687316892993493480' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/4687316892993493480'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3992530807750384868/posts/default/4687316892993493480'/><link rel='alternate' type='text/html' href='http://emacs-fu.blogspot.com/2009/05/using-systems-trash-when-deleting-files.html' title='using the systems &apos;trash&apos; when deleting files'/><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>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3992530807750384868.post-2529863297692447349</id><published>2009-05-12T20:50:00.004+03:00</published><updated>2009-05-12T20:56:21.027+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>getting your ip-address</title><content type='html'>&lt;p&gt;A friend asked me how to retrieve your IP-number in emacs; he needs it to
figure out in which of various networks he lives, to update proxy settings and the like.  He
had found a decade-old function &lt;code&gt;get-ip-address&lt;/code&gt; &lt;a href="http://sachachua.com/notebook/emacs/small-functions.el"&gt;on the internet&lt;/a&gt;, and
thought (correctly!) that it can't be &lt;i&gt;that&lt;/i&gt; hard.&lt;/p&gt;
&lt;p&gt;
So, fortunately, it wasn't too hard to do it a bit better, esp. with all the
improvements in emacs in the last ten years.
&lt;/p&gt;
&lt;p&gt;
The somewhat-ugly-but-it-works solution is to use the output of the &lt;code&gt;ifconfig&lt;/code&gt;
tool:
&lt;pre&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;get-ip-address&lt;/span&gt; (&lt;span class="type"&gt;&amp;amp;optional&lt;/span&gt; dev)
  &lt;span class="doc"&gt;"get the IP-address for device DEV (default: eth0)"&lt;/span&gt;
  (&lt;span class="keyword"&gt;let&lt;/span&gt; ((dev (&lt;span class="keyword"&gt;if&lt;/span&gt; dev dev &lt;span class="string"&gt;"eth0"&lt;/span&gt;))) 
    (substring  &lt;span class="comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="comment"&gt;chop the final "\n"
&lt;/span&gt;      (shell-command-to-string
        (concat 
          &lt;span class="string"&gt;"ifconfig "&lt;/span&gt; dev
          &lt;span class="string"&gt;"|grep 'inet addr'|sed 's/.*inet addr:&lt;/span&gt;&lt;span class="string"&gt;&lt;span class="regexp-grouping-backslash"&gt;\\&lt;/span&gt;&lt;/span&gt;&lt;span class="string"&gt;&lt;span class="regexp-grouping-construct"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span class="string"&gt;&lt;span class="regexp-grouping-backslash"&gt;\\&lt;/span&gt;&lt;/span&gt;&lt;span class="string"&gt;&lt;span class="regexp-grouping-construct"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span class="string"&gt;[0-9\.]&lt;/span&gt;&lt;span class="string"&gt;&lt;span class="regexp-grouping-backslash"&gt;\\&lt;/span&gt;&lt;/span&gt;&lt;span class="string"&gt;&lt;span class="regexp-grouping-construct"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span class="string"&gt;*&lt;/span&gt;&lt;span class="string"&gt;&lt;span class="regexp-grouping-backslash"&gt;\\&lt;/span&gt;&lt;/span&gt;&lt;span class="string"&gt;&lt;span
