<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>skywriter</title>
	<atom:link href="http://mozillalabs.com/skywriter/feed/" rel="self" type="application/rss+xml" />
	<link>http://mozillalabs.com/skywriter</link>
	<description></description>
	<lastBuildDate>Wed, 19 Jan 2011 18:52:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Mozilla Skywriter has been merged into Ace</title>
		<link>http://mozillalabs.com/skywriter/2011/01/18/mozilla-skywriter-has-been-merged-into-ace/</link>
		<comments>http://mozillalabs.com/skywriter/2011/01/18/mozilla-skywriter-has-been-merged-into-ace/#comments</comments>
		<pubDate>Tue, 18 Jan 2011 20:16:11 +0000</pubDate>
		<dc:creator>kdangoor</dc:creator>
				<category><![CDATA[Bespin]]></category>

		<guid isPermaLink="false">http://mozillalabs.com/skywriter/?p=142</guid>
		<description><![CDATA[The Mozilla Skywriter project (formerly Bespin) is a Mozilla Labs experiment to explore ideas around &#8220;coding in the cloud&#8221;. We&#8217;re happy to announce that the project has found a new, permanent home as part of the Ajax.org Cloud9 Editor (Ace) and Cloud9 IDE projects. Read on to hear more about the transition and what we&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<div><em>The  Mozilla Skywriter project (formerly Bespin) is a Mozilla Labs  experiment to explore ideas around &#8220;coding in the cloud&#8221;. We&#8217;re happy to  announce that the project has found a new, permanent home as part of  the Ajax.org C</em><em>loud9</em><em> Editor (A</em><em>ce</em><em>) and Cloud9 IDE projects. Read on to hear more about the transition and what we&#8217;ve learned along the way.</em></div>
<div><em><span id="more-142"></span><br />
</em></div>
<div><a href="http://benzilla.galbraiths.org/">Ben  Galbraith</a> and <a href="http://almaer.com/blog/">Dion Almaer</a> brought Bespin (later renamed to Mozilla  Skywriter) with them when they joined Mozilla at the end of 2008. It was  a <strong>beautiful, responsive code editing environment</strong> that lived completely  in the browser and on the web. It used the shiny new <a href="https://developer.mozilla.org/en/canvas_tutorial">&lt;canvas&gt;</a> HTML  element. It immediately attracted a good deal of attention and a bunch  of activity along many axes. New Bespin fans:</div>
<div>
<ul>
<li> contributed new syntax highlighters</li>
<li>ripped the editor out of the tree and stuck it onto their sites</li>
<li>tried  to set up their own servers</li>
<li>made themes for other editors based on  Bespin&#8217;s theme, and</li>
<li>complained about the many limitations they had to  deal with while coding in Bespin&#8217;s cloud.</li>
</ul>
</div>
<div>Clearly,  there was a lot of interest in being able to write code in the browser  from wherever you are. I believe that there&#8217;s even more interest today  than there was back then with more devices and new operating systems  coming along that are viable platforms for working on the web.</div>
<div>That  said, Mozilla has decided to <strong>charge up our efforts in developer tools</strong>.  We&#8217;ve got some large, ambitious goals and running a code hosting service  has never really been a part of that. Further, a code editor is a much  smaller part of the whole that we seek to build, <strong>making Mozilla  Skywriter much less of a focus for us</strong>.</div>
<div>In  the last quarter of 2010, we met some of the people of <a href="http://ajax.org/">Ajax.org</a> and  discovered that our interests and theirs lined up very well. Their  <a href="http://ace.ajax.org/">Ajax.org Cloud9 Editor (Ace)</a> is a responsive, nicely built editor for the web. Unlike Skywriter, Ace uses the DOM to render instead of the &lt;canvas&gt; element making it compatible with <strong>a wider range of browsers</strong> and potentially giving it a leg up in accessibility. Furthermore, Ace is the editor used in Ajax.org&#8217;s <a href="http://cloud9ide.com/">Cloud9 IDE</a>, which brings the &#8220;development in the cloud&#8221; idea forward.</div>
<div>While Ace  had all of the niceties and more of Skywriter&#8217;s code editor, it was missing out on  Skywriter&#8217;s extensibility. We&#8217;ve worked with Ajax.org to merge in <strong>a  simplified version of Skywriter&#8217;s plugin system</strong> and some of Skywriter&#8217;s  extensibility points. Ajax.org also agreed to relicense the whole Ace  package under the tri-license (MPL/LGPL/GPL) that applies to Skywriter.  This license is <strong>friendly for all kinds of projects, whether open source  or not</strong>.</div>
<div>Along  the way, we repackaged the <strong>plugin system</strong> as &#8220;<a href="https://github.com/mozilla/pilot">pilot</a>&#8221; and the <strong>command  line</strong>, which has become even smoother to use, is in its own package  called &#8220;<a href="https://github.com/mozilla/cockpit">cockpit</a>&#8220;. You can use just these components in your own projects  if you want to make them extensible or keyboard-friendly.</div>
<div>Cloud9  IDE is GPL-licensed <a href="https://github.com/ajaxorg/cloud9">open source</a>, with a <strong>NodeJS-based server</strong> and <strong>a  hosted service</strong> that Ajax.org currently offers in beta. Expect to see  lots of great things in the coming months for Cloud9.</div>
<div>The merging of Ace  and Skywriter has gone even better than we&#8217;d expected. It&#8217;s gone so  well, in fact, that we&#8217;ve decided that the best thing to do for the  projects is to completely merge them. We&#8217;re pleased to report that <strong>the  Skywriter project is now being fully replaced by Ace</strong>.</div>
<div>Here are the various changes that are taking place for this transition:</div>
<div>
<ul>
<li>The Skywriter home page (http://mozillalabs.com/skywriter) will now point people at the Ace and Cloud9 projects.</li>
<li>The new project homepage is <a href="http://ace.ajax.org/">http:/</a><a href="http://ace.ajax.org/">/ace.ajax.org</a></li>
<li>Follow the project on Twitter: <a href="http://twitter.com/#!/cloud9_editor">@cloud9_editor</a></li>
<li>The skywriter and skywriter-core mailing lists are changing to <a href="http://groups.google.com/group/ace-discuss">ace-discuss</a> and<a href="http://groups.google.com/group/ace-internals"> ace-internals</a></li>
<li>bespin.mozillalabs.com  will be changed to simply point to the main Skywriter page. The hosted  service there will no longer be available.</li>
<li>bespinplugins.mozillalabs.com will also direct people to Ace.  We will keep the plugin gallery around for several months more so that  Bespin 0.9 users can continue to download the plugins that are there.</li>
</ul>
</div>
<div>I promised to share some of the interesting things we&#8217;ve learned along the way:</div>
<div>
<ul>
<li>A <strong>command line is a great thing</strong> for the user interface of programmer&#8217;s editor.
<ul>
<li>You can present a <strong>clutter-free user interface with a huge amount of functionality</strong> that is both hidden away and quickly accessible</li>
<li>A <strong>command line based on a GUI</strong> like the browser can do a whole lot more than a command line that&#8217;s all text</li>
<li>We still have a good deal of experimentation to do to make a command line that is <strong>fully discoverable and supports &#8220;point and click&#8221; interaction</strong></li>
</ul>
</li>
<li><strong>Real-time collaboration</strong> is interesting and useful for remote pair programming&#8230; but is also not the primary way in which multi-programmer teams share code. That would be the version control system.</li>
<li>The number of applications out there that can benefit from a good code editor is remarkably large and <strong>touches an enormous number of users</strong>.</li>
<li>People looking to integrate code editing in their applications or wanting to use a cloud-based development environment have <strong>extraordinarily varied needs</strong>. Those people are all also programmers. This is why we invested in making Skywriter pluggable.</li>
<li>The <strong>DOM can be fast, and is getting faster</strong>. The original Bespin release shocked people with how fast it ran, even on large files. The key was to draw only the visible portion of the file.  Ace works the same way, but rather than drawing on a canvas it draws with DOM nodes and lets the browser decide what to paint and when. Browsers are getting faster and faster at this all the time.</li>
<li><strong>DOM Level 3 text events would help</strong>. Skywriter and Ace both resort to having a hidden textarea in order to accept input with non-Latin characters because there is no way we&#8217;ve found, even in modern browsers, to find out what <em>character</em> a user has typed.</li>
<li><strong>People are more willing to change editors than you&#8217;d expect</strong>. Programmers <em>live</em> in their editors, so the editor is one tool that they&#8217;re often reluctant to change. But, if there&#8217;s enough other convenience to make up for it, many seem to be willing to give web-based editors a try. That said, Skywriter&#8217;s <a href="https://github.com/ajaxorg/ace/commit/1cba46b8d3340e17244157aede38d36970e3354b">awesome keyboard support has landed in Ace</a>. If you&#8217;re a vim or emacs devoteé, you can help with fleshing out vim and emacs keybindings.</li>
<li>We explored many other ideas that will likely appear in tools in one form or another from <a href="https://github.com/mozilla/doctorjs">DoctorJS</a>&#8216;s ability to work out types in JavaScript to <a href="http://benzilla.galbraiths.org/2009/05/15/the-bespin-pie/">pie menus</a>.</li>
</ul>
<p>Those of us who have been working on Bespin and Skywriter all this time are going to continue working on Ace, adding new features and sprucing things up for our new developer tools. Stay tuned for the initial releases of Ace.</p>
</div>
<div>– <em>Kevin Dangoor, on behalf of the Skywriter and Ace teams</em></div>
]]></content:encoded>
			<wfw:commentRss>http://mozillalabs.com/skywriter/2011/01/18/mozilla-skywriter-has-been-merged-into-ace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bespin 0.9a2 released; Skywriter update</title>
		<link>http://mozillalabs.com/skywriter/2010/10/01/bespin-0-9a2-released-skywriter-update/</link>
		<comments>http://mozillalabs.com/skywriter/2010/10/01/bespin-0-9a2-released-skywriter-update/#comments</comments>
		<pubDate>Fri, 01 Oct 2010 11:43:48 +0000</pubDate>
		<dc:creator>kdangoor</dc:creator>
				<category><![CDATA[Bespin]]></category>
		<category><![CDATA[Release]]></category>

		<guid isPermaLink="false">http://mozillalabs.com/skywriter/?p=135</guid>
		<description><![CDATA[Bespin 0.9a2 offers fixes and a couple of features for users of Bespin Embedded and the Bookmarklet. In this post, I&#8217;ll also talk about what&#8217;s happening in the Skywriter transition. The most important change in Bespin 0.9a2 (download it now) is that it restores compatibility with Chrome. Chrome 6 included a change that broke a [...]]]></description>
			<content:encoded><![CDATA[<p><i>Bespin 0.9a2 offers fixes and a couple of features for users of Bespin Embedded and the Bookmarklet. In this post, I&#8217;ll also talk about what&#8217;s happening in the Skywriter transition.</i></p>
<p>The most important change in Bespin 0.9a2 (<a href="http://ftp.mozilla.org/pub/mozilla.org/labs/bespin/Embedded/BespinEmbedded-0.9a2.tar.gz">download it now</a>) is that it restores compatibility with Chrome. Chrome 6 included a change that broke a library used by Bespin.</p>
<p>Bespin Embedded now has a jslint_command plugin which adds a (you guessed it!) <b>&#8220;jslint&#8221; command</b>. Running this command will run jslint on the code you&#8217;re editing and tell you if it spots any problems. If you make a build with the &#8220;notifier&#8221; and &#8220;gritter_notify&#8221;, you can even get a popup message when you run jslint and your file has<br />
errors.</p>
<p>Also new is a <b>&#8220;specialmodules&#8221; setting</b>. If you&#8217;re editing CommonJS modules and the module name entered matches a regex contained in &#8220;specialmodules&#8221;, a special syntax highlighting tag (&#8220;specialmodule&#8221;) is added. This makes it possible to differentiate to your users which modules are provided by your system and which are their own.</p>
<p>The Bookmarklet has been updated to include the <b>&#8220;diff&#8221; syntax highlighter</b>, which is useful if you are the type of person who reviews patches on the web.</p>
<p>As announced a few weeks ago, the Bespin project is being renamed &#8220;Skywriter&#8221;. We are working on stabilizing APIs, simplifying some code and creating new JavaScript-based build tooling. The first release branded as Mozilla Skywriter will be a 1.0 alpha release, and as we head to a 1.0 final we&#8217;ll want to be sure that the APIs<br />
will be stable. In a few days, plenty of new opportunities to help out on the project<br />
will arise, so head over to the <a href="http://groups.google.com/group/skywriter-core/">skywriter-core</a> mailing list if you&#8217;d like to help make Skywriter the best editor around.</p>
<p><i>&amp;emdash; Kevin Dangoor on behalf of the Mozilla Developer Tools team</i></p>
]]></content:encoded>
			<wfw:commentRss>http://mozillalabs.com/skywriter/2010/10/01/bespin-0-9a2-released-skywriter-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bespin is now Mozilla Skywriter, moves to GitHub</title>
		<link>http://mozillalabs.com/skywriter/2010/09/02/bespin-is-now-mozilla-skywriter-moves-to-github/</link>
		<comments>http://mozillalabs.com/skywriter/2010/09/02/bespin-is-now-mozilla-skywriter-moves-to-github/#comments</comments>
		<pubDate>Thu, 02 Sep 2010 14:46:53 +0000</pubDate>
		<dc:creator>kdangoor</dc:creator>
				<category><![CDATA[Bespin]]></category>

		<guid isPermaLink="false">http://mozillalabs.com/skywriter/?p=128</guid>
		<description><![CDATA[Today, we&#8217;re announcing that the Mozilla Labs project codenamed &#8220;Bespin&#8221; is now called Mozilla Skywriter. It remains a Labs experiment to see how great coding in the browser can be by making a powerful, customizable HTML5 text editor. We&#8217;re also announcing a move to GitHub. We&#8217;ve had many compliments and complaints about the &#8220;Bespin&#8221; codename [...]]]></description>
			<content:encoded><![CDATA[<p><em>Today, we&#8217;re announcing that the Mozilla Labs project codenamed &#8220;Bespin&#8221; is now called Mozilla Skywriter. It remains a Labs experiment to see how great coding in the browser can be by making a powerful, customizable HTML5 text editor. We&#8217;re also announcing a move to GitHub.</em></p>
<p><span id="more-128"></span>We&#8217;ve had many compliments and complaints about the &#8220;Bespin&#8221; codename ever since we first introduced the project. You can&#8217;t please everyone, especially when it comes to naming. The Bespin codename, derived from the awesome &#8220;cloud city&#8221; in <em>The Empire Strikes Back</em>, was a fun name to use for an editor that enables &#8220;coding in the cloud&#8221;.</p>
<p>Since the initial release in February 2009, the Bespin has come a long way. The project has changed focus and expanded its reach. The &#8220;Bespin Embedded&#8221; releases have been showing up more and more including several entries in the recent <a href="http://knockout.no.de/">&#8220;Node Knockout&#8221;</a> competition: <a href="http://del-fuegos.no.de/">Nodify</a>, <a href="http://inflatable-chum.no.de/">Inflatable Churn</a>, and <a href="http://nko-prague-js.heroku.com/">Wrath</a>. Other recent development environments on the web have also chosen to use Bespin, including <a href="http://edit.shiftcreate.com/">ShiftEdit</a>, <a href="http://apps.jgate.de/">jGate</a> and Mozilla&#8217;s own <a href="https://builder.mozillalabs.com/">Add-On Builder</a> (aka FlightDeck).</p>
<p>As we approach a 1.0 release, it was clear that it was time to shed Bespin&#8217;s code name and give it a real, lasting project name. We&#8217;re happy to announce that that name is <strong>Mozilla Skywriter</strong>. I think that Mozilla Skywriter fits the &#8220;coding in the cloud&#8221; theme very well indeed.</p>
<p>Skywriter is becoming an end-to-end JavaScript-based system. <a href="http://github.com/c4milo">Camilo Aguilar</a>, a new contributor to the project, has been working on porting &#8220;dryice&#8221;, our build tool, to <a href="http://nodejs.org/">node.js</a>. Once that&#8217;s done, we&#8217;ll be creating a XULRunner-based desktop version of Skywriter and a new customizable server version based on node.js. It&#8217;s actually pretty amazing how many different uses for our editor we&#8217;ll be able to target with a single codebase.</p>
<p>Many people who have worked on Skywriter have expressed a desire to fork it on GitHub. There have been unofficial mirrors and plenty of people installing Mercurial just to use Bespin. In order to make things easier for our community, we&#8217;re moving the official repository for Skywriter over to GitHub: <a href="http://github.com/mozilla/skywriter">http://github.com/mozilla/skywriter</a>.</p>
<p>A note about the repositories: that shiny new repository holds the &#8220;all JavaScript&#8221; version of Skywriter. As I write this, that repository needs a lot of work (in other words, it&#8217;s broken!). All of the &#8220;bespin&#8221; names have changed to &#8220;skywriter&#8221; and the build tooling is still in the process of being rebuilt. The existing <a href="http://hg.mozilla.org/labs/bespinclient">bespinclient</a> repository remains available for people wanting to work with something that works today. That repository is effectively a branch of the code prior to the start of the JavaScript work. For the most part, we should be able to migrate changes made to that repository over to the new Skywriter repository pretty easily. We&#8217;re just changing the tooling to JavaScript, we&#8217;re not really changing Bespin&#8217;s core plugins at all.</p>
<p>One final note about the Bespin to Skywriter transition: the Bespin name appears in many places and it will take some time to fully migrate over. The <a href="http://mozillalabs.com/skywriter/">Mozilla Skywriter home page</a> will always have up to date links to project resources and is the best place to look if you&#8217;re having trouble finding something.</p>
<p>You can follow the <a href="http://twitter.com/MozSkywriter">Skywriter project (MozSkywriter) on Twitter</a> and ask us questions in #skywriter on irc.mozilla.org.</p>
<p>Finally, a big thanks to Julian Viereck who is off to university in Zürich. Julian has been a huge help to the Skywriter project since the beginning and we wish him good luck in the coming years!</p>
<p>– <em>Kevin Dangoor on behalf of the Mozilla Skywriter team</em></p>
]]></content:encoded>
			<wfw:commentRss>http://mozillalabs.com/skywriter/2010/09/02/bespin-is-now-mozilla-skywriter-moves-to-github/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bespin Plugin Gallery is now live!</title>
		<link>http://mozillalabs.com/skywriter/2010/07/29/bespin-plugin-gallery-is-now-live/</link>
		<comments>http://mozillalabs.com/skywriter/2010/07/29/bespin-plugin-gallery-is-now-live/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 12:44:02 +0000</pubDate>
		<dc:creator>kdangoor</dc:creator>
				<category><![CDATA[Bespin]]></category>
		<category><![CDATA[Release]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[plugins]]></category>

		<guid isPermaLink="false">http://mozillalabs.com/bespin/?p=123</guid>
		<description><![CDATA[Head over to the new Bespin Plugin Gallery to find plugins for Bespin and share the ones you&#8217;ve created. The new Bespin Plugin Gallery makes it very easy to find useful plugins for Bespin and to share the plugins you&#8217;ve created. By downloading the plugins you need and adding them to the search path in [...]]]></description>
			<content:encoded><![CDATA[<p><em>Head over to the new <a href="http://bespinplugins.mozillalabs.com/">Bespin Plugin Gallery</a> to find plugins for Bespin and share the ones you&#8217;ve created.</em></p>
<p><span id="more-123"></span>The new <a href="http://bespinplugins.mozillalabs.com/">Bespin Plugin Gallery</a> makes it very easy to find useful plugins for Bespin and to share the plugins you&#8217;ve created.</p>
<div id="attachment_124" class="wp-caption aligncenter" style="width: 487px"><a href="http://mozillalabs.com/bespin/files/2010/07/Bespin-Plugin-Gallery.png"><img class="size-full wp-image-124" title="Bespin Plugin Gallery" src="http://mozillalabs.com/bespin/files/2010/07/Bespin-Plugin-Gallery.png" alt="" width="477" height="232" /></a><p class="wp-caption-text">Top lists in the Plugin Gallery</p></div>
<p>By downloading the plugins you need and adding them to the search path in your manifest file, you can easily <a href="https://bespin.mozillalabs.com/docs/embedding/building.html">build a custom Bespin editor</a> with a variety of new features. Need <a href="http://bespinplugins.mozillalabs.com/plugins/5">Python syntax highlighting</a>? <a href="http://bespinplugins.mozillalabs.com/plugins/11">Markdown conversion</a>? <a href="http://bespinplugins.mozillalabs.com/plugins/20">Access to gists</a>? Early testers of the Plugin Gallery have added those plugins already and there is plenty more that is possible with Bespin&#8217;s plugin system.</p>
<p>It&#8217;s easy to share your own plugins&#8230; just upload your .js file (for single file plugins) or zip/tar up your plugin directory (with a package.json file) and your plugin is there for the world to enjoy.</p>
<p>Thanks to <a href="http://ryansnyder.me/">Ryan Snyder</a> who took the lead on building the Plugin Gallery and the rest of Mozilla&#8217;s webdev and QA teams for bringing this site to life!</p>
]]></content:encoded>
			<wfw:commentRss>http://mozillalabs.com/skywriter/2010/07/29/bespin-plugin-gallery-is-now-live/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tutorial: Adding to Bespin&#8217;s GUI</title>
		<link>http://mozillalabs.com/skywriter/2010/07/03/tutorial-adding-to-bespins-gui/</link>
		<comments>http://mozillalabs.com/skywriter/2010/07/03/tutorial-adding-to-bespins-gui/#comments</comments>
		<pubDate>Sat, 03 Jul 2010 15:24:00 +0000</pubDate>
		<dc:creator>kdangoor</dc:creator>
				<category><![CDATA[Bespin]]></category>

		<guid isPermaLink="false">http://mozillalabs.com/bespin/?p=115</guid>
		<description><![CDATA[In this tutorial, we&#8217;ll learn how to add on to Bespin&#8217;s graphical user interface with a new, custom component. Introduction Since Bespin is a webapp, any Bespin command could conceivably pop up some bit of user interface to interact with the user. It’s just a matter of creating some DOM nodes and placing them on [...]]]></description>
			<content:encoded><![CDATA[<p><em>In this tutorial, we&#8217;ll learn how to add on to Bespin&#8217;s graphical user interface with a new, custom component.</em></p>
<p><span id="more-115"></span></p>
<h1>Introduction</h1>
<p>Since Bespin is a webapp, any Bespin command could conceivably pop up some bit of user interface to interact with the user. It’s just a matter of creating some DOM nodes and placing them on the screen.</p>
<p>But, if you want something a bit more persistent and integrated, you’ll need to learn a bit about how Bespin’s GUI is put together. That’s what this tutorial is about.</p>
<p>At the same time, we’re going to talk about how Bespin plugins can themselves be pluggable.</p>
<p>In this tutorial, we assume that you’re already familiar with using dryice and the basics of making plugins. We’re also going to assume a directory structure like the one from the <a href="commands.html">commands tutorial</a>.</p>
<p>By the end of this tutorial, we’ll have something that looks toolbar-like. We’re not trying to create a fully-functional toolbar here, because the focus is on hooking in to Bespin’s GUI.</p>
<p>This tutorial should work with Bespin 0.9a1 or later. However, there is a <strong>bug in Firefox 3.6.x that will cause the toolbar to not display properly</strong>. Bespin 0.9a2 has a workaround for this, and the bug itself is fixed in Firefox versions after 3.6.x.</p>
<h2 id="creating_our_plugin">Creating Our Plugin</h2>
<p>As with the commands tutorial, we’re assuming that you’re working within a directory called <code>bespintutorial</code> that has Bespin itself in a subdirectory called <code>bespin</code>.</p>
<p>In plugins that have user interface elements, you will almost always need to create a “multi file plugin”. That just means we’ll be creating a directory rather than a single .js file.</p>
<p>We’ll create a directory called <code>tutorialtoolbar</code>. To turn it into a plugin, we need to create a file called <code>package.json</code> in the <code>tutorialtoolbar</code> directory.</p>
<p>We also need a dryice manifest so that we can see our plugin in action. Create a file called <code>toolbar.json</code> in the <code>bespintutorial</code> directory. Here’s what we’ll put in it to start with:</p>
<pre><code>{
    "output_dir": "../build",
    "plugins": ["embedded", "tutorialtoolbar"],
    "search_path": [".."]
}
</code>
</pre>
<p>Switch to the <code>bespin</code> directory and run:</p>
<pre><code>python dryice.py -s 8080 ../toolbar.json
</code>
</pre>
<p>You shouldn’t get any errors from dryice. That means that it was able to find our tutorialtoolbar plugin. If you open your browser to http://localhost:8080/, you’ll see a normal looking Bespin. Now we just need to put something in our plugin.</p>
<h2 id="creating_a_simple_view">Creating A Simple View</h2>
<p>For a first step, we’ll just toss a string up on the screen. In the <code>tutorialtoolbar</code> directory, create a new file called <code>index.js</code>. Here’s how our toolbar component will start out:</p>
<pre><code>exports.ToolbarView = function() {
    var elem = document.createElement("div");
    elem.innerHTML = "&lt;b&gt;Toolbar!&lt;/b&gt;";
    this.element = elem;
};
</code>
</pre>
<p>We’re creating a <code>Toolbar</code> class. When a new <code>Toolbar</code> is created, it gets a new element which just has our string in it. We set that to <code>element</code> on the instance. This is the key to GUI components that are integrated into Bespin’s UI: they just offer up an <code>element</code> that Bespin will put in place.</p>
<p>The next step is telling the Bespin system about our new component. We do that in the <code>package.json</code> file, which will now look like this:</p>
<pre><code>{
    "provides": [
        {
            "ep": "factory",
            "name": "tutorialtoolbar",
            "action": "new",
            "pointer": "#ToolbarView"
        }
    ]
}
</code>
</pre>
<p>The factory extension point is used for extensions that provide components for Bespin to automatically instantiate. That may sound kind of vague, but you’ll see in a moment that it’s actually easy to use. The <code>action</code> tells Bespin that it’s going to be creating a new instance and the <code>pointer</code> is telling Bespin to look in the tutorialtoolbar plugin’s <code>index</code> module for something called <code>ToolbarView</code>.</p>
<p>We’ve written code that will generate our initial toolbar and we’ve told Bespin that this is available. The next step is to tell Bespin to put one into the UI. This can be done either in the dryice manifest file or even at runtime when <code>useBespin</code> is called. We’ll do it in the manifest file (<code>toolbar.json</code>). Here’s the new manifest:</p>
<pre><code>{
    "output_dir": "../build",
    "plugins": ["embedded", "tutorialtoolbar"],
    "search_path": [".."],
    "config": {
        "objects": {
            "toolbar": {
                "factory": "tutorialtoolbar"
            }
        },
        "gui": {
            "north": {
                "component": "toolbar"
            }
        }
    }
}
</code>
</pre>
<p>The new section is the <code>config</code> section. This provides the application configuration (about which you can read more in the <a href="../embedding/appconfig.html">Embedder’s Guide</a>).</p>
<p>The <code>objects</code> part of the config is telling Bespin to create a “global” (global within Bespin) object called <code>toolbar</code>. Bespin will look for a factory called <code>tutorialtoolbar</code>, which happens to be what we defined in the <code>package.json</code> file.</p>
<p>The <code>gui</code> part of the config is telling Bespin to toss the component (object) that we created with the name <code>toolbar</code> into the “north” part of the interface. Bespin uses a simple “border layout” with north, south, east, west and center locations. So, our toolbar should appear at the top of the page.</p>
<p>Refresh your browser, and you should see our Toolbar! appear at the top. <em>If it appears at the bottom, you’ve witnessed the bug mentioned in the introduction.</em></p>
<h2 id="css3_flexible_box_model_an_aside">CSS3 Flexible Box Model (an aside)</h2>
<p>CSS3 includes a module called the Flexible Box Model (sometimes called flexbox), which Paul Rouget did a great job of introducing <a href="http://hacks.mozilla.org/2010/04/the-css-3-flexible-box-model/">in this Mozilla Hacks article</a>.</p>
<p>Traditionally, HTML+CSS have been quite nice for laying out documents but not so great for laying out user interfaces. Flexbox makes laying out UI a far easier process.</p>
<p>Bespin uses flexbox to create the border layout. When you declare that a GUI component belongs in the “north”, all Bespin has to do is add the “north” class to the element, and it pops into the right place.</p>
<p>Flexbox would also be a great way to create a toolbar, but we’re not going to go that far in this tutorial.</p>
<p>By using flexbox, we let the browser do all of the layout which is generally faster and smoother than JavaScript-based layouts.</p>
<h2 id="making_our_toolbar_pluggable">Making Our Toolbar Pluggable</h2>
<p>One of Bespin’s main features is that it is customizable and extendable. While it’s certainly possible to make a static toolbar with a certain collection of functions, it’s a lot more interesting to create a toolbar that is itself pluggable. Plus, that’s part of the point of our tutorial.</p>
<p>We’ll start by defining an extension point of our own in <code>package.json</code>. Add this as another item in the <code>provides</code> list in <code>package.json</code>:</p>
<pre><code>{
    "ep": "extensionpoint",
    "name": "tutorialtoolbaritem",
    "description": "Toolbar item views",
    "params": [
        {
            "name": "name",
            "description": "name of this toolbar item",
            "type": "string"
        },
        {
            "name": "pointer",
            "description": "pointer to a component that can be instantiated with new and has an element defined on it."
        }
    ]
}
</code>
</pre>
<p>Extension points themselves are defined via the <code>extensionpoint</code> extension point. Seems a bit circular, but it works. We’re creating an extension point called <code>tutorialtoolbaritem</code>. Bespin is designed to be introspectable, so we provide some documentation about the extension point via the <code>description</code> and <code>params</code> properties.</p>
<p>We’re going to make <code>tutorialtoolbaritem</code>s look a lot like Bespin’s GUI components (an object with an <code>element</code> property).</p>
<p>Now, we need to make our toolbar go out and find the registered <code>tutorialtoolbaritem</code>s. We’ll change <code>index.js</code> to look like this:</p>
<pre><code>var catalog = require("bespin:plugins").catalog;

exports.ToolbarView = function() {
    var elem = document.createElement("menu");
    elem.setAttribute('class', "tutorial-toolbar");
    elem.setAttribute('type', "toolbar");
    this.element = elem;

    this._items = [];

    var extensions = catalog.getExtensions('tutorialtoolbaritem');
    var self = this;
    extensions.forEach(function(ext) {
        ext.load().then(function(item) {
            item = new item();
            self._items.push(item);
            elem.appendChild(item.element);
        });
    });
};
</code>
</pre>
<p>The first thing we’re going to do is change the element we’re creating into an <a href="http://www.w3.org/TR/html5/interactive-elements.html#menus">HTML5 menu element</a>. By giving it a type of <code>toolbar</code>, we’re letting the browser know that we’re creating a toolbar. Right now, the browsers don’t render the toolbar in any special way, but we can use CSS to render the toolbar however we wish.</p>
<p>Next, we’ll make a list to keep track of the items we find. Speaking of finding the items, we need to talk to the plugin catalog about that. In the first line of the file, we imported the catalog. Now, we call getExtensions which will return all of the <code>tutorialtoolbaritem</code>s.</p>
<p>We use <code>var self = this</code> because we’ve got some nested callbacks and that’s a bit nicer to look at than binding each function individually. Then, we loop through the list of extensions and call <code>load</code> on each one.</p>
<p>The <code>load</code> function returns a <em>Promise</em>. Promises provide a convenient way to manage callbacks for asynchronous behavior. For our purposes here, the only difference between a Promise and a normal callback function is that we don’t pass the callback directly to <code>load</code>. Instead, we call <code>then</code> on the promise and pass the callback to that.</p>
<p>Back in our metadata for the <code>tutorialtoolbaritem</code> extension point, we defined the <code>pointer</code> property as a <em>pointer to a component that can be instantiated with new and has an element defined on it.</em> So, when we <code>load</code> the extension, that’s what we’re going to get back. With the tutorialtoolbar item in hand, we can call <code>new</code> on it, add that new instance to our items list and then add the instance’s element to our toolbar.</p>
<p>And, with that, we have created a dynamically extendable toolbar.</p>
<h2 id="adding_some_items">Adding Some Items</h2>
<p>Of course, if we reload our Bespin, the toolbar will be rather boring. We haven’t added any toolbar items!</p>
<p>With the infrastructure that we put in place in the last section, we can create <code>tutorialtoolbaritem</code>s in any plugin. For convenience, we’ll just add a couple of items in the tutorialtoolbar plugin.</p>
<p>We’ll make a new module (file) for them in the <code>tutorialtoolbar</code> directory called <code>items.js</code>. At this stage, we’re not going to make our toolbar items <em>do</em> anything, but we just want to have something to display. Here is our <code>items.js</code> file:</p>
<pre><code>exports.Logo = function() {
    var li = document.createElement('li');
    li.innerHTML = "Logo here";
    this.element = li;
};

exports.OpenFileIndicator = function() {
    var li = document.createElement('li');
    li.innerHTML = "SampleProject &amp;mdash; readme.txt";
    this.element = li;
};

exports.Save = function() {
    var li = document.createElement('li');
    li.innerHTML = "Save";
    this.element = li;
};

exports.PositionIndicator = function() {
    var li = document.createElement('li');
    li.innerHTML = "Row 0, Column 0";
    this.element = li;
};
</code>
</pre>
<p>As you can see, each one of these functions does nothing but create an <code>li</code> element (as per the HTML5 spec for menus) and add that element to the instance on the <code>element</code> property.</p>
<p>One more thing to do before we can see our toolbar. We need to register the extensions for our <code>tutorialtoolbar</code> extension point. Back in <code>package.json</code>, we’re going to add these four more items to our <code>provides</code> property:</p>
<pre><code>{
    "ep": "tutorialtoolbaritem",
    "name": "logo",
    "pointer": "items#Logo"
},
{
    "ep": "tutorialtoolbaritem",
    "name": "openfileindicator",
    "pointer": "items#OpenFileIndicator"
},
{
    "ep": "tutorialtoolbaritem",
    "name": "save",
    "pointer": "items#Save"
},
{
    "ep": "tutorialtoolbaritem",
    "name": "positionindicator",
    "pointer": "items#PositionIndicator"
}
</code>
</pre>
<p>You can see that each one of these refers to the <code>items</code> module in the pointer, since that’s where we put these items.</p>
<p>For reference, here’s the complete <code>package.json</code> file at this stage:</p>
<pre><code>{
    "provides": [
        {
            "ep": "factory",
            "name": "tutorialtoolbar",
            "action": "new",
            "pointer": "#ToolbarView"
        },
        {
            "ep": "extensionpoint",
            "name": "toolbaritem",
            "description": "Toolbar item views",
            "params": [
                {
                    "name": "name",
                    "description": "name of this toolbar item",
                    "type": "string"
                },
                {
                    "name": "pointer",
                    "description": "pointer to a component that can be instantiated with new and has an element defined on it."
                }
            ]
        },
        {
            "ep": "tutorialtoolbaritem",
            "name": "logo",
            "pointer": "items#Logo"
        },
        {
            "ep": "tutorialtoolbaritem",
            "name": "openfileindicator",
            "pointer": "items#OpenFileIndicator"
        },
        {
            "ep": "tutorialtoolbaritem",
            "name": "save",
            "pointer": "items#Save"
        },
        {
            "ep": "tutorialtoolbaritem",
            "name": "positionindicator",
            "pointer": "items#PositionIndicator"
        }
    ]
}
</code>
</pre>
<p>With that, we’ve done everything we need to do to see our toolbar. Let’s reload the page. You should see something that looks like this:</p>
<p><img src="files/2010/07/ToolbarAsList.png" alt="Toolbar displayed as list" /></p>
<p>It worked! It has our items in it! Doesn’t look much like a toolbar, though, does it?</p>
<h2 id="styling_your_plugins">Styling Your Plugins</h2>
<p>To make our toolbar look like a toolbar, we need to add some styles. In order to support themes properly, Bespin uses <a href="http://lesscss.org">LESS</a>, which is an extended CSS syntax.</p>
<p>In the <code>tutorialtoolbar</code> directory, create a <code>resources</code> directory. In there, create a file called <code>toolbar.less</code>. We need to tell Bespin’s theme manager about this file, so we need to add one more thing to the <code>provides</code> property in <code>package.json</code>:</p>
<pre><code>{
    "ep": "themestyles",
    "url": [ "toolbar.less" ]
}
</code>
</pre>
<p><code>themestyles</code> extensions provide URLs (relative to the plugin’s resources directory) to the LESS files that this plugin needs to have loaded. The theme manager will automatically load these files as needed.</p>
<p>And what’s in this mysterious <code>toolbar.less</code> file?</p>
<pre><code>.bespin {
    .tutorial-toolbar {
        display: block;
        background-color: #000;
        border-bottom: solid #424038 1px;
        -moz-box-shadow: 0px 0px 3px 3px #000;
        -webkit-box-shadow: 0px 0px 3px 3px #000;
        color: #ffffff;
        font-family: Helvetica, Arial;
        width: 100%;
        margin: 0px;
        padding: 0px;
    }

    .tutorial-toolbar li {
        display: inline;
        padding: 0px 24px 0px 0px;
    }
}
</code>
</pre>
<p>This looks like fairly normal CSS, right? <em>Except</em> what’s that <code>.bespin</code> doing surrounding those other rules? When LESS expands this out to standard CSS, the result would be something like this:</p>
<pre><code>.bespin .tutorial-toolbar {
}

.bespin .tutorial-toolbar li {
}
</code>
</pre>
<p>So, the surrounding <code>.bespin</code> is a nice little shorthand, and it prevents CSS from leaking out onto the page. When you consider the use of Bespin Embedded on other sites, it’s a good idea to ensure that all of our styles are scoped for use only within Bespin.</p>
<p>With these styles in place, let’s reload the page. Much nicer, eh?</p>
<h2 id="wrapping_up">Wrapping Up</h2>
<p>On the one hand, this tutorial didn’t give us a <em>functioning</em> toolbar. It’s all static text. On the other hand, look at everything we <em>did</em> cover:</p>
<ul>
<li>multi-file plugin structure</li>
<li>creating a component that Bespin can display</li>
<li>the awesomeness that is CSS3’s Flexible Box Model</li>
<li>configuring our component for display in Bespin</li>
<li>defining and using our own extension points</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://mozillalabs.com/skywriter/2010/07/03/tutorial-adding-to-bespins-gui/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Introducing the Bespin Bookmarklet</title>
		<link>http://mozillalabs.com/skywriter/2010/07/02/introducing-the-bespin-bookmarklet/</link>
		<comments>http://mozillalabs.com/skywriter/2010/07/02/introducing-the-bespin-bookmarklet/#comments</comments>
		<pubDate>Fri, 02 Jul 2010 11:30:39 +0000</pubDate>
		<dc:creator>kdangoor</dc:creator>
				<category><![CDATA[Bespin]]></category>
		<category><![CDATA[Release]]></category>

		<guid isPermaLink="false">http://mozillalabs.com/bespin/?p=110</guid>
		<description><![CDATA[The new Bespin Bookmarklet lets you use the Bespin editor to edit code or other text on any page with a textarea. &#8220;Coding in the cloud&#8221; is not a new concept. There are lots of sites that allow people to edit code and other plain text formats directly in their browsers. Unfortunately, a great many [...]]]></description>
			<content:encoded><![CDATA[<p><em>The new Bespin Bookmarklet lets you use the Bespin editor to edit code or other text on any page with a textarea.</em><br />
<span id="more-110"></span></p>
<p>&#8220;Coding in the cloud&#8221; is not a new concept. There are <em>lots</em> of sites that allow people to edit code and other plain text formats directly in their browsers. Unfortunately, a great many of these sites use simple &lt;textarea&gt; elements to do the editing. If you&#8217;re like me, the first time you hit the tab key to indent some code and then end up on another field altogether is the point at which you really wish you had a better editor at that moment.</p>
<p>There are a handful of solutions to that problem, and today we&#8217;re giving you another: the <a href="https://bespin.mozillalabs.com/bookmarklet/">Bespin Bookmarklet</a>. It&#8217;s trivial to install, always up to date and easy to use.</p>
<p>Check out the video below for an example of the bookmarklet in use, or just follow the instructions on the <a href="https://bespin.mozillalabs.com/bookmarklet/">Bespin Bookmarklet page</a>.</p>
<p><object style="height: 344px;width: 425px" width="100" height="100"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://www.youtube.com/v/W0v7pCpIlyk" /><param name="allowfullscreen" value="true" /><embed style="height: 344px;width: 425px" type="application/x-shockwave-flash" width="100" height="100" src="http://www.youtube.com/v/W0v7pCpIlyk"></embed></object></p>
<p><em>– Kevin Dangoor, on behalf of the Bespin Team</em></p>
]]></content:encoded>
			<wfw:commentRss>http://mozillalabs.com/skywriter/2010/07/02/introducing-the-bespin-bookmarklet/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Tutorial: Manipulating Text Through Commands</title>
		<link>http://mozillalabs.com/skywriter/2010/06/30/tutorial-manipulating-text-through-commands/</link>
		<comments>http://mozillalabs.com/skywriter/2010/06/30/tutorial-manipulating-text-through-commands/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 18:06:21 +0000</pubDate>
		<dc:creator>kdangoor</dc:creator>
				<category><![CDATA[Bespin]]></category>

		<guid isPermaLink="false">http://mozillalabs.com/bespin/?p=107</guid>
		<description><![CDATA[In this tutorial, we’ll be creating new commands that allow Bespin to work with Markdown formatted text. For this tutorial, you’ll need the markdown_js plugin. Setting Up With this tutorial, we’re starting from the very basics. You’ll need Python (preferably 2.6) to do custom Bespin plugin development. If you don’t have Python already, you can [...]]]></description>
			<content:encoded><![CDATA[<p><em>In this tutorial, we’ll be creating new commands that allow Bespin to work with <a href="http://daringfireball.net/projects/markdown/">Markdown</a> formatted text.</em></p>
<p><span id="more-107"></span>For this tutorial, <strong>you’ll need the <a href="http://ftp.mozilla.org/pub/mozilla.org/labs/bespin/markdown_js.js">markdown_js plugin</a></strong>.</p>
<h2 id="setting_up">Setting Up</h2>
<p>With this tutorial, we’re starting from the very basics. You’ll need Python (preferably 2.6) to do custom Bespin plugin development. If you don’t have Python already, you can get it <a href="http://python.org/">prebuilt for your platform</a> with little fuss.</p>
<p>You’ll also need Bespin Embedded, which you can get from the <a href="http://ftp.mozilla.org/pub/mozilla.org/labs/bespin/Embedded/">releases directory on ftp.mozilla.org</a>. This tutorial was written for <a href="http://ftp.mozilla.org/pub/mozilla.org/labs/bespin/Embedded/BespinEmbedded-0.9a1.tar.gz">Bespin Embedded 0.9a1</a> (direct download link).</p>
<p><em>Important note</em>: if your copy of Bespin Embedded has a plugins/mine directory, delete that directory before doing this tutorial. That directory was added to the release in error and includes plugins that conflict with the ones needed here.</p>
<p>Make a directory called <code>bespintutorial</code>. Uncompress the BespinEmbedded package in there and rename the directory from the tarfile <code>bespin</code> (so you’ll have <code>bespintutorial/bespin/</code>). On a Mac, you can do these things from the Terminal command line:</p>
<pre><code>mkdir bespintutorial
cd bespintutorial
cp ~/Downloads/BespinEmbedded-VERSION.tar.gz .
tar xzf BespinEmbedded-VERSION.tar.gz
mv BespinEmbedded-VERSION bespin
</code>
</pre>
<h2 id="the_manifest">The Manifest</h2>
<p>Bespin’s build tool, dryice, uses a “manifest” file in JSON format to describe what it needs to build and where to find all of the parts. Open up your text editor to create a file called <code>manifest.json</code> in the <code>bespintutorial</code> directory. Here’s what will go into the file at this step:</p>
<pre><code>{
    "output_dir": "../build",
    "plugins": ["embedded"],
    "search_path": [".."]
}</code>
</pre>
<p>We’ll be running the build from the <code>bespin</code> directory, so those <code>..</code> in the manifest are referring to the <code>bespintutorial</code> directory.</p>
<p>Now, we’ll fire up the dryice server. This command assumes at Python is on your path:</p>
<pre><code>cd bespin
python dryice.py -s 8080 ../manifest.json
</code>
</pre>
<p>After running that command, you can open up your browser to http://localhost:8080/ and you should see the Bespin editor that dryice just built for us.</p>
<p>Next, place the <code>markdown_js.js</code> file which you got at the beginning of this tutorial into the <code>bespintutorial</code> directory.</p>
<h2 id="getting_our_plugin_going">Getting Our Plugin Going</h2>
<p>Now, we’ll create a new file called <code>markdown.js</code>. This is our Bespin plugin file. Bespin plugins all have a metadata section, so let’s put that at the top of our file to get us going:</p>
<pre><code>"define metadata";
({
    "dependencies": {
        "markdown_js": "0.1.2"
    }
});
"end";
</code>
</pre>
<p>So, that’s our whole plugin for now. All we’re saying is that our plugin depends on the <code>markdown_js</code> plugin (version 0.1.2). Now we have to tell dryice about our new plugin, so we’ll add it to the plugins line of our manifest.json file:</p>
<pre><code>"plugins": ["embedded", "markdown"],
</code>
</pre>
<p>You should be able to reload http://localhost:8080/ and have things still work.</p>
<h2 id="making_our_plugin_do_something">Making Our Plugin Do Something</h2>
<p>Since we’re going to be making commands, it would be most convenient for us at this point to have a command line. So, we’ll add the <code>command_line</code> plugin to our manifest.json file:</p>
<pre><code>"plugins": ["embedded", "markdown", "command_line"],
</code>
</pre>
<p>Reload the page in your browser and you should see the command line at the bottom. I also like being able to press cmd-J (ctrl-J on Windows/Linux) to switch between the command line and the editor. The uicommands plugin gives us that, so let’s enable that, too:</p>
<pre><code>"plugins": ["embedded", "markdown", "command_line", "uicommands"],
</code>
</pre>
<p>Now we’re ready to make our first command. We’re going to make a command that:</p>
<ol>
<li>converts the Markdown text we’ve entered to HTML</li>
<li>puts that HTML in a new window so we can preview it.</li>
</ol>
<p>Let’s write a function that does these things.</p>
<pre><code>var env = require('environment').env;
var markdown = require("markdown_js");

exports.preview = function(args, request) {
    var text = env.editor.selectedText;
    if (!text) {
        text = env.editor.value;
    }
    var popup = window.open("", "_blank", "location=no,menubar=no");
    popup.document.body.innerHTML = markdown.toHTML(text);
    request.done();
};
</code>
</pre>
<p>The first two lines import other modules that we’ll be needing. The <code>environment</code> plugin is always available in Bespin, and the <code>env</code> variable inside of there is very handy, as we’ll soon see. We also import the <code>markdown_js</code> module that we declared in our dependencies. We’ll call it <code>markdown</code> when we use it in this module for convenience.</p>
<p>If you’re not familiar with <a href="http://commonjs.org/specs/modules/1.0/">CommonJS Modules</a>, you’ll find that they’re simple to work with. You use the <code>require</code> function to import modules and you put anything you want to be available outside of the module on the <code>exports</code> object. We’re going to make a function called <code>preview</code> available from this module.</p>
<p>Bespin command functions all take two parameters: <code>args</code> and <code>request</code>. <code>args</code> contains the incoming arguments to the command and <code>request</code> provides methods for working with this particular request from the user. Of these, the commands we’ll be making here today only make use of <code>request.done()</code>, which signals that we have finished all of our processing.</p>
<p>Now, let’s focus on the body of the function:</p>
<pre><code>var text = env.editor.selectedText;
if (!text) {
    text = env.editor.value;
}
var popup = window.open("", "_blank", "location=no,menubar=no");
popup.document.body.innerHTML = markdown.toHTML(text);
request.done();
</code>
</pre>
<p>The first line gets us the currently selected text. If the user selected only a portion of the document, we’ll preview that. The next line looks to see if there was any selected text. If there wasn’t, then we just grab all of the text from the editor.</p>
<p>Next, we use the standard window.open call to make a new window. A call to <code>markdown.toHTML</code> will give us the HTML version of our text and we drop that into our new window and we’re all set!</p>
<p>We need to register our new command with Bespin.</p>
<p>Since we’re going to create more than one Markdown related command, we’ll plan to create a top-level <code>markdown</code> command with subcommands. The command we’re working on now is <code>markdown preview</code>. We need to add a new <code>provides</code> section to our JSON metadata. Here’s what that looks like:</p>
<pre><code>"provides": [
    {
        "ep": "command",
        "name": "markdown",
        "description": "commands for working with markdown files"
    },
    {
        "ep": "command",
        "name": "markdown preview",
        "description": "preview the HTML form of this markdown text",
        "pointer": "#preview"
    }
]
</code>
</pre>
<p><code>provides</code> gives a list of extensions that are provided by this plugin. Each of those will have an <code>ep</code> at a minimum. That’s the “extension point” that we’re plugging into. Our first extension is a command and we give the command a name (which is what the user types) and a description that will appear in help text.</p>
<p>The second extension is for our preview command. It has a name and description as well. But, since this command is not just a holder for other commands, it also has a <code>pointer</code>. The <code>pointer</code> tells Bespin where to find the object (in this case, a function) for the extension. <code>#preview</code> is equivalent to <code>markdown:index#preview</code> which means the <code>preview</code> function in the <code>index</code> module in the <code>markdown</code> plugin.</p>
<p>Your complete file should now look like this:</p>
<pre><code>"define metadata";
({
    "dependencies": {
        "markdown_js": "0.1.2"
    },
    "provides": [
        {
            "ep": "command",
            "name": "markdown",
            "description": "commands for working with markdown files"
        },
        {
            "ep": "command",
            "name": "markdown preview",
            "description": "preview the HTML form of this markdown text",
            "pointer": "#preview"
        }
    ]
});
"end";

var env = require('environment').env;
var markdown = require("markdown_js");

exports.preview = function(args, request) {
    var text = env.editor.selectedText;
    if (!text) {
        text = env.editor.value;
    }
    var popup = window.open("", "_blank", "location=no,menubar=no");
    popup.document.body.innerHTML = markdown.toHTML(text);
    request.done();
};
</code>
</pre>
<p>Let’s come up with some sample Markdown to use. How about this:</p>
<pre><code># Markdown Test #

This is a *simple* test of Markdown.

* one
* two
* three
</code>
</pre>
<p>Reload your browser, select all of the text and paste in that text. Then, jump down to the command line and run the <code>markdown preview</code> command. You should see a new window popup with the HTML version of the text there.</p>
<p>Congratulations! You’ve extended Bespin with a new command.</p>
<h2 id="keyboard_shortcut">Keyboard Shortcut</h2>
<p>Previewing the HTML seems like a very useful feature. Why don’t we add a keyboard shortcut so that we don’t need to go to the command line each time. To do this, we just need to add a <code>key</code> to the <code>markdown preview</code> metadata, like so:</p>
<pre><code>{
    "ep": "command",
    "name": "markdown preview",
    "description": "preview the HTML form of this markdown text",
    "key": "ctrl_shift_p",
    "pointer": "#preview"
}
</code>
</pre>
<p>Now, cmd-shift-P on the Mac or ctrl-shift-P on Windows/Linux will run the <code>markdown preview</code> command. This also means that we can run the <code>markdown preview</code> command even if we don’t have the command line plugin in our build.</p>
<p>An aside about keyboard shortcuts: the <code>key</code> defined in command metadata like this is the lowest priority keyboard binding. A keymapping plugin can redefine the keys as can user preferences.</p>
<h2 id="replacing_text">Replacing Text</h2>
<p>One more common requirement of commands is that they need to be able to manipulate the text in some fashion and then put the manipulated version back into the editor.</p>
<p>We’ll make a <code>markdown convert</code> command that converts the text to HTML and then puts the text back into the editor. As before, we’ll start by writing a function that does this conversion and we’ll place it at the bottom of our file:</p>
<pre><code>exports.convert = function(args, request) {
    var allOrSelection = 'selectedText';
    var text = env.editor.selectedText;
    if (!text) {
        allOrSelection = 'value';
        text = env.editor.value;
    }
    var html = markdown.toHTML(text);
    env.editor[allOrSelection] = html;
    request.done();
};
</code>
</pre>
<p>In this function, we’re going to do the same kind of thing we did in the <code>preview</code> function. We’ll work with the user’s selection, if there is one, and the complete text otherwise. In this case, we need to keep track of which it was so that, when we do the replacement, we’re only replacing the text that the user had selected.</p>
<p>Once we’ve gotten our text, we can use <code>markdown.toHTML</code> to do the conversion. Then, we put the text back into the editor (going into either <code>selectedText</code> or <code>value</code>, depending on where the text came from originally).</p>
<p>We need to tell Bespin about our new command, so we’ll add another object to the <code>provides</code> part of our metadata.</p>
<pre><code>{
    "ep": "command",
    "name": "markdown convert",
    "description": "convert the selected text to HTML",
    "pointer": "#convert"
}
</code>
</pre>
<p>Looks just like the <code>markdown preview</code> command, doesn’t it?</p>
<p>Reload the page in your browser, paste in the sample markdown text and then run the <code>markdown convert</code> command. You should see the text converted to HTML. Try converting just a section of the text, and you’ll see that just that portion of the file is modified.</p>
<p>That was easy, wasn’t it?</p>
<h2 id="undo">Undo</h2>
<p>Try converting the Markdown to HTML and then pressing cmd/ctrl-Z.</p>
<h2 id="submitting_to_the_bespin_plugin_gallery">Submitting to the Bespin Plugin Gallery</h2>
<p>Once you’ve completed creating a plugin that you want to share with the rest of the world, you should add a little more to the metadata before uploading your plugin to the Bespin Plugin Gallery. (As of this writing, the Bespin Plugin Gallery has not yet been released&#8230; but it&#8217;s coming soon, so you can follow this section to be ready when it&#8217;s here.)</p>
<p>We’ll add version, license and maintainer information:</p>
<pre><code>"version": "1.0.0",
"maintainers": [
    {
        "name": "Kevin Dangoor",
        "email": "kid@blazingthings.com",
        "web": "http://blueskyonmars.com/"
    }
],
"licenses": [
    {
        "type": "MPL",
        "url": "http://www.mozilla.org/MPL/MPL-1.1.html"
    },
    {
        "type": "GPL",
        "url": "http://creativecommons.org/licenses/GPL/2.0/"
    },
    {
        "type": "LGPL",
        "url": "http://creativecommons.org/licenses/LGPL/2.1/"
    }
]
</code>
</pre>
<p>Bespin Plugin metadata is actually a superset of the <a href="http://wiki.commonjs.org/wiki/Packages/1.0">CommonJS package</a> metadata. As specified there, the version numbers should follow the <a href="http://semver.org/">Semantic Versioning</a> numbering so that useful information about compatibility can be picked up from the version number alone.</p>
<p>I added myself as a maintainer and made this plugin available under the tri-license that Bespin itself is available under.</p>
<p>With all of this metadata in place, the final plugin file looks like this:</p>
<pre><code>"define metadata";
({
    "dependencies": {
        "markdown_js": "0.1.2"
    },
    "provides": [
        {
            "ep": "command",
            "name": "markdown",
            "description": "commands for working with markdown files"
        },
        {
            "ep": "command",
            "name": "markdown preview",
            "description": "preview the HTML form of this markdown text",
            "key": "ctrl_shift_p",
            "pointer": "#preview"
        },
        {
            "ep": "command",
            "name": "markdown convert",
            "description": "convert the selected text to HTML",
            "pointer": "#convert"
        }
    ],
    "version": "1.0.0",
    "maintainers": [
        {
            "name": "Kevin Dangoor",
            "email": "kid@blazingthings.com",
            "web": "http://blueskyonmars.com/"
        }
    ],
    "licenses": [
        {
            "type": "MPL",
            "url": "http://www.mozilla.org/MPL/MPL-1.1.html"
        },
        {
            "type": "GPL",
            "url": "http://creativecommons.org/licenses/GPL/2.0/"
        },
        {
            "type": "LGPL",
            "url": "http://creativecommons.org/licenses/LGPL/2.1/"
        }
    ]
});
"end";

var env = require('environment').env;
var markdown = require("markdown_js");

exports.preview = function(args, request) {
    var text = env.editor.selectedText;
    if (!text) {
        text = env.editor.value;
    }
    var popup = window.open("", "_blank", "location=no,menubar=no");
    popup.document.body.innerHTML = markdown.toHTML(text);
    request.done();
};

exports.convert = function(args, request) {
    var allOrSelection = 'selectedText';
    var text = env.editor.selectedText;
    if (!text) {
        allOrSelection = 'value';
        text = env.editor.value;
    }
    var html = markdown.toHTML(text);
    env.editor[allOrSelection] = html;
    request.done();
};
</code>
</pre>
<p>We can upload this single .js file to the plugin gallery to share it with others. Once we do, we’ll have a change to add images and further description of the plugin if we wish. You can actually add a description to the plugin metadata itself, if you wish.</p>
<h2 id="the_end">The End</h2>
<p>In this tutorial, we created a brand new plugin that leveraged an existing JavaScript library to do useful text transformation in Bespin. Key concepts covered:</p>
<ul>
<li>using dryice server mode to test new plugins</li>
<li>plugin structure and metadata</li>
<li>the mechanics of creating an extension</li>
<li>how to write command extensions</li>
<li>how to manipulate the text in the editor</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://mozillalabs.com/skywriter/2010/06/30/tutorial-manipulating-text-through-commands/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Bespin 0.9a1 released: multiple Bespins, code completion</title>
		<link>http://mozillalabs.com/skywriter/2010/06/29/bespin-0-9a1-released-multiple-bespins-code-completion/</link>
		<comments>http://mozillalabs.com/skywriter/2010/06/29/bespin-0-9a1-released-multiple-bespins-code-completion/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 11:44:03 +0000</pubDate>
		<dc:creator>kdangoor</dc:creator>
				<category><![CDATA[Bespin]]></category>
		<category><![CDATA[Release]]></category>

		<guid isPermaLink="false">http://mozillalabs.com/bespin/?p=99</guid>
		<description><![CDATA[Bespin 0.9a1 features multiple Bespin instances, the start of code completion, simpler packaging and a curious new version number. Multiple Bespins Ever since we released the first Bespin Embedded, we&#8217;ve had requests on and off for the ability to have multiple Bespin editors on the page. When you factor in complexities around the plugin system, [...]]]></description>
			<content:encoded><![CDATA[<p><em>Bespin 0.9a1 features multiple Bespin instances, the start of code completion, simpler packaging and a curious new version number.</em></p>
<h2><span id="more-99"></span>Multiple Bespins</h2>
<p>Ever since we released the first Bespin Embedded, we&#8217;ve had requests on and off for the ability to have multiple Bespin editors on the page. When you factor in complexities around the plugin system, allowing multiple Bespins on a page is non-trivial. But, now multiple editors on the page works fine:</p>
<div id="attachment_100" class="wp-caption aligncenter" style="width: 464px"><a href="http://mozillalabs.com/bespin/files/2010/06/Multiple-Bespins.png"><img class="size-full wp-image-100" title="Multiple Bespins" src="http://mozillalabs.com/bespin/files/2010/06/Multiple-Bespins.png" alt="" width="454" height="664" /></a><p class="wp-caption-text">Multiple Bespins with command lines in white</p></div>
<p>The screenshot above shows off multiple Bespins with two of the new features from Bespin 0.8 (the white theme and the ability to include the command line). A couple of interesting implementation notes: Bespin uses Charles Jolley&#8217;s <a href="http://github.com/sproutit/tiki">Tiki</a> CommonJS module loader, which supports separate &#8220;sandboxes&#8221; of modules. The modules are downloaded from the server once, but each Bespin instance gets its own sandbox. That way, modules that store data in module-global variables will not get confused about which Bespin they&#8217;re working with. Settings and themes are shared between Bespin instances.</p>
<h2>Code Completion</h2>
<p>The other big new feature is one that is available today, but will become easier and smoother to use over time. Bespin can now do code completion, take a look at this screenshot for an example:</p>
<div id="attachment_102" class="wp-caption aligncenter" style="width: 240px"><a href="http://mozillalabs.com/bespin/files/2010/06/Code-Completion-in-Bespin.png"><img class="size-full wp-image-102" title="Code Completion in Bespin" src="http://mozillalabs.com/bespin/files/2010/06/Code-Completion-in-Bespin.png" alt="" width="230" height="187" /></a><p class="wp-caption-text">Code Completion Example</p></div>
<p>As soon as you hit &#8220;.&#8221;, Bespin will try to figure out what is available on the object you&#8217;re accessing. That information is gathered up beforehand in the well-known <a href="http://ctags.sourceforge.net/">ctags</a> format. We&#8217;re using the <a href="http://pcwalton.blogspot.com/2010/05/introducing-jsctags.html">jsctags</a> project (from Bespin team member Patrick Walton) to generate the tags. Using jsctags, we&#8217;ll eventually be generating the tags right in your browser (that&#8217;s the &#8220;easier and smoother&#8221; part that&#8217;s coming in the future).</p>
<h2>Simplification</h2>
<p>Bespin 0.9a1 simplifies two things over 0.8. First, there is now just one downloadable &#8220;Bespin Embedded&#8221; package that combines the features of both the &#8220;Drop In&#8221; and &#8220;Customizable&#8221; packages that we offered in previous releases. You can download this one package and deploy the contents of the &#8220;prebuilt&#8221; directory to your server, and you&#8217;re all ready to go! If you need to go beyond that, you can make sure you have Python installed and customize away.</p>
<p>The second thing we&#8217;ve simplified was the signature of &#8220;command&#8221; functions. A &#8220;command&#8221; in Bespin is basically any action you take in the editor or the command line. In versions prior to 0.9, commands took an &#8220;env&#8221; argument as the first parameter. With 0.9 onward, you should no longer include that parameter and instead just grab the &#8220;env&#8221; variable from the &#8220;environment&#8221; module.  There are more details of this change in the <a href="https://bespin.mozillalabs.com/docs/releases/notes09.html">Bespin 0.9 Release Notes</a>. A new tutorial on making commands is coming today or tomorrow.</p>
<h2>Version Numbering</h2>
<p>To date, every release of Bespin has been an alpha release. With 0.9 (codenamed &#8220;Edison&#8221;), we&#8217;re switching to the kind of release cycles used by stable and mature projects. We&#8217;ll start with a series of alpha releases that are not yet feature complete. Then we&#8217;ll move to beta test releases to work out any kinks before having a final release. 0.9a1 is no more or less &#8220;alpha&#8221; than 0.8 was, but the version number reflects that we&#8217;re heading toward a stable state.</p>
<h2>Download Bespin Now</h2>
<p><a href="http://ftp.mozilla.org/pub/mozilla.org/labs/bespin/Embedded/BespinEmbedded-0.9a1.tar.gz">Download Bespin Embedded 0.9a1</a>. Take a look at the full <a href="https://bespin.mozillalabs.com/docs/releases/notes09.html">0.9 Release Notes</a> for more information about what&#8217;s new.</p>
<p>Stay tuned for more interesting developments in Bespin this week.</p>
<p>– <em>Kevin Dangoor, on behalf of the Bespin team</em></p>
]]></content:encoded>
			<wfw:commentRss>http://mozillalabs.com/skywriter/2010/06/29/bespin-0-9a1-released-multiple-bespins-code-completion/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Bespin 0.8: Less and More</title>
		<link>http://mozillalabs.com/skywriter/2010/06/21/bespin-0-8-less-and-more/</link>
		<comments>http://mozillalabs.com/skywriter/2010/06/21/bespin-0-8-less-and-more/#comments</comments>
		<pubDate>Tue, 22 Jun 2010 06:59:01 +0000</pubDate>
		<dc:creator>kdangoor</dc:creator>
				<category><![CDATA[Bespin]]></category>
		<category><![CDATA[Release]]></category>

		<guid isPermaLink="false">http://mozillalabs.com/bespin/?p=86</guid>
		<description><![CDATA[Bespin 0.8, codenamed &#8220;Cheviot&#8221;, 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 &#8220;Embedded&#8221; packaging last November. We&#8217;ve got a bunch of new features and infrastructure, and new plans for the Bespin server. Read on to find [...]]]></description>
			<content:encoded><![CDATA[<p><em>Bespin 0.8, codenamed &#8220;Cheviot&#8221;, 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 &#8220;Embedded&#8221; packaging last November. We&#8217;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.</em></p>
<h2><span id="more-86"></span></h2>
<h2>A Quick Demo</h2>
<p>There&#8217;s a bit more information in the blog post below, but there&#8217;s more action in the video. Check it out:</p>
<p><object width="560" height="340"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube-nocookie.com/v/zflUo_d-M9A&amp;hl=en_US&amp;fs=1&amp;hd=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="560" height="340" src="http://www.youtube-nocookie.com/v/zflUo_d-M9A&amp;hl=en_US&amp;fs=1&amp;hd=1"></embed></object></p>
<h2>Less</h2>
<p>There are three features that make Bespin 0.8 &#8220;less&#8221; than 0.7.</p>
<p>First, <strong>Bespin Embedded 0.8 minified is now less than half the size of the 0.7.3 release</strong>. The <a href="http://ftp.mozilla.org/pub/mozilla.org/labs/bespin/Embedded/BespinEmbedded-DropIn-0.8.0.tar.gz">&#8220;Drop In&#8221; release</a> 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&#8217;re quite happy with its new, slimmer size. One more bonus with respect to Bespin&#8217;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.</p>
<p>Second, Bespin 0.8 includes a new theme capability that allows you to <strong>radically change the appearance through a simple plugin</strong>. <a href="https://bespin.mozillalabs.com/docs/pluginguide/theme.html">Bespin&#8217;s themes</a> 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 <strong>uses the new <a href="http://fadeyev.net/2010/06/19/lessjs-will-obsolete-css/">LESS.js</a></strong> 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 &#8220;white&#8221; theme. LESS also provides a very convenient syntax that ensures that Bespin plugins won&#8217;t leak the CSS rules onto the page.</p>
<p>Speaking of leaking onto the page, Bespin 0.8 <strong>exposes only the variable &#8220;bespin&#8221; to your page</strong>. And there is no more manipulation of built-in object prototypes.</p>
<h2>More</h2>
<p>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: <strong>you can now embed Bespin&#8217;s spiffy command line in custom Embedded builds</strong>. And it&#8217;s easier to do than you&#8217;d expect. Just add the &#8220;command_line&#8221; plugin to your manifest file, rebuild and you&#8217;ll see the command line there.</p>
<div id="attachment_89" class="wp-caption aligncenter" style="width: 537px"><a href="http://mozillalabs.com/bespin/files/2010/06/Bespin-0.8-with-command-line-in-white.png"><img class="size-full wp-image-89" title="Bespin 0.8 with command line in white" src="http://mozillalabs.com/bespin/files/2010/06/Bespin-0.8-with-command-line-in-white.png" alt="" width="527" height="529" /></a><p class="wp-caption-text">Bespin 0.8 with command line in white</p></div>
<p>We&#8217;re able to do this now because of a new <a href="https://bespin.mozillalabs.com/docs/embedding/appconfig.html">&#8220;application configuration&#8221;</a> 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!)</p>
<p>Speaking of servers, <strong>our dryice build tool</strong>, which is responsible for creating embeddable Bespins, <strong>now includes a little server</strong>. Fire it up, and on each page load it will rebuild your Bespin. It&#8217;s the easiest way to try out different plugins and configurations.</p>
<p>One more oft-requested feature that has now landed in 0.8 is <strong>the ability to replace a &lt;textarea&gt; with Bespin</strong>. 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.</p>
<p>We&#8217;ve added <strong>CSS syntax highlighting</strong>, and all of our <strong>highlighters now run in Web Workers</strong>. By running the highlighters in workers, we get better performance and open the door to add interesting new features in future releases.</p>
<p>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.</p>
<h2>For Plugin Authors</h2>
<p>We&#8217;ve got a new, <strong>client-side <a href="https://bespin.mozillalabs.com/docs/pluginguide/template.html">template engine</a></strong> that makes it easy to generate your user interfaces.</p>
<p>If you&#8217;re writing editor commands, you now have access to the same <a href="https://bespin.mozillalabs.com/docs/pluginguide/editorapi.html"><strong>convenient APIs</strong></a> that Embedded users had before. It&#8217;s simple to get the selected text, manipulate it and replace it.</p>
<p>We&#8217;ve added a <strong>Growl-like notification system</strong> to Bespin, making it easy for plugin authors to get the user&#8217;s attention and easy for the user to choose which kind of notifications they want to see.</p>
<p>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 <a href="mailto:kdangoor@mozilla.com">email me</a> so that you can be added to the initial Bespin Plugin Gallery.</p>
<h2>Bespin Server News</h2>
<p>During the past few weeks, we&#8217;ve figured out where we&#8217;re going with the Bespin Server. Given that I&#8217;ve written at length about this in other places, I&#8217;ll just give the short form here. If you&#8217;re interested in the full story, <a href="https://bespin.mozillalabs.com/docs/userguide/server_roadmap.html">you can read about it here</a>.</p>
<p>The short form is this: software developers work on all kinds of different projects. For Bespin to support &#8220;coding in the cloud&#8221; for that variety of projects, we need a server that&#8217;s as customizable as our editor is. So, <strong>we&#8217;re going to rewrite the server in JavaScript and leverage the same plugin system we use on the client</strong>. We&#8217;re going to couple that with ways to get that server running easily, so that everyone can run their own Bespin server.</p>
<p>bespin.mozillalabs.com has never been a &#8220;production-level&#8221; service. In the future, it will be used to demonstrate Bespin features, but will be <em>even less</em> production-level than it is today. We&#8217;ve added the &#8220;export&#8221; command so that you can <strong>get your projects off of the bespin.mozillalabs.com server</strong>, if you have any data there that you care about.</p>
<p>As a stepping stone to the new server, we&#8217;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.</p>
<p>Bespin 0.8 does add a much-requested server-related feature: <strong>working directories</strong>. The combination of using &#8220;cd&#8221; to get to a specific spot in the filesystem and &#8220;open&#8221; with its awesome file searching abilities is a really productive way to navigate between files.</p>
<h2>Getting Involved</h2>
<p>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 <strong>create plugins</strong>. <strong>Syntax highlighters, themes, commands and keymappings</strong> are all straightforward to create.</p>
<p>Bespin is now ready to add <strong>more user interface components</strong>. 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.</p>
<p>And, of course, there&#8217;s <strong>more to be done in the core editor</strong>. Things like TextMate-style snippets (which are fantastic!) and rectangular selection are good bets if you&#8217;re looking for a bit of a challenge. And we&#8217;re always looking to improve the performance, so profiling and optimization help is ever welcome.</p>
<p>The <strong>desktop and server</strong> tooling is just about to get started.  We&#8217;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&#8217;re feeling  adventurous.</p>
<h2>Release Notes and Download</h2>
<p>You can download Bespin Embedded releases from <a href="http://ftp.mozilla.org/pub/mozilla.org/labs/bespin/Embedded/">http://ftp.mozilla.org/pub/mozilla.org/labs/bespin/Embedded/</a></p>
<p>The complete <a href="https://bespin.mozillalabs.com/docs/releases/notes08.html">Bespin 0.8 release notes</a> are available as part of the official documentation.</p>
<p>Enjoy the new release!</p>
<p>– <em>Kevin Dangoor, on behalf of the Bespin project team</em></p>
]]></content:encoded>
			<wfw:commentRss>http://mozillalabs.com/skywriter/2010/06/21/bespin-0-8-less-and-more/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Bespin 0.7.3 released: usability improvements, docs and fixes</title>
		<link>http://mozillalabs.com/skywriter/2010/04/29/bespin-0-7-3-released-usability-improvements-docs-and-fixes/</link>
		<comments>http://mozillalabs.com/skywriter/2010/04/29/bespin-0-7-3-released-usability-improvements-docs-and-fixes/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 18:16:20 +0000</pubDate>
		<dc:creator>kdangoor</dc:creator>
				<category><![CDATA[Bespin]]></category>
		<category><![CDATA[Release]]></category>

		<guid isPermaLink="false">http://mozillalabs.com/bespin/?p=73</guid>
		<description><![CDATA[The Bespin team has just released Bespin 0.7.3, a minor update to the Bespin server and Bespin Embedded packages. We&#8217;ve made a whole bunch of improvements since the release of 0.7.2. From a day-to-day usability perspective, my favorite new feature in Bespin 0.7.3 is the new file completion for the &#8220;open&#8221; command (which, incidentally, is [...]]]></description>
			<content:encoded><![CDATA[<p><em>The Bespin team has just released Bespin 0.7.3, a minor update to the Bespin server and Bespin Embedded packages. We&#8217;ve made a whole bunch of improvements since the release of 0.7.2.</em></p>
<p><span id="more-73"></span>From a day-to-day usability perspective, my favorite new feature in Bespin 0.7.3 is the new file completion for the &#8220;open&#8221; command (which, incidentally, is now available via cmd-O/ctrl-O). Take a look at the screen shot below:</p>
<p><img class="aligncenter size-full wp-image-80" title="Bespin File Completion2" src="http://mozillalabs.com/bespin/files/2010/04/Bespin-File-Completion2.png" alt="" width="642" height="92" /></p>
<p>After typing &#8220;open pldev/com&#8221;, you can see that Bespin found two files that match: commands.js in the &#8220;plugindev&#8221; directory and commands.js in the &#8220;bespin_server&#8221; directory. Those two match because those letters that I typed can be found in that order in both names. The one in plugindev (which is the one I was looking for) was a better match, so it appears at the top. You can see that in faint letters Bespin is showing the full path for the top hit. This is what I get if I hit &lt;tab&gt;. Also convenient is that I can press &lt;alt-2&gt; to select the second match in the list from the keyboard. I could also click on one of the choices with the mouse. Joe put in a good deal of work to make this slick and usable, and I expect we&#8217;ll be adding a lot more useful completions to the command line over time.</p>
<p>With this release, we&#8217;ve knocked off 3 of the items requested via our <a href="http://bit.ly/bespin-feedback">feedback forum</a> (thanks for submitting and voting on the items there!). The preview command is back, you can now log in using your email address (assuming you only have 1 account associated with that address). The &#8220;I forgot my password&#8221; feature also returns in this release. Thanks to Julian and Patrick for a bunch of fixes in 0.7.3.</p>
<p><strong>Plugins</strong></p>
<p>Plugin development has also gotten easier, with the addition of the &#8220;ep&#8221; and &#8220;plugin info&#8221; commands. These commands provide you with a bunch of information about what&#8217;s available in Bespin.</p>
<p>On the topic of plugins, the first plugin has landed in the plugin gallery! It&#8217;s an experimental PHP syntax highlighter by Scott Teglasi. You can install it by running &#8220;plugin install php&#8221;. You can also download it from <a href="https://bespin.mozillalabs.com/plugin/download/php/current/">https://bespin.mozillalabs.com/plugin/download/php/current/</a>. Thanks, Scott!</p>
<p>Add to this a bunch of bug fixes, and I think we&#8217;ve got a nice, but minor, update for you.  We&#8217;re planning for a meatier release for our next one (codenamed &#8220;Cheviot&#8221;).</p>
<p><strong>Docs</strong></p>
<p>The <a href="http://wiki.mozilla.org/Bespin">Bespin wiki</a> was <em>very</em> out of date. I salvaged what I could, and moved more docs into our Mercurial repository. Those docs are visible at <a href="https://bespin.mozillalabs.com/docs/">https://bespin.mozillalabs.com/docs/</a>. A generic wiki is really a bad tool for software documentation, so we&#8217;ll be sticking with having the main docs in Mercurial for the time being.</p>
<p><strong>Embedded</strong></p>
<p>Bespin 0.7.3 has goodies for Bespin Embedded users as well. In addition to the general fixes made, there are now a bunch of new methods available on the bespin object for working with the text that the user is editing. These are documented in the <a href="https://bespin.mozillalabs.com/docs/embedding/index.html">Embedders&#8217; Guide</a>.</p>
<p>Pick up the latest Bespin Embedded release in its usual home: <a href="http://ftp.mozilla.org/pub/mozilla.org/labs/bespin/Embedded/">http://ftp.mozilla.org/pub/mozilla.org/labs/bespin/Embedded/</a></p>
<p>Thanks for all of the feedback and activity! Between now and the &#8220;Cheviot&#8221; release of Bespin, keep an eye on this space for some new tutorials.</p>
<p>(This article has been changed to reflect the codename of &#8220;Cheviot&#8221; for the next release of Bespin.)</p>
<p>– <em>Kevin Dangoor, on behalf of the Bespin team</em></p>
]]></content:encoded>
			<wfw:commentRss>http://mozillalabs.com/skywriter/2010/04/29/bespin-0-7-3-released-usability-improvements-docs-and-fixes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

