Emacs cat-safe
I was inspired by an item
in Luke’s Tumblr blog last night. It was a screenshot of a program
called PawSense, which
monitors a computer’s keyboard for cat activity. (I don’t know if it’s
any good, but it’s funny.) As anyone with cats knows, it’s not unusual
to leave a computer only to come back later to see garbage typed in by
a wandering cat. I wrote a version for Emacs today.
git clone git://github.com/skeeto/cat-safe.gitPut it (cat-safe.el) somewhere in
your load-path (like ~/.emacs.d/) and put
this line in your .emacs file,
(require 'cat-safe)
This only monitors Emacs itself; it should help protect your buffers but not your web browser. When cat interference is detected Emacs switches focus to a junk buffer and lets the cat make a mess there instead. In case your cat happens to type out some Shakespeare you will be able to read it in the junk buffer. Just kill the junk buffer to return to work.
It could still use some improvement. Right now it looks for a single key being help down, excepting keys humans tend to hold down like backspace, delete, and space. If you play around with it you’ll notice if you press several keys at once Emacs will sometimes create a pattern with them. I need to figure out a good way to detect this.
I’m going to run it at home for awhile to make sure it remains transparent, but still does its job. It will probably incur a performance penalty on frequently repeated keyboard macros.