On Thursday, Farhad Manjoo of Slate vented his spleen about those of us who use two spaces after their full stops, a.k.a. "periods". This seems to have triggered a minor kerfuffle, though not for the first time. While I disagree with a few of his points, the premise is sound. Unfortunately I, like many others, have double-spacing ingrained. This app might help.
Manjoo's argument seems to ramble a bit. It's allegedly a holdover from monospaced typewriters, but the width of two spaces in a monospaced font is much more significant than under in a proportionally-spaced font. Eh?
He also claims that "Monospaced fonts went out in the 1970s" and "we've all switched to modern fonts" [my emphasis]. Well, sorry, but we haven't all switched to modern fonts, as I think many programmers, screenplay writers and lawyers will attest. I use monospaced fonts every day, and I read and write all email in the wonderful Monaco typeface that comes with every single Mac.
His argument has been picked up by others, both pro- and con-. I will let them argue it.
Enough of a rant from me, though. As I said, I do agree with the overall premise, but how to switch? Habits are hard to break. Rigging up some sort of taser seems excessive, but an obnoxious noise should do the trick.
The result is Space Honker, version 0.1 (build 0002). This is a small app for Mac OS X which sits in your menu bar and watches what you type. As soon as you type a dot (or an exclamation mark, or a question mark, or a colon, or a semicolon, or a comma) followed by two spaces, it should make an irritating noise. Just to rub it in a bit more, it'll update a counter to tell you how many grievous sins against typography you've made.
It will only trigger if you hit the keys in order, so if you type the full stop and then mess about somewhere else in the sentence and then return and type the spaces, it will not trigger.
It's the product of about two hours' work, so by no means the best piece of code I've ever written (to the point that I'm not releasing the source publicly for fear of embarrassment) but it might work.
Feel free to download it and try it, but at your own risk: I haven't put anything that I know to be nasty or malicious in it, but you never know. Oh, and if it fails to pick up a sentence and you get marked down for bad punctuation, that's also Not My Problem.
Please let me know how you get on with it. Next up: something to cure me of my unhealthy dependence on the ellipsis…
The Methodology
If you're a programmer, you might want to check the method I'm using: it uses NSEvent's addGlobalMonitorForEventsMatchingMask:handler: to listen to all keyDown events in the system. On keyDown, it checks to see if it has a known unichar for the incoming keyCode, stored in two unichar[65536] arrays: one for shifted, one for unshifted. If not, it uses [event characters] to get the unichar for the key, and if it's reasonable, it'll store the result. Otherwise, it'll mark that array entry as -1, ie. no match. By caching values, it reduces the amount of NSString lookups that would otherwise occur on every single keypress.
If it finds a chain of one of the specific punctuation marks, followed by two spaces, it'll honk.
Anyway, if you're a competent Cocoa programmer and you want to take the code off my hands and clear it up, buzz me. Otherwise, best of luck.
The sound effect is by Stickinthemud, and came via Freesound, and is licensed under a Creative Commons Sampling Plus 1.0 License. Thanks!
Incidentally, Space Honker triggered 16 times in the process of writing this post. Heh.
UPDATE: Turns out I forgot to mention that "access for assistive devices" needs to be enabled for it to work. I've added a popup that should come up if it's not set. You can download the updated version here: Space Honker, version 0.1. (build 0002). Sorry about that, folks.