Commit graph

148 commits

Author SHA1 Message Date
dickmao
a0943af912 ecukes clear kernel connect message 2020-03-14 00:43:19 -04:00
John Miller
28b9f46215 Run custom hooks after a kernel connection is made.
Introduce new user custom variable `ein:on-kernel-connect-functions' which is an
abnormal hook called after a kernel connection is made. All functions in the
hook are called with the connected kernel as an argument.

This replaces the old, unused `ein:kernel-run-after-start-hook' function.
2020-03-01 16:30:35 -07:00
dickmao
54cb27701f remove longstanding recursive requires workaround 2020-02-29 22:35:49 -05:00
dickmao
0cb185dde6 avoid reloading notebooklist three times on "Stop" 2020-02-01 21:07:42 -05:00
dickmao
f4d6d4e9a8 remove pytools cruft, only print polymode-mode-name-aliases warning once 2020-01-23 11:25:27 -05:00
dickmao
cab8ed28fa avoid npe 2020-01-19 09:15:05 -05:00
dickmao
388a74a14b reload notebooklist on C-c C-q 2020-01-19 09:03:51 -05:00
dickmao
ba530cfa95 before embedding notebooklist reloader into ein:notebook-open 2020-01-13 11:38:21 -05:00
dickmao
6ea920dd0f notebooklist delete 2020-01-12 23:01:26 -05:00
dickmao
702f04064a :image/png not :png 2020-01-11 16:03:54 -05:00
dickmao
8a545c508b close notebook on delete 2020-01-10 23:58:51 -05:00
dickmao
f7180405d6 makes test 2020-01-02 20:09:42 -05:00
dickmao
e12a33588d replace ein:aif with aif 2019-11-24 00:17:52 -05:00
dickmao
d0d13c8277 get 25.1 to compile 2019-11-13 17:46:50 -05:00
dickmao
49a1c54b00 compile properly (very suspect :mode slot misspecifications in poly-ein) 2019-11-13 13:54:29 -05:00
Federico Beffa
1cab86995a ein:kernel-complete: use ':code' instead of ':line' for api-version 4. 2019-05-29 18:34:09 +02:00
dickmao
1da03d69f6 Stop bug, Image bug
Initial SIGTERM prompts server to dutifully shutdown kernel, but
another SIGTERM necessary to kill server.  Perhaps ipython changed
since the last time I tested this.

Ipython doesn't send a display_data message upon initial plot
request.  This is probably our bug, or is it?  Document this bug in an
ecukes test.

Also enforce emacs version >= 25
2019-04-29 13:15:53 -04:00
dickmao
234cf391f9 Polymode
M-x customize-group RET ein
Toggle Ein:Polymode

Avoid trying to emulate jump-to-definition, eldoc, and autocompletion
functionalities that Elpy will always do better.

Fixes #497 #482 #418
2019-04-02 09:35:17 -04:00
dickmao
dd01c4578c reconnect kernel if necessary under org-ctrl-c-ctrl-c
when `C-c C-c`, reconnect to kernel if it disconnected
2019-02-26 17:58:42 -05:00
Sam Steingold
5ee7ae7d6b last patch was too aggressive 2019-01-16 18:23:39 -05:00
Sam Steingold
48fa153435 Use standard functionality instead of ad hoc functions
(ein:filter identity ...) ---> (delete nil ...)
ein:filter --> seq-filter
hash-vals --> hash-table-values
hash-keys --> hash-table-keys
2019-01-15 11:26:09 -05:00
dickmao
129afa5fb4 Respect cursor_start and cursor_end in matches
The :cursor_start and :cursor_end fields tell us whether we need to
prepend the prefix ourselves.

Fixes #436
2018-12-28 21:14:11 -05:00
dickmao
3c18cda125 reverse hunks 2018-12-11 08:48:40 -05:00
dickmao
bead667ee0 Clean up multilang
Do not assume python... leverage ESS to improve R interaction.
Fix both undo and fontify in the presence of toggling cells (`C-c
C-t`)
Fix and test switching kernels
2018-12-08 21:25:48 -05:00
dickmao
f0984eab55 jupyterhub basic (PAM only)
`ein:login` or `ein:notebooklist-login` is the preferred way to access
jupyterhub, although `ein:jupyterhub-connect` is still autoloaded.
2018-12-04 18:31:44 -05:00
John Miller
e280bb8633 ein-company: Add completion caching, make caching kernel specific. 2018-11-22 09:07:02 -07:00
dickmao
6ca6752319 C-c C-q improved visual feedback
As `ein:notebok-kill-kernel-then-close-cmmand` must wait for the
server to delete the session, the buffer wouldn't disappear right
away, leaving the user nonplussed whether the `C-c C-q` took.  Display
a status message "Ending session" with a modest animation instead.

Also add a "Stop" test for notebooklist.  Sorry about breaking "Stop"
in ee3b0f0
2018-11-10 00:09:44 -05:00
John Miller
6f19d8bf83 Correct typos, make some code more succinct.
Let this be a lesson kids - never program while under the influence of
power antihistamines...
2018-11-09 18:53:40 -06:00
John Miller
573b745509 Reintroduce proper behavior for kernel stop from nblist buffer.
Once upon a time it was possible to stop/delete/kill running kernels from the
notebooklist buffer regardless of whether there were any open notebooks
associated with the kernel session.

