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.
User can now ask ein to truncate long outputs in a worksheet. Use the
customizable variable `ein:truncate-long-cell-output' to control this behavior.
Set to nil to have no truncation, otherwise an integer value specifying the
number of lines to keep before truncating.
Loading large notebooks (>1M) can be slow. At least some of this is due to
downloading from the jupyter server, but this operation is asynchronous and
should not block emacs. My suspicion is that when Emacs blocks it is when it is
generating the internal data structures used to represent the notebook in emacs.
This is somewhat unavoidable, but part of the slow down may be due to reaching
the cons threshold. These changes try to temporarily increase the cons threshold
while loading the notebook. We'll see if it helps at all.
In tracebacks, we detect if ein is connected to a remote host, and if so try to
create a TRAMP friendly path when jumping to files from a traceback.
In response to #263.
Passing "default" to `ein:get-kernelspec' would cause it to return a string
naming the actual kernelspec, which just won't do. So we look for that case and
then look for the real kernelspec.
Inspired by @khinsen's ob-ipython-async, automatically generate filenames for
inline images. That is, make :image an optional argument for ein source blocks
in org.
EIN historically used a call to python getcwd and gethostname to get information
about the currently running kernel. This won't work with non-python kernels, so
I this is an initial attempt to abstract out the call and make it language
agnostic. Still only works in Python, but at least should not cause errors with
other languages.
(ein:narrow-to-cell, ein:python-indent-line-function)
(ein:python-indent-region): New functions.
(ein:ml-lang-setup-python): Set
`indent-line-function` to `ein:python-indent-line-function` and
`indent-region-function` to `ein:python-indent-region`.
Full undo support, including undoing cell actions, is still unstable and can
cause corruption of worksheet data so I am making this an optional feature. See
the variable `ein:worksheet-enable-undo', which by default will be set to nil.
Force a query of available kernelspecs when calling `ein:notebooklist-open'.
Idea is to catch when user installs a new kernelspecs while ein is active.
No default keybinding, but one can now call `ein:tb-show' from an org
buffer using ein source code blocks when one of the blocks generates a
traceback.
EIN should properly handle indentation in the worksheet as it once did long ago.
Issues was that python mode no longer uses the global variables
`python-ident-levels' for tracking ident. Now we advise around
`python-indent--calculate-indentation'. This is an internal function so may not
be the best call, but it works.
If it breaks maybe take a look at advising `python-ident-calculate-indentation'.
Instead of always prompting the user for the path to the jupyter
executable, it will try to use the value of `*ein:last-jupyter-command*' or
the value of the customizable variable `ein:jupyter-default-server-command'
when the `ein:jupyter-server-start` command is called without C-u prefix arg.
As well as going to a non-deferred implementation for
`ein:notebooklist-change-url-port' the code now properly restarts the nb kernel
when changing the server the notebook is running on.
Also a small change to the formatting of the notebooklist buffer.