<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Chris Ball: Tag zsh</title>
    <link>http://blog.printf.net/articles/tag/zsh</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>Productivity, a year on.</title>
      <description>&lt;p&gt;It's been a &lt;a
href="http://blog.printf.net/articles/2006/03/21/productivity"&gt;year and a half&lt;/a&gt; since I wrote a blog post about
productivity tools &amp;mdash; I mentioned some of the shell and editor tools I use, and it was fun and people gave me useful comments.  Here's another post, with some new lessons learned.&lt;/p&gt;

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

&lt;h1&gt;Emacs&lt;/h1&gt;

&lt;p&gt;&lt;br&gt;&lt;/p&gt;

&lt;h2&gt;python-mode flymake&lt;/h2&gt;

&lt;p&gt;Flymake is mostly the reason I'm writing this blog post.  It does incremental compiling/code checking for emacs &amp;mdash; when you make a source code change, it passes your input to an external program, and then shows (by highlighting lines in different colours) where the external program thinks that warnings or errors are.&lt;/p&gt;

&lt;p&gt;I use it with Python, and pylint:  after a code change, pylint is run on the buffer, and emacs parses the output and shows a display like the following:&lt;/p&gt;

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

&lt;div align="center"&gt;
  &lt;img src="http://chris.printf.net/flymake.png"&gt;
&lt;/div&gt;

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

&lt;p&gt;This seems like a basic thing to do, but it's making me enjoy programming more than I ever have.  My Python code almost always runs correctly first time now, as I wait for the pylint warnings to go away before trying it, and I get cheered up (and, frankly, shocked!) every time I write another fifty lines of code and it works straight away.  I totally recommend it.  The setup's documented on &lt;a href="http://www.emacswiki.org/cgi-bin/wiki/PythonMode#toc8"&gt;emacswiki&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;find-tag-at-point&lt;/h2&gt;

&lt;p&gt;I often work on the kernel or Xorg, and I would be totally ridiculously lost with both if I wasn't using "tags" support in my editor.  Here's how it works:  you run &lt;code&gt;etags&lt;/code&gt; over your .[ch] files (or &lt;code&gt;make tags&lt;/code&gt; in
a kernel source dir), and it generates a TAGS index.  You load that in emacs with &lt;code&gt;M-x visit-tags-table&lt;/code&gt;, and with the below keybinding, pressing F10 will take you to the original definition of whichever symbol the cursor is on, no matter where it appears in the source tree.
Within a few presses of F10, you've escaped macro hell and found where the code that actually defines the function you're interested in is.&lt;/p&gt;

