Factor Language Blog

Screencast: editing Factor code with Emacs and FUEL

Sunday, January 11, 2009

For the last few months, Jose A. Ortega Ruiz has been working on the Factor mode for Emacs, which was originally written by Eduardo Cavazos. Jose has extended the mode considerably, and renamed it to FUEL, “Factor’s Ultimate Emacs Library”. FUEL extends Eduardo’s Factor mode with features inspired by SLIME. Among them, we have:

  • Syntax highlighting, auto indent, s-expression navigation
  • Word completion
  • Jumping to definitions
  • Listing word usages
  • Some refactoring commands: extract word and extract vocab
  • Lots more; see the documentation

Some of FUEL’s features duplicate functionality found in the Factor UI, but really, they’re complementary; the backend code is the same (it’s all written in Factor, and FUEL interogates a running Factor instance using reflection APIs).

I decided to record a screencast to demonstrate some of the more interesting capabilities offered by FUEL. You can watch it at factor.blip.tv. Make sure to full-screen it so you can read the text on my screen.

Formerly I would use jEdit to edit Factor code. Once FUEL started to become more mature, I decided to bite the bullet and learn Emacs. So indeed, after writing my own text editor, and using it for almost 11 years, I’ve decided to switch, because of FUEL. That’s how compelling FUEL is! FUEL’s M-. feature, which jumps to the word at the caret, and its automatic display of stack effects in the status bar, are huge productivity boosters in themselves, but FUEL offers much more than that.

jEdit used to have something like FUEL, in the form of the now-obsolete jEdit Factor plugin. I could have continued maintaining this plugin, but really, I don’t want to run any Java applications on my computer, if possible. I’m disappointed by Sun’s latest antics (abandoning Swing for the last 7 years or so; bundling Yahoo and MSN adware with the Windows JRE), and Apple’s half-hearted support for Java (really it’s Sun’s fault; why don’t they develop the Mac OS X JRE?). Now that I’ve switched to Emacs and FUEL for editing Factor code, I can boycott Java entirely and never run a Java application again.

Of course, eventually I want to write a syntax-aware editor for Factor, in Factor. Until then, FUEL provides an adequate approximation.