xGoat
More tea please.

Dealing with whitespace

How to use whitespace is a contentious issue amongst programmers. If they spent their time arguing about software architecture instead, I’m sure software would be years ahead. I guess it’s because whitespace is a conceptually easy thing to argue about and be “creative” with… *sigh*.

When editing prose in things like LaTeX files, I use long lines. Each paragraph that I write is on a single line (avec emacs visual-line-mode). This is of course irritating if one just uses normal diff. The solution I used to use was dwdiff. However, `git diff` has recently developed a “--word-diff” option.

--word-diff turns an output like this:

-The cat sat on the hat.
+The cat sat on the mat.

into this:

The cat sat on the [-hat.-]{+mat.+}

(and if you have git’s color.ui config option set to true, it looks even better.)

Posted at 2:40 am on Friday 21st October 2011

Comments are closed.

Site by Robert Spanton. © 2008 - 2011