Tuesday, December 27, 2005

The Tale of the Haunted Editor

In the last few weeks, while using the Emacs editor, I noticed that every so often, weird random errors would creep into my documents. It didn't make sense that they were just typing errors, because I would have noticed them right away, instead of much later. I began to try out different theories. Were my coworkers playing a joke, and inserting strange stuff into my files while I was away from my desk? This seemed very unlikely. Besides, it happened even when I hadn't left my desk. Was there some bug in the software? I couldn't believe that there would be such a serious bug that corrupted documents like this, that only happened to me. And I had used this software for years without a problem. Could it be trouble with my keyboard? Maybe my computer was haunted?

Today, finally, I figured out the problem. I had been using the mouse wheel to scroll around in the document, and occasionally while turning the mouse wheel I would press it a little too hard. This would result in a "middle button click" which was defined to paste whatever was in the buffer into the current point in the document. But since I was in the middle of scrolling, I would not notice the paste since it would quickly scroll off the screen. Later, when I came back to that section of the document, I would notice the problem. I redefined "middle button click" to do nothing, and the ghost in the editor was banished.

2 comments:

cfollymacher said...

heh.

Anonymous said...

When I first started using the *nix machines at school, I'd occasionally get stuck in some horrendous editor called "vi". I figured that at the very least I needed to know how to exit gracefully from the program, so I got online to do some research. The first piece of information I found was "vi is an editor that has 2 modes: one beeps, and the other corrupts your file".

Emacs, by comparison, has more than two modes. I'm still not sure if that's a good thing.

A coworker was always trying to get me interested in Emacs. He'd say "it's so easy... look: all you have to do is..." (press two buttons at a time, and then press two other buttons, and then two other buttons), and then something miraculous would occur, like a file would open. WHOA.