This is the blog of Vivek Haldar

Deep Shelling

Seeing as I spend the vast majority of my working life interacting with plaintext, and a lot of it through an interactive shell, I have found that one thing that is absolutely crucial to my productivity is having a very deep history, coupled with an unrestricted, editable shell.

Let me explain what each of those means to me.

By deep history, I mean having very long lasting shell sessions, so that I can go back and see the entire history of my interaction (commands I entered as well as their output) going back not just days but months.

By “an unrestricted, editable shell”, I mean a session where everything is editable and searchable, not just the command prompt. In other words, your shell is just like a plain text file in an editor.

So some of you have probably already guessed that I implement this using shell buffers in Emacs. Within that, I have tons of shell buffers, usually one per task or project I’m dealing with, all with short but descriptive names. In addition I always have Emacs running in daemon mode. Almost always, the uptime for my Emacs process is the same as the uptime for my machine.

This combination is extremely powerful. I don’t know how many times I have to recall some complex, obscure commandline invocation, or remember some piece of interaction from the past. With this setup, all I have to do is search backwards. Also, selecting, copying and pasting text in most terminal emulators is is very fiddly, and usually involves leaving the keyboard and using the mouse.

The bottom line is that each shell is just another plaintext buffer, upon which the full force of Emacs’ text editing power can be applied. It now makes me cringe when I see someone fiddling with tons of little unsearchable, uneditable xterm windows, struggling to copy and paste text in and out of them.

There is a downside though. On the rare occasion that my Emacs daemon crashes and I lose all my state, it is extremely disorienting. Those are the chips.

Copyright 2008-2013 Vivek Haldar