Theresa O’Connor

The story of comint mode

As an alternative to five hackers doing five 80% solutions of the same problem, we would be better off if each programmer picked a different task, and really thought it through — a 100% solution. Then each time a programmer solved a problem, no one else would have to redo the effort. Of course, it’s true that 100% solutions are significantly harder to design and build than 80% solutions. But they have one tremendous labor-savings advantage: you don’t have to constantly reinvent the wheel. The up-front investment buys you forward progress; you aren’t trapped endlessly reinventing the same awkward wheel.

Example[…] I needed an emacs mode in graduate school for interacting with Scheme processes. I looked around, and I found a snarled up mess of many, many 80% solutions, some for Lisp, some for Scheme, some for shells, some for gdb, and so forth. These modes had all started off at some point as the original emacs shell.el mode, then had been hacked up, eventually drifting into divergence. The keybindings had no commonality. Some modes recovered old commands with a "yank" type form, on C-c y. Some modes recovered old commands with M-p and M-n. It was hugely confusing and not very functional.

The right thing to do was to carefully implement one, common base mode for process interaction, and to carefully put in hooks for customising this base mode into language-specific modes — lisp, shell, Scheme, etc. So that’s what I did. I carefully went over the keybindings and functionality of all the process modes I could find — even going back to old Lisp Machine bindings for Zwei — and then I designed and implemented a base mode called comint. Now, all process modes are implemented on top of comint, and no one, ever, has to re-implement this code. Users only have to learn one set of bindings for the common functions. Features put into the common code are available for free to all the derived modes. Extensions are done, not by doing a completely new design, but in terms of the original system — it may not be perfect, but it’s good enough to allow people to move on and do other things.

Olin Shivers (emphasis his)