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.
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
add is_typing utility

simple, liberal check for whether a keypress is probably typing or not.
setting the notebook dirty flag is now an event

set_dirty.Notebook
rename scroll_threshold, add minimum_ prefix
base default cookie name on request host+port

instead of random.

The random cookie name meant that every time you restarted the notebook it would get a new key in the cookie for the same host, resulting in an ever-growing cookie full of obsolete data.