Using Fargo to write code

There's a long tradition of editors doubling as programming environments. The first editor I used, on Unix, was built around that idea. When I was working on outliners on the PC and Mac in the 80s, we had a side project called Betty, which was a scripting language and outliner in one. After selling the company, I started UserLand to fully develop that idea. The result was Frontier, a scripting language built around an outliner.

That was in the 90s. Fargo shipped earlier this year, and last week it got the ability to script itself. This time I didn't have to write a scripting language, because we just use JavaScript. Makes my job that much easier because I don't have to sell you on a new language. These days JavaScript is very acceptable.

Here's how it works. There's a special outline called menubar.opml. When you edit it, you're editing a set of menus that go at the end of the Fargo menu bar. Each of the menu commands contains a script that runs when you choose the command from the menu. The menu is "live," so as you make changes to the outline, the menu rebuilds to reflect the changes.

I wrote a tutorial on it, called Introduction to Fargo Scripting. It's a sweet idea, but not new. Frontier started with this idea, and it developed into a protocol called menu sharing, which allowed users to edit menus in all apps that were compatible. It was very broadly supported in the Mac market in the early web days. Even Netscape and Microsoft supported menu sharing in their browsers. We even found a way to hack it into the Finder (thanks to Steve Zellers).

Today's new thing is the ability to post from Fargo to WordPress by script. This should help open up the use of Fargo as a WordPress blog editor. Currently you're limited to a single blog. But the ability to write custom scripts should blow by this limit.

BTW, one of the cool things about the post is how the source code is displayed. It's taken a few years of experimenting to get that down, and I think it's finally there.

I don't at this time have any docs on the verb set, but you can see the whole list in this JS file.

We've got the pump primed now, and a nice little community.

I wonder if you can all see how this is developing as a really interesting runtime and editing environment, with the web all around you, and esp with Dropbox doing the synchronization, and a content management system hooked in, it's really a whole new layer on what we used to think of as the net.

Mind bombs everywhere you look.

PS: Here's a quick video demo...


Posted: Thu, 01 Aug 2013 22:59:10 GMT