Bespin 0.8: Less and More

Bespin 0.8, codenamed “Cheviot”, is the biggest (and smallest!) Bespin release since Bespin 0.5. Released on June 21st, 2010, Bespin 0.8 is the most important release since Bespin 0.5 introduced the “Embedded” packaging last November. We’ve got a bunch of new features and infrastructure, and new plans for the Bespin server. Read on to find out what is new, skip to the bottom for release notes and download links.

A Quick Demo

There’s a bit more information in the blog post below, but there’s more action in the video. Check it out:

Less

There are three features that make Bespin 0.8 “less” than 0.7.

First, Bespin Embedded 0.8 minified is now less than half the size of the 0.7.3 release. The “Drop In” release is now just under 300K minified. If you are already using jQuery on your page, you can build a custom Bespin that is about 225K minified and only 65K after gzipping. Without a doubt, there is more we can do to shrink Bespin further, but we’re quite happy with its new, slimmer size. One more bonus with respect to Bespin’s size: Bespin 0.8 makes it possible to dynamically load plugins in Embedded builds. That way, the initially loaded Bespin script can contain just the parts needed to get Bespin going, and extra features can be loaded in as the user wants them.

Second, Bespin 0.8 includes a new theme capability that allows you to radically change the appearance through a simple plugin. Bespin’s themes go beyond just CSS, because we wanted theme creators to be able to change the appearance of plugins they had never even heard of before. Bespin 0.8 uses the new LESS.js package to allow UI components to use global theme variables so that they can change appearance as the theme dictates. You can see this by switching your Bespin to use the new “white” theme. LESS also provides a very convenient syntax that ensures that Bespin plugins won’t leak the CSS rules onto the page.

Speaking of leaking onto the page, Bespin 0.8 exposes only the variable “bespin” to your page. And there is no more manipulation of built-in object prototypes.

More

In addition to being less than Bespin 0.7.3, Bespin 0.8 also does more. One of our most requested features has been fulfilled: you can now embed Bespin’s spiffy command line in custom Embedded builds. And it’s easier to do than you’d expect. Just add the “command_line” plugin to your manifest file, rebuild and you’ll see the command line there.

Bespin 0.8 with command line in white

We’re able to do this now because of a new “application configuration” mechanism that determines how certain objects that are global within a given Bespin editor are created and how components are added to the GUI. With this new mechanism, we have reached the point where the difference between Bespin Embedded and Bespin+Server is just a difference of configuration (and, of course, the server itself!)

Speaking of servers, our dryice build tool, which is responsible for creating embeddable Bespins, now includes a little server. Fire it up, and on each page load it will rebuild your Bespin. It’s the easiest way to try out different plugins and configurations.

One more oft-requested feature that has now landed in 0.8 is the ability to replace a <textarea> with Bespin. Earlier embedded releases could only put themselves in a container. Bespin is now able to replace a textarea and update the textarea when the form is submitted, making Bespin much more of a drop-in replacement for a textarea.

We’ve added CSS syntax highlighting, and all of our highlighters now run in Web Workers. By running the highlighters in workers, we get better performance and open the door to add interesting new features in future releases.

Among the minor tweaks and improvements made: you can indent/unindent blocks of text by selecting the block and hitting tab/shift-tab and a new CSS syntax highlighter, initially contributed by Cody Marquart.

For Plugin Authors

We’ve got a new, client-side template engine that makes it easy to generate your user interfaces.

If you’re writing editor commands, you now have access to the same convenient APIs that Embedded users had before. It’s simple to get the selected text, manipulate it and replace it.

We’ve added a Growl-like notification system to Bespin, making it easy for plugin authors to get the user’s attention and easy for the user to choose which kind of notifications they want to see.

Keep an eye on this blog in the coming days for new tutorials. If you create any plugins that you want to share with the Bespin community within the next few days, please email me so that you can be added to the initial Bespin Plugin Gallery.

Bespin Server News

During the past few weeks, we’ve figured out where we’re going with the Bespin Server. Given that I’ve written at length about this in other places, I’ll just give the short form here. If you’re interested in the full story, you can read about it here.

The short form is this: software developers work on all kinds of different projects. For Bespin to support “coding in the cloud” for that variety of projects, we need a server that’s as customizable as our editor is. So, we’re going to rewrite the server in JavaScript and leverage the same plugin system we use on the client. We’re going to couple that with ways to get that server running easily, so that everyone can run their own Bespin server.

bespin.mozillalabs.com has never been a “production-level” service. In the future, it will be used to demonstrate Bespin features, but will be even less production-level than it is today. We’ve added the “export” command so that you can get your projects off of the bespin.mozillalabs.com server, if you have any data there that you care about.

As a stepping stone to the new server, we’re planning to package up Bespin for use as a desktop editor. We think that Bespin is a fun and productive editor to use, and it makes a great environment for editing Bespin plugins. The desktop version of Bespin will also be our proving grounds for the JavaScript port of our dryice build tool.

Bespin 0.8 does add a much-requested server-related feature: working directories. The combination of using “cd” to get to a specific spot in the filesystem and “open” with its awesome file searching abilities is a really productive way to navigate between files.

Getting Involved

Our version numbers have been creeping upwards and 0.8 is not a lot of distance from 1.0. Quite a bit has stabilized on the client side now. The easiest way to get involved with Bespin right now is to create plugins. Syntax highlighters, themes, commands and keymappings are all straightforward to create.

Bespin is now ready to add more user interface components. Things like a file browser and a toolbar would be great. A notification configuration GUI (like the Growl preferences pane) or a settings UI would be cool. A menu system for commands would be neat as well, and help new users.

And, of course, there’s more to be done in the core editor. Things like TextMate-style snippets (which are fantastic!) and rectangular selection are good bets if you’re looking for a bit of a challenge. And we’re always looking to improve the performance, so profiling and optimization help is ever welcome.

The desktop and server tooling is just about to get started. We’d love your help on those projects! This will certainly be the area with the most churn, so you only want to dive in here if you’re feeling adventurous.

Release Notes and Download

You can download Bespin Embedded releases from http://ftp.mozilla.org/pub/mozilla.org/labs/bespin/Embedded/

The complete Bespin 0.8 release notes are available as part of the official documentation.

Enjoy the new release!

Kevin Dangoor, on behalf of the Bespin project team