move safe_unicode to py3compat
user_variables and user_expressions use rich repr API

each key will be a rich display_data message rather than plaintext reprs.
test user_variables/expressions in message spec
add user-expressions/variables changes to message spec
Fix IPython.utils.path when HOME=/.
Fix subrepos.
Pop out any existing IPYTHONDIR or IPYTHON_DIR variables.
update qtconsole with user_expressions changes

lsmagic now uses JSON, rather than ast eval
use sets when testing user expressions

avoids ordering issues
s/os.path.split/os.path.dirname/
%lsmagic returns a RichRepr of the magics dict

- pretty / str representation are the regular lsmagic output
- JSON repr is just the magics dict with instances replaced with their class names in order to be jsonable.

qt magics menu population updated to reflect this.
workaround spurious CodeMirror scrollbars

always draw scrollbar margin, so that inappropriate scrollbars never overlap the last line.
To compensate for the extra space, the margin between the scrollbar and the last line is shrunk significantly.
Failing test for gh-3246
Use new input transformation API in %paste

Closes gh-3246
Refactor paste magics and ipdoctest
Inject requirejs in notebook and start using it.
remove long-dead zmq frontend.py and completer.py

These were really just demos to begin with, and should never have been included as library code.

closes #3365
Use different threshold for (auto)scroll in output

Allow, in particular to switch to scolling for longer input (or disable
it) by still keeping the possibility to manually toggle the output to
scroll.
normalize unicode notebook filenames

used in comparison check for notebook name change.

Unless the filenames are normalized,
unchanged names may result in false positives for a name change
(e.g. OS X uses NFD on the filesystem,
so u'\xfc' roundtripped to the filesystem will be u'u\u0308'),
which can result in the first save of a notebook after open performing the following actions:

1. save the recently opened notebook
2. `old_name != new_name`, so name change detected
3. delete old_name (which is actually new_name), which ultimately deletes the just-saved notebook

In master, this has a symptom of the first checkpoint failing because the first save actually deleted the file, and you can't checkpoint a notebook that doesn't exist.

closes #3360
improve js documentation