Switch language / syntax mode of current document

This is an update of @JakeStoeffler's PR #4276.  It's merged up with the latest master and addresses the main code review comments I made there.  I also added some simple unit tests.

I still have two concerns about merging this immediately, though:

**1)** The dropdown UI doesn't look great. It uses a native `<select>`, which is just hard to style... and the way the statusbar is laid out makes it look misaligned in this case:
![language picker](https://f.cloud.github.com/assets/1197510/1867075/419e3564-7847-11e3-85ec-1e33455f62bf.png)

It would look nicer if we used an HTML popup like code hints, context menus, and the Recent Projects dropdown... but it would definitely add a bunch more work here.  So maybe we can skate by with the current `<select>`-based UI for now.  @larz0, any thoughts?

**2)** This foregrounds all the bugs in #2911 a lot more.  I added a checklist of issues there.  Are there any that are prominent enough to act as blockers here?  (JS code hints seems like it might be the most glaring issue, but unfortunately that's one of the harder ones to fix too).
I don't think that calling .on() could ever synchronously trigger the handler that was just attached, so it seems like the old location of that block (where `_currentDocument` is set just _after_ calling .on()) should function exactly the same as the current location (where it's set just _before_ calling .on()).  But I'm fine with it in either location.