How I use GNU Emacs
My last post discussed when and why I started using Emacs many years ago. This post covers how I use it, from the embarrassing beginnings to the hopelessly addicted present. Here are the major stages of Emacs usage in my life:
- It's just an editor: run it every time you want to edit a file.
- Maybe it's a development environment: leave it running all day for editing, compiling, and deploying stuff
- It's the solution, no problem is too great. Bring it on!: In case the temptation occured to you I'm sorry, it's too late. Vi has already been implemented as M-x viper-mode. HHOS.
#1 is the SimpleText/Notepad/vi worldview. After 5 or 6 passes you start to wonder "why isn't Emacs ready IMMEDIATELY?? I just need to add/remove/replace a few characters! Am I using it wrong?" Yes yes yes yes, but don't stop there. After a while you realize it makes more sense to try step #2.
#2 learning enough chord-command-mojo to put text where you want it. Also probably means running one of the internal terminal emulators (shell, eshell, or whatever M-x term is good for??). At the latter part of this stage your caps lock key has become a control key.
#3 is kind of depressing. You have come too far to quit. No one wants to suffer the keyboard shortcut withdrawl it takes to learn a trendy new editor well. It's also depressing to realize you will never use the Dvorak keyboard layout without remapping everything to fit the same keyboard patterns!
Stage three is the scariest stage. It's the all or nothing stage where you decide to use Emacs for as much as possible as often as possible. You pretend like you're not jealous of neat TextMate tricks... and then act all blasé and snooty when someone implements textmate.el.
Slipping for a moment back into why I prefer Emacs
What is textmate.el? Physically it's 234 lines (including comments) of Emacs Lisp. What is it conceptually? A plugin? An add-on? A shared library? A loadable module? No. It's no different than the Elisp that most of Emacs is built with.
I feel like I'm misrepresenting something simple but very important here... not all of Emacs is implemented in Lisp but so much of it is that "plugins" have the same, broad access to the plumbing as core code. Implementing so much of the editor in an interpreted high-level language was questionable when workstations were so much slower. Back when eight megs and constantly swapping was painfully true.
Especially salty old Emacs Lisp (warning: some profanity, and questionable maturity picking names for things
.
My point here is that the design of Emacs focuses on extensibility and delegates performance worries to Moore's Law. Solid bit of planning there!
Enough of the cheerleading already.
The goal of this rambling logorrhea was to explain how I came to depend on Emacs. Version control integration is cool, sure. And the SQL features sure are slick. What I needed went beyond cobbling together fixes and features.
My problem was disorganization. The brute force mental juggling I tried for so long was A.) reacting badly with an aging brain and B.) an embarrassing stream of forgotten items and prioritization failures. My professional development was stalling.
Since I was suffering from stage 3 addiction to Emacs I looked there first. Hi there org mode! Wow! Using GitHub? OoooOOoooo!
Before org-mode my workarea was basically an altar to post-it notes. This year I have used NONE. I dump things into org-mode (supports internal and external hyperlinks) and refresh my agenda (C-a a) whenever I need a reminder of what to do next. It's quick enough and good enough to be habit forming. Good habits!
Laziness, or this post is long enough already
I'm not providing screencasts or a detailed HOWTO on using any of my pet modes. Other people have done that better already. I'm going to thank you for reading this far and leave you with a few more fun commands to try:
- M-x woman (surprisingly not offensive. try C-h a woman)
- M-/ (word completion, I do this more often than saving files)
- M-x ido-mode (like a genie for bouncing around open buffers)
- M-x zone (this is a byproduct of extra time!!)
Why and when I started using GNU Emacs
Emacs is one of those polarizing topics among software developers. Maybe it's tripolar: Camp Emacs spars with Camp Vi to the great amusement of Camp Everyone Else. The heckling is especially raucous from Camp Java/C# IDE whose devotees ritually launch The Environment to press the '.' and ';' keys all day.
To make up for that rotten attempt at humor I decided to spend some time explaining why and how I use Emacs. This blog post covers the background, the why and when I switched. The next post will cover how I use/depend on it in my daily workflow.
When MacOS X first came out I was a certified Metrowerks CodeWarrior fanatic. They had the coolest booths at MacWorld, a killer logo, and everyone drooled over the new CWDev tools CD arrived. That powerful, graceful IDE killed Apple's Macintosh Programmers' Workshop (MPW). Now that IDE was a strange beast:
- Ugly, ugly, ugly, and really unintuitive; its icon had binary on it (decimal value 13 I think? 01101?)
- A C compiler with a good sense of humor
- Regular expressions with bizzaro 8-bit characters in the syntax
- Projector, the unlovable source code pseudo-control software
- Locked in a mortal battle with Jasik's Debugger, which
- Was even uglier and less intuitive than Macsbug.
- Was the only game in town for source level debugging of system extensions.
- Had "shortcut" commands which used multiple meta keys at once
- Was so uncool it was trés cool
Metrowerks really ruled the Classic/Carbon Mac development roost for a while. It was really good software. On awesome days I got use MWPro, Jasik, Resorcerer, and Installer VISE.
The fate of these tools was sad but clear when MacOS X arrived. Apple shed everything except its logo. Lots of good reasons to be sure but the process was messy. All the cool tools on my nerd belt could never keep up with the free, bundled tools built with asymmetric knowledge of Darwin and dyld(1).
At this point my current project was written in C++ and built on several platforms. It used imake to build all platforms from a single imakefile... except the Mac build which was a maintenance drag. MacOS X was Unix, right, so all we had to do was port imake to a new platform (arggggggghhhhh). All the imake work in Terminal.app needed a good text editor. XCode wasn't it. CodeWarrior was doomed. I needed something else.
15 seconds with vi was quite enough, thank you.
I remembered this program called Emacs. Sure enough, it was installed. And boy howdy was it weird. Seriously, I had to press control-x and then control-s to save a file???! control-x and control-c to quit?!!! escape-w to paste??? ... for just one brief moment vi started to look better...
... but then Jasik's Debugger came to mind. It used multiple meta keys at once and that was okay, despite them appearing with Ω characters in the menu bar.
That transition to accepting Emacs as probably worth learning happened 5-6 years ago. Emacs is the only program I have used literally almost every work day since then (even using it right now
. Initially I just used it to flit between a bunch of files quickly and keep a shell prompt up all day. Just in the last year Emacs has become even much more important as a task organizer and scheduler. But more on that in the next post!
Emacs is just one of the horses for a plethora of courses. I prefer vi for quick edits / wimpy *nix installations, and Eclipse for Java coding. Also, while GNU Emacs is a good distribution Carbon Emacs is not to be missed if you are running a Mac. Grab a copy and have some fun with...
- M-x tetris
- M-x list-colors-display
- M-x animate-birthday-present
- M-x glasses-mode (BestAppliedToCamelCaseText)
- M-x artist-mode, then M-x artist-select-op-spray-can, then click and drag
Task organization, SQL, and VCS chores are the killer apps within Emacs for me. I'll be discussing those in the next blog post. Until then please respond with questions and comments and (good) jokes about Emacs. If by any chance your curiousity was piqued then run, don't walk to the Emacs user community wiki.


