Emacs and the art of Lightsaber Combat

Did you know that the Wookiepedia entry on Lightsaber Combat is considerably larger than the Wikipedia entry on modern warfare? In fact, I remember there being quite a fuss a few years ago about the fact that the Lightsaber Combat entry (then on Wikipedia proper) dwarfed the modern warfare entry (which at the time was just about a page long). It might seem rather frivolous to have collected so much information on a purely fictional weapon, but I think the reason that the entry is so big is in part due to the fact that the idea of the lightsaber is a very real and powerful one.

Jedi Master Mace Windu
Jedi Master Mace Windu

The core idea behind the lightsaber  is that though learning to use one requires a large amount of dedication and time commitment, in properly trained hands it can be extremely powerful. Conversely, if you try to use without the proper tutelage (and Force potential) you’re most likely to maim or kill yourself. The steep learning curve and the skill you have to acquire before being able to use one properly ensures that by the time you do master it, the lightsaber is much more powerful than something like a blaster, which is easier to use at the cost of being less flexible than a lightsaber in skilled hands. After all, Mace Windu totally owned Jango Fett.

Coming back to more mundane topics, this same concept holds for my favorite programming tool: the Emacs text editor. To demonstrate what I mean, here is a scientifically accurate graph of the learning curves of some popular text editors:

Text editor learning curves
Text editor learning curves

Though this is a bit of a joke, there’s some about of truth behind it. For simple editors like Notepad and Nano, there isn’t really all that much to learn and you quickly reach a stable plateau in terms of your editing capabilities. They’re not bad tools, but they’re not powerful either. You can interpret the other curves in a similar, though since I haven’t used Visual Studio or Vi extensively, I can’t comment on how accurate they are. Emacs, however, is kinda weird. It’s probably not as weird as the picture shows, but it’s not too far off either.

When starting off with Emacs, things can be a bit confusing. The keybindings aren’t what most people are used to and it doesn’t really have the point and click interface that you’d find in a modern IDE. Just as the Lightsaber isn’t like a normal sword, Emacs isn’t like a normal text editor. Sure, you’re not going to physically maim yourself with Emacs, but it’s possible to quickly get lost if you start hitting keystrokes that you’re used to from other programs. If you’re a little careful and just skim the manuals, it’s not really all that hard to get on your feet. I would venture that even with a lightsaber you can avoid cutting your limbs off with somef careful attention.

It’s after that point that things get interesting. This is when you hit the funny spiral part of the graph. It’s possible to use Emacs just like a plain simple text editor if you find the curve is too steep, but if you do that you’ll probably lose out on the best reasons to use Emacs. You could use a Lightsaber just like you’d use a normal knife or sword, but then you’ll miss out on all the cool acrobatic maneuvers and Force tricks that Jedi knights can pull off. I’ll venture to say that what the Force is to Lightsaber combat, Emacs Lisp is to the Emacs editor.

Emacs lisp is emacs’ inbuilt programming language. It may not be the most easy to use or powerful programming language out there, but it is what gives Emacs most of it’s power. It allows you to extend and customize Emacs almost as much as you’d like. It’s allowed the creation of state-of-art XML editing modes, code browsers, and even file browsers and email programs right inside Emacs. If you want to master Emacs and unlock its potential, you must gain knowledge of Emacs Lisp. Again, just like Force training and advanced lightsaber techniques, it’s a skill that takes sustained training and that not many developers actually ever master. There are lots of programmers, but not all of them make the effort or have the inclination to learn tools as powerful as Emacs. Just as a trained Jedi master can use a lightsaber to quickly clear his path of obstacles, whether they be droids, humans, aliens or giant metal bulkheads, an experienced Emacs hacker can write Lisp code to create customized functions (or lash together existing ones) to help solve the trickiest of problems.

Emacs has an uncanny ability to bend itself to the will of its user. By virtue of being a programmable platform, Emacs actively encourages users to write their own little utilities and make modifications to make Emacs their very own editing powerhouse. At the same time there is a very active open source community devoted to building tools of various sizes on top of Emacs. Just as young novice Jedi can learn directly from the great masters, the aspiring Emacs user can easily tap into the collective consciousness of the Emacs community via such excellent resources as the Emacs Wiki. I’m probably not far off the mark when I say that most users’ journeys to Emacs nirvana start by picking out bits and pieces of other peoples configurations and extension. This may not be quite the same as the one-on-one apprenticeship a Jedi enjoys, but there’s certainly no lack of opportunities to learn.

Again, ultimate editing power comes at the cost of significant investment of time and mental resources. Learning Emacs may not require monastic discipline and rigorous training from an early age, but it does require paying more attention to your tools and editing habits than most programmers would care to invest. Emacs comes from a time when writing your own software was par for the course for any computer user. There is an implicit assumption that the user will have an exploratory frame of mind and not be turned off at the thought of peeking under the hood and getting their hands dirty. Like the lightsaber, it requires a fearlessness and bravery that is tempered by experience and the will to continually observe and improve on one’s habits and abilities.

Anakin Skywalker as a trained Jedi
Anakin Skywalker as a trained Jedi

I could go on for quite a bit making increasingly poetic comparisons, but I think now is a good point to stop. Though all this talk of discipline and Emacs Lisp and maiming might sounds intimidating, behind it all is the simple idea that no matter what tools you use, to get the most out of them it’s worth it to put in some time and effort in learning to use them well. Whether your weapon of choice be a lightsaber sheathed in Force energy or a text editor wrapped in layers of custom code, the efficiency and power boost you get from some study and practice will pay back the investment many times over.

Advertisements

Published by

Shrutarshi Basu

Programmer, writer and engineer, currently working out of Cornell University in Ithaca, New York.

3 thoughts on “Emacs and the art of Lightsaber Combat”

  1. the star wars comparisons caught my eye (as expected) but on the whole i found it quite an interesting read. it was one of the few things you blog about that i’d actually tried – the scheme dialect of lisp, using emacs. didn’t get far.
    i’m feeling like a second attempt at emacs. Currently i use Notepad++ or VIm, as per OS.

  2. Absolutely brilliant. I’ve been using Vim for most of my programming life (3 years) and I’ve been toying with the idea of switching to emacs because of it’s extensibility. Because of your insights, I’ve decided to take the plunge and give it a try. I just want you to know that you’ve had a positive influence on me, and I thank you for that.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s