&lt;pre&gt;
(defun find-tag-at-point ()
  "*Find tag whose name contains TAGNAME.
  Identical to `find-tag' but does not prompt for 
  tag when called interactively;  instead, uses 
  tag around or before point."
    (interactive)
      (find-tag (if current-prefix-arg
                    (find-tag-tag "Find tag: "))
                (find-tag (find-tag-default))))

(global-set-key [f10] 'find-tag-at-point)
&lt;/pre&gt;

&lt;h2&gt;git.el&lt;/h2&gt;

&lt;p&gt;Also, there's fairly good GIT support in emacs, which mostly consists of turning each GIT shell script into an emacs command you can run with &lt;code&gt;M-x&lt;/code&gt;.  I use this, but it's not particularly exciting.&lt;/p&gt;

&lt;h2&gt;&lt;code&gt;M-x gdb&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;emacs22 has a new graphical GDB mode.  It is awesome.  Here's a &lt;a href="http://www.gnu.org/software/emacs/tour/images/gdb.png"&gt;screenshot&lt;/a&gt; from Phil Sung.&lt;/p&gt;

&lt;h2&gt;org-mode&lt;/h2&gt;

&lt;p&gt;I'm trying to get the hang of emacs org-mode, but I'm not quite there yet.  I mostly want something to manage my TODOs that don't have hard deadlines and my diary/appointment entries that do.  If anyone feels like bragging about their great org-mode setup and sharing code, go right ahead.&lt;/p&gt;

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

&lt;h1&gt;GIT&lt;/h1&gt;

&lt;p&gt;&lt;br&gt;
All of the hosted projects at OLPC use GIT, for better or worse.  I thought it was for worse for a while, especially when GIT 1.4 came out and made me hate branches all over again, but there are a few new features that are making me like GIT more:&lt;/p&gt;

&lt;h2&gt;git rebase --interactive&lt;/h2&gt;

&lt;p&gt;&lt;a href="http://blog.madism.org/index.php/2007/09/09/138-git-awsome-ness-git-rebase-interactive "&gt;Pierre Habouzit&lt;/a&gt; has already written plenty about this.  Solves the "wait how do I revert this one commit I made twenty commits ago" problem, and some other ones too.&lt;/p&gt;

&lt;h2&gt;git stash&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;git stash&lt;/code&gt; lets you temporarily store changes away while you get your tree in a different state; examples are in the &lt;a href="http://www.kernel.org/pub/software/scm/git/docs/git-stash.html"&gt;man page&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;git add --interactive&lt;/h2&gt;

&lt;p&gt;"Anonymous" commented on this post:&lt;/p&gt;

&lt;blockquote&gt;Don't forget `git add --interactive` (in newer git). It allows you to commit only certain hunks of a patch.&lt;/blockquote&gt;

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

&lt;h1&gt;Misc&lt;/h1&gt;

&lt;p&gt;&lt;br&gt;&lt;/p&gt;

&lt;h2&gt;iprint/i&lt;/h2&gt;

&lt;p&gt;While working on a kernel driver, I was wishing for a way to take a hex number (that represented a bitfield) and print its binary decoding without having to do so in my head.  The command &lt;code&gt;/usr/bin/i&lt;/code&gt; (available as &lt;code&gt;iprint&lt;/code&gt; in Debian/Ubuntu) does this.  For example:&lt;/p&gt;

&lt;pre&gt;
pullcord:cjb~ % i 0x4F
79 0x4F 0117 0b1001111 'O'
&lt;/pre&gt;

&lt;p&gt;(The order there is:  decimal, hex, octal, bitstring, ASCII.)&lt;/p&gt;

&lt;p&gt;Even though this solves my problem well, I'd still like the kernel printk() to get a formatting string for "binary string" itself.  I wonder if a patch would be accepted.&lt;/p&gt;

&lt;h2&gt;rpmbuild --short-circuit&lt;/h2&gt;

&lt;p&gt;I'm used to Debian's &lt;code&gt;make-kpkg&lt;/code&gt;, which lets you hack on a kernel source tree and then build a package out of it.  &lt;code&gt;rpmbuild&lt;/code&gt; instead wants you to supply a tarball and patches for a source tree for it to unpack, patch and build with all at once.  You can get around that with the &lt;code&gt;--short-circuit&lt;/code&gt; option, which skips steps before the one you're after.  So, &lt;code&gt;rpmbuild --short-circuit -bc&lt;/code&gt; goes through the build and install phases, skipping the prep stage.&lt;/p&gt;

&lt;h2&gt;zsh share_history&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;setopt share_history&lt;/code&gt; lets each of my shells use the same history file, and the file is updated after every command is run, so I no longer have to flick through each shell window wondering which one in particular contains the shell with a copy of the long command I ran
in its history.&lt;/p&gt;</description>
      <pubDate>Mon, 15 Oct 2007 20:44:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:93845929-60e6-4020-8b0e-6cd25e8e3e8d</guid>
      <author>Chris Ball</author>
      <link>http://blog.printf.net/articles/2007/10/15/productivity-a-year-on</link>
      <category>git</category>
      <category>emacs</category>
      <category>zsh</category>
      <category>productivity</category>
      <trackback:ping>http://blog.printf.net/articles/trackback/39896</trackback:ping>
    </item>
  </channel>
</rss>
