History, Search, and being automatic

It’s kind of funny just how strongly most applications reflect the underlying APIs they use. I think it’s just a manifestation of the path of least resistance principle for programmers. For example, pretty much every editor I’ve seen includes a save button, which maps strongly to the underlying write()/close() APIs. But…there’s no reason to have a save button. Changes I make should be automatically saved (like how GMail does it). Then, allow me to view history and undo. The best example of this is the Eclipse local history. Eclipse still has a save button, but I think they could fairly easily delete it; they just probably don’t have the will to face down the vocal minority.

Yesterday I got motivated by this post on the Hotwire Google Group, so I sat down and hacked for a while to fix some issues that had been bugging me in my day-to-day usage, and add some cool new features.

Hotwire 0.595 announcement.

What I actually want to talk about today is a feature that’s been around for a while in Hotwire, related to the idea of automatic saves:

Remembering what directories you actually use, automatically


Searching for firefox
Quick background: A week or so ago when Bryan and I decided to base the Firefox Journal on Firefox 3, I downloaded the latest Firefox CVS source and built it myself. This is in fact very easy to do, by the way, if you’re interested in joining the Firefox development community too.

Now, when I log into my desktop, I need to start the development version of Firefox, not my system one. This involves changing to my Firefox build tree and executing MOZ_NO_REMOTE=1 ./firefox -P default. Hotwire makes this experience significantly nicer than gnome-terminal+bash.

Whappening in the above screenshot is that I’m in my home directory, and I typed cd firefo. One thing you can notice immediately is that I have a real firefox directory as an immediate subdirectory (this is an older binary distribution). Hotwire offers that to me as the first completion, for compatibility with TAB mashing.

The magic

But what about those other completions? How does Hotwire know to offer me a completion all the way to src/mozilla/build-firefox/dist/firefox, instead of some subdirectory? The algorithm is actually very simple. Hotwire remembers how often you execute commands in each directory, and the cd command is actually a search over your “hot” directories, ordered by frequency of command execution.

I’ll be honest. Hotwire has its bugs. You probably wouldn’t believe me if I told you how Rube Goldberg the process of displaying output from shell commands is internally, for example. But it’s small features like the above that make me never want to back to terminal+bash. Longer term, we can fix bugs that make Hotwire different (as opposed to purely better) than term+bash, but I don’t see the competition evolving the way we are. I doubt bash even has a hash table internally, much less a slick interface to SQLite.

Branding

My long term goal is to get to the point where people think of Hotwire as the “Firefox of development shells”. We have a ways to go to get there, but all Hotwire needs is a few skilled Python hackers to really help bring it to the next level. If you’re interested, jump into development!


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 )

Facebook photo

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

Connecting to %s