Using programmable tools

Once upon a time, if you wanted to run software on your computer, you had to write it yourself. Any self-respecting home computer came with a simple programming language (generally some version of BASIC) which could be used to write business applications, games and a fair variety of different programs of differing complexity. But then at some point in the last few decades, programming has dropped off the radar of most computer users. Nowadays, if you say that you use your computer mostly to write programs, people will give you a weird look.

I’ve recently started to learn using GNU Emacs for my programming work, and I’ve fallen in love with it. Emacs is essentially a Lisp interpreter running on top of a small C core. What this means is that programmability is at the very core of Emacs’ design, not an add-on bolted on later. The result of this decision is easy to see in the wide variety of Emacs-Lisp applications available on the web. There are file managers, web browsers, email clients and a whole host of other things that help to make sure that you do most of your computing inside Emacs. It’s not for nothing that Emacs is often referred to as an operating system squeezed into a text editor.

However, the importance of Emacs isn’t that there is so much add-on software written for it, it’s that it is so easy to customize it and bend it to your will. For a new Emacs user like me, the first taste of the power underlying Emacs comes in simple things like being able to change key bindings easily and loading specific modes for certain file types (in my case, Standard ML, HTML and Python). The real benefits start coming later as you start making more and more customizations. Emacs changes from a general purpose text editor to a specialized tool that is gradually molded to your particular way of working. Using the custom hooks that I’ve made for my interpreters, I can already see a definite speedup in edit-test-debug cycle that I go through all the time. I still write less than about 200 lines of code a week on average and at this state, the improvements aren’t very noticeable. However, for someone who spends 20 – 40 hours a week writing code, the speed advantage can be tremendous, even counting the time taken to add customizations. It also helps that the custom code is in Emacs-lisp, a language that requires surprising few lines of code to get useful work done.

But Emacs isn’t the only piece of customizable software out there. Stumpwm is to window managers what Emacs is to text editors. It’s a tiling window manager written in Common Lisp, and can be customized on the fly without the need for a restart. Using a lean, tiling window manager like Stumpwm can take some getting used to. But once again, the time spent on the learning is quickly made up for. You no longer have to spend time spreading out windows so that you can see everything and moving application across virtual desktops is a snap. The Common Lisp programmability means that you can quickly add keybindings to commonly used functions and programs. The modeline, which takes the place of the panel in most other window managers is also programmable and you can pipe output from command line programs directly to it.

Using programmable tools takes a fair amount of commitment. It’s very tempting to just be lazy and accept the default, even though in the long run it might cost more effort. But if you spend a substantial part of your day writing code, then there really is no reason why you can’t take a few minutes out and adapt your tools to your workflow. A fair amount of programming work involves repetition: running compile jobs, tests, version control commits, file uploads, so and so forth. Often there are a bunch of different programs you need to get the job done. If you can gain even a small advantage by automating away some of these tasks, or at least combining them into a single interface, then it is to your benefit to do so. IDEs try to do some of this work for you. Unfortunately IDEs are always made by other people and so they may not gel well with your individual style and how you like things to be. Programmable tools might not have the beautiful interface of an IDE, but they are more powerful in that you have the freedom to build up your own IDE just as you want it.

At this point there will be some objections raised as to what will happens when you need to work on another computer. Seriously, how much real work do you do on another computer that you can’t customize as you need? Even if your work does involve switching computers regularly, in this age of fast internet connections, you could very easily have your custom tools (emacs configs, etc) stored on a central server and then pulled to a computer as you need them. All my code, including my Elisp code is stored on in a Subversion server and I pull them onto computer lab computers as I need them.

If you’re a UNIX users, there are many other opportunities lying around you including shell scripts for the command line, and init scripts to speed up boot time (or start up programs that you know you’ll need). Once you start programming your work environment, you won’t want to go back. I definitely plan to keep continuing to program my text editor and window manager. I’ll try to keep track of how much easier or more efficient my programmable tools make me. But I’ll really know that I’ve benefited when I become so used to my custom tools that I barely notice their presence and can devote my full attention to my work.

Quick Tip: if you’re a new Emacs user, google for “effective emacs”

About these ads

One thought on “Using programmable tools

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