This change fixes the issue where notebook being saved is sent to Jupyter with
`Content-Type: application/x-www-form-urlencoded`, because the default value of
this header (`application/json`) gets wiped out in `ein:query-prepare-header`.
The above issue becomes more apparent when notebook contains non-ascii
characters - in such case Jupyter logs a warning: `Invalid x-www-form-urlencoded
body: 'latin-1' codec can't encode characters in position XXX: ordinal not in
range(256)`.
This fixes the `ein:object-at-point' function so it works in `subword-mode'.
Original issue here:
https://github.com/millejoh/emacs-ipython-notebook/issues/313
-------------------------------------------------------------------------
When `subword-mode` is enabled, the `(ein:object-at-point)` function fails after dots. For example, let's say `|` is the cursor and `subword-mode` is enabled:
Calling `(ein:object-at-point)` on this: `tf|` returns `"tf"`. This is correct.
Calling `(ein:object-at-point)` on this: `tf.|` returns `nil`. It should return `"tf."`.
Calling `(ein:object-at-point)` on this: `tf.nn|` returns `nil`. It should return `"tf.nn"`.
One side effect of this is that `company-mode` suggestions stop working after dots in `subword-mode`. For example:
```
import tensorflow as tf
tf.n|
```
Will not provide suggestions from the ein completion engine.
I tried changing the `(ein:object-at-point)` function to return the *symbol* at point, rather than the word, and this fixed the problem. Would this produce any undesirable side effects? If not, I can submit a pull request.
New hooks `ein:pre-kernel-execute-functions', `ein:on-execute-reply-functions'
and `ein:on-shell-reply-functions'. See variable documentation for more
information.
Similar to having an input area face, we now have faces for errors &
normal output in the output area. They're currently empty to preserve
existing appearance.
(ein:notebooklist-sort-field): New custom var, replaces `ein:%item-sort-param%'.
(ein:notebooklist-sort-order): New custom var, replaces `ein:%item-sort-order%'.
(ein:make-sorting-widget): New macro.
(ein:nblist--sort-group): Fix the meaning of :ascending & :descending.
(render-directory): Use `ein:make-sorting-widget' to define widgets;
use the new custom vars instead of the internal %% vars.
Not much of a UI at the moment, but notebooklist entries can now be sorted
either by name or by date last modified. Jupyter does not provide size
of each item, that I can see (for the moment), so currently not possible to sort
by that parameter.
Defer the deferred...
A bit less cryptically - wrap call to ein:shared-output-eval-string in a
deferred construct to ensure proper sequential execution of autoexec cells.
Try to gracefully handle multiple calls to `ein:shared-output-eval-string' by
wrapping calls to deferred:$. The deferred chain will not call
`ein:cell-execute' if the cell is already running.
Also did a bit of refactoring in ob-ein.