Sunday, January 11, 2009

Screencast: editing Factor code with Emacs and FUEL

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.

9 comments:

ebb said...

FUEL looks awesome. Thanks for the demo.

Here's an emacs tip for you:
C-h C-v ring-bell-function

Krishna said...

Thanks for taking the time to show off FUEL. It definitely has fueled my interest to learn factor. With jEdit given the boot, the Slava-fan and the Emacs-fan in me can co-exist peacefully :D

As for Factor, I wish it would enter the shootout as I expect it to take up a spot near SBCL. I also expect it to win the code-size contest coz I haven't seen anything more compact (and at times equally mind numbing).

Cheers!

Tarun Elankath said...

Hi Slava,

I was one of your JEdit users. I only recently stumbled across Factor. Will you be writing a book on this anytime soon? Somehow, I couldn't wrap my head around the language yet. (some of us poor mortals need hand holding)

Dimitre Liotev said...

Slava, you sound very bitter about Java indeed - but I guess sooner or later somebody will implement Factor on the JVM. All cool languages end up with JVM implementations - JRuby, Jython, a couple of lisps and schemes, Clojure, Sacala etc. If this trend continues soon there will be JmallTalk and Jactor...And if no Jactor appears it just means that Factor ain't cool enough :-)

Anonymous said...

I agree that fuel is amazing, and decreases the factor barrier to entry, at least for emacs users.

My two wish-list items for fuel:

1) Can the command key-strokes be simplified? It seems that the slime commands are generally simpler. See
http://www.pchristensen.com/slimecommands.pdf

2) I'd love to have the slime command "M-," which would "return from definition to examined symbol". This would be kind of a reverse "M-." . Then M-. could open the definition in the current window, greatly reducing the window clutter.

Anonymous said...

The HolonForth interface is pretty simplistic compared to the Factor UI, and I don't think it has much to offer in new features, but I'll just throw it in to see if it has any features of merit for Factor.

http://www.holonforth.com/new/holon.html

I really don't see anything new, but the way the GUI is set up may be of interest.

hugo said...

The screencast is very nice, what tool did you use to record it ?

It would have been a little bit better if you had uses KeyCastr as well, so we could see what you were typing! Cheers

reyt said...

I think wow gold and world of warcraft gold

G-G said...

"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."

Just wait until you find out about the Org Mode. :-)