Some commmits ago this behavior was changed, and the code has recently required
that there a notebook buffer associated with the active kernel/session exist
before the stop command will proceed. This is incorrect behavior and is
inconsistent with the interface provided by the notebook web browser interface.
Kernels and notebooks are independent entities and should be treated as such in
the code.
2018-11-09 18:27:23 -06:00
dickmao
84fa177a1e When I C-c C-c also C-c C-r if necessary
If user wants to execute cell, and the connection is down,
automatically reconnect, then execute the cell.
2018-11-06 18:36:46 -05:00
dickmao
d7985ffc6b sometimes travis finds bugs 2018-11-04 21:38:20 -06:00
dickmao
7d31fe7f34 fix the osx testing bug 2018-11-04 21:38:20 -06:00
dickmao
ee3b0f095c Follow-up to cleaning up websockets
Renaming of functions with better understanding of reconnects.  Under
the original logic, reconnecting blithely created a new session if
the original no longer existed.  Now it will alert the user when this
happens.

Also hopefully fixes #381 as there was a bug of missing argument not
being caught by lisp's undisciplined typing.
2018-11-04 21:38:20 -06:00
John Miller
85d80f4394 Merge branch 'fix-oinfo-errors' 2018-11-02 16:16:39 -05:00
dickmao
5023b0796b Reconnect is not restart #377
Upon disconnection, the jupyter server apparently returns the same kernel for a given
notebook path input.  So reconnect is a thing, and restart is very
distinct from that.

Fixes #377
2018-11-02 11:32:12 -04:00
John Miller
db310073c4 Robustly build oinfo cache.
EIN tries to build a cached of pdef's for all potential completion symbols. This
is problematic because not all completion symbols have a pdef and can cause
python to throw exceptions in entertaining and hard to catch ways. We take a
liberal approach and ignore anything that throws an exception when we try to
inspect it.

Eldoc support should also be more robust because of these changes as well.
2018-11-01 20:26:42 -05:00
dickmao
db2856f445 Restart if kernel still alive needs to work 2018-11-01 20:08:10 -04:00
dickmao
d621944797 Clean up websocket callbacks
Coursera appears to kill websockets every minute or so, and I'm
observing firsthand the buggy behaviors described in #356.  This PR
cleans up the websocket code and kernel restart logic.  Removed
backwards compatibility for the v2 messaging api
as keeping it in the presence of the refactoring would make it more
broken that it already was.
2018-10-31 23:38:45 -04:00
dickmao
b950bd3a4c Fix "Kernel is busy..." bug
One line change to fix header not updating after cell execution
(keeps saying "Kernel is busy").

The bug does not manifest when running with `ein:debug` true since
EMACS's display loop updates more frequently with debug messages.

In tracking this bug, noticed eldoc support isn't quite there.
`__import__('ein').print_object_info_for(%s)` appears in
`ein-completer` and `ein-pytools`, and is invalid python syntax
afaict.  Took a few steps to make it whole, but incomplete.
2018-10-27 23:04:04 -04:00
dickmao
0490031ec8 Sane File Navigation
As emacs users we prefer and have the luxury of fuzzy file navigation
via ido and projectile.  From a notebook or notebooklist buffer, the commands

`C-c C-f` ein:file-open
`C-c C-o` ein:notebook-open

offer an ido alternative to point and click navigation.

To populate the ido lists, retrieving the content hierarchy is on by
default.  Two custom variables determine how wide and deep the content query
probes (currently at 2 levels deep and 6 directories wide).  Set both
to zero to turn off.

tkf half finished code to quickly go from local file buffers to notebook
mode via `C-c C-z` or `C-c C-o`.  This is now possible.  EIN will
start the server from a suitable parent directory of the visited file.

Enable ido completion for `notebooklist-login`.

Remove the albatross `ein-loaddefs.el` in favor of more standard
`ein-autoloads.el` that is not git tracked.

Convenience `make install` from git source (local alternative to
melpa).
2018-10-26 18:40:19 -04:00
Tomasz Mieszkowski
80cf9808a9 Fix ein:pytools-export-buffer 2018-10-13 19:59:41 +02:00
John Miller
4d9c05f2dc Maybe fix for #334
ein wasn't using the correct protocol for "inspect_request" messages for recent
versions (>5.0) of the protocol.
2018-09-09 09:44:59 -05:00
John Miller
d117ce915f Fix for #325
EIN's complete_request wasn't using the correct parameter for recent (> 5.0)
of the jupyter messaging protocol.
2018-08-16 08:43:25 -05:00
John Miller
926055e5fb Fix for #317.
Python JSON keywords use underscores - I am too use to the lisp way which uses
dashes.
2018-08-07 08:36:26 -05:00
John Miller
9ad9b4f4e6 Hooks to customize behavior during kernel execution.
New hooks `ein:pre-kernel-execute-functions', `ein:on-execute-reply-functions'
and `ein:on-shell-reply-functions'. See variable documentation for more
information.
2018-05-12 17:32:32 -05:00
Miller
710a5a6b91 ein-kernel: Handle generic stdin channel requests
That is, stdin requests that are generated by calls to `input' in Python (and
whatever is equivalent in other kernels).
2018-03-05 15:56:16 -06:00
John Miller
9d5309af59 Trying something new with testing.
Let's do this with ert-runner instead of python. Maybe it will work for once.
2018-02-27 14:38:13 -06:00
John Miller
045d9e9a89 Adjustments to debug logging.
Added some verbosity, removed some calls that were causing errors.
2018-02-14 18:24:20 -06:00
John Miller
34902e104f ein-company: Avoid completing around punctuation.
For some reason this causes the IPython kernel to return a very large number of
potential matches.
2017-10-20 11:55:31 -05:00
John Miller
4419818dde Merge branch 'back-to-eieio' 2017-07-29 23:08:35 -05:00