Better handling of `__file__` when running scripts.

* Set `__file__` when running `ipython filename.ipy`
* Avoid leaking `__file__` back into the main namespace when using `%run`.
Add test for `__file__` behavior in `%run`.
Add test for `__file__` behavior in `ipython <file>`
Fix units / res args for *png* plotting device.

Update the `units` argument so that it accepts values from ["px", "in",
"cm", "mm"].

The `res` argument was added for the cases where `units` is specified
and is not default (px). A default value of 72 is provided by rmagic in
the case that `units` is not "px" but `res` is not specified.
shift tqb for tooltip
Encode output that is sent to the pager.
Following #2737 this error is now a name error
Add note to `%cython` Black-Scholes example warning of missing erf.
Merge pull request #2740 from jenshnielsen/rnameerror

Fix tests for rmagic (KeyError -> NameError).

Caused by #2737.
Address comments in the PR.
BUG: Octavemagic inline plots not working on Windows: Fixed
Don't show 'try %paste' message while using magics

Fixes #1661.
Merge pull request #2743 from blink1073/octave-plot-bug

BUG: Octavemagic inline plots not working on Windows: Fixed
Merge pull request #2741 from bfroehle/cython_example_erf_missing

Add note to `%cython` Black-Scholes example warning of missing erf.
Merge pull request #2728 from Carreau/shifttab

also bind shift tab for tooltip + config

This does not change the curent behavior, only add the shift+tab shortcut.

Note that the shift tab shortcut has a slightly different behavior. You can select part of a line and pressing shift-tab will show you the tooltip only for the selection.

This is disabled for multiline selection to still allow to unindent block of code, Keep in mind that the real real shortcut for indent unindent is Ctrl+] or [ . Select/tab is not really supported by codemirror.

Finally the "tooltip_on_tab" behavior is globally configurable via IPython.config so that it could be easily switched to false.

It can be overridden via js console for test purpose.

IPython.config.tooltip_on_tab = true | false
Take effect immediately, only on current notebook.

or globally via custom.js

var user_conf = {tooltip_on_tab:false | true};
$.extend(IPython.config, user_conf)
Minor updates to reflect comments
fixed variable name change
added test_paste_magics_message
Added try/finally block to set using_paste_magics
Added test for TerminalMagics