Commit graph

316 commits

Author SHA1 Message Date
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
dickmao
4e8a9b51b5 notebook-mode as a proper minor mode
Previously `notebook-mode` was an ordinary function that called
`notebook-minor-mode` to install `ein:notebook-mode-map`.  Make
`ein:notebook-mode` a proper minor mode via `define-minor-mode`.  This
has a few visible benefits primarily that `describe-mode` or `F1 m` will now
show all the keybindings, and mode-line will reflect.

As a consequence `ein:notebook-mode-hook` is no longer an explicit
`defcustom` (proper minor modes get it for free).  This had been a
dangerous situation as the default hook containing critical functions could be overridden.
2018-11-28 13:31:23 -05: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
e4e0fc4abc Merge branch 'pr-397' 2018-11-08 20:52:29 -06:00
dickmao
270f157751 squash one of possibly many bugs that could cause intermittent travis failure 2018-11-08 11:36:10 -06:00
Sam Steingold
1c6270c425 update the code base to avoid compilation warnings about obsolete functions
call-next-method -> cl-call-next-method
set-slot-value -> (setf slot-value)
*-child-p -> cl-typep
oref <keyword> -> slot-value <symbol>
object-p -> eieio-object-p
Closes https://github.com/millejoh/emacs-ipython-notebook/issues/394
2018-11-08 09:36:35 -05: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
John Miller
47ba0e11c7 ein-notebook: Add alias for the old ein:notebook-reconnect-kernel
John's rule of updates: respect and compassion for the user is
paramount.
2018-11-05 19:56:52 -06:00
John Miller
6438d078fd Merge branch 'pr-382' 2018-11-05 19:48:30 -06:00
Sam Steingold
0bbe4bcf3a add missing iteration arg to the kernel-start call 2018-11-05 09:20:07 -05: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
Sam Steingold
387d067558 make C-c C-x a prefix key 2018-11-04 15:07:29 -05: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
dickmao
d19f696e59 add latex hotkey. need to apply rendering per ewoc lest emacs starts killing buffers 2018-11-01 22:07:05 -04:00
John Miller
c1a8d2c720 ein-notebook: Make eldoc an optional feature.
So I and others can do testing while the less intrepid can continue with things
the way they were.
2018-11-01 20:13:45 -05: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
35ccc3de34 Bug #369
6d42e0e771/lisp/ein-notebook.el (L419)
2018-10-31 03:51:50 -04:00
dickmao
80839a1d77 finish previous commit 2018-10-28 14:38:53 -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
dickmao
0345ed0b33 Try to address windows NT unseen. Add osx. Add ipython 7.0.1. 2018-10-20 00:12:34 -04:00
dickmao
085a188b20 Streamline login
Merge the login and open commands (open aliased to login).  Add login
tests described in #352.

Attempt to improve user experience by synchronously executing
`ein:jupyter-server-start`.  `ein:dev-prefer-deferred` custom variable
allows easy switch to compare sychronous versus old asynchronous behavior.
2018-10-17 16:52:10 -04:00
dickmao
512658883b @sam-s says Requiring ESS is wrong because it forces people who do NOT use it to install it.
The standard way to avoid this problem is to use autoload instead of require.
This way ESS is not required to compile and run EIN and it is only loaded if the user actually uses it.
2018-10-15 12:19:30 -04:00
dickmao
bc10cea743 Normalize url-or-port
```
"http://localhost:8888"
"http://localhost:8888/"
"http://127.0.0.1:8888"
"http://127.0.0.1:8888/"
"8888"
8888
```

Ideally these should converge to the same thing.  Since many hash
tables are keyed off `url-or-port`, forgetting to
normalize `url-or-port` with `ein:url` leads to missed cache hits and
general malaise.  So we try to do that.

Address a FIXME: apply callbacks to `ein:notebook-list-login-and-open`.

Removed py3.5 from travis build matrix to reduce developer strain.
2018-10-12 21:55:33 -05:00
John Miller
1bdb1a26f2 Reimplement PR #344
Some good ideas from @dickmao, the only difference here is that notebook
autosave is not defaulted to being turned off as this might produce some
unexpected behavior for existing users. What I am doing is decreasing the
default frequency to autosaving once every five minutes.
2018-10-12 10:58:59 -05:00
dickmao
11c2245c41 Asynchronize all server communication
Use deferred and callbacks instead of `:sync t` for tkf requests which
is known to have issues.  Query server attributes once on
notebooklist-open to avoid sequencing issue #176 (but allow Resync).
Under curl backend, a second request for the same "key" as a pending
request will abort the latter, which has resulted in a clobbered
curl-cookie-jar file, so merely warn and don't abort.

Fix #176
2018-10-07 00:40:48 -04:00
dickmao
ad8408dfb7 Implement undo
`M-x customize-group RET ein`
Toggle `Ein:Worksheet Enable Undo`
Save for Future Sessions
Restart emacs or kill/restart notebook

Fixes #338
2018-10-02 10:00:25 -04:00
John Miller
0793b689e9 Merge remote-tracking branch 'dickmao/revive-unit-tests' 2018-09-28 12:08:10 -05:00
John Miller
3d3503289f Try to make ein:company-backend loading more robust.
Try, but seem to still be mostly failing. Think this is more a personal setup
issue than something in general but this change should, at the very least, not
do any harm.
2018-09-28 11:51:57 -05:00
dickmao
ec28cbe708 revive tkf tests
`make test-unit`
`make test-int` (formerly `cask exec ert-runner`)
An intermittent travis-melpa issue is solved by gonewest818.
2018-09-27 00:52:00 -04:00
John Miller
a3482660a2 Support eldoc.
Really basic support for eldoc, buidling off the oinfo cache code written to
support function annotations for the ein company backend. In theory should also
work the other completion backends, but untested at the moment.
2018-09-18 21:48:07 -05:00
John Miller
7779d281e6 Quote argument to %run, handle notebooks with no kernelspec.
Bug fixes, both.
2018-06-12 06:29:08 -05:00
Sam Steingold
9cb9dd7345 now that auto-complete is an official dependency, we can require it unconditionally
this allows us to get rid of the ugly eval on a macro
2018-05-31 19:55:45 -04:00
John Miller
bea8b7b580 Compiler warning cleanup.
Also try to resolve a bit of the dependency heck that is ein.
2018-05-31 12:44:16 -05:00
John Miller
6e9fa64bb0 Fix #260.
See new interactive function `ein:notebooklist-refresh-kernelspecs'. Maybe I
will document it by the next commit.
2018-05-20 08:42:42 -05:00
John Miller
7a4d58ea36 ein-notebook: Try to suspend GC operations when loading notebooks.
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.
2018-03-08 09:03:09 -06:00
John Miller
acb79501f0 ein-notebook: Fix ein:get-kernelspec when name is "default"
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.
2018-02-27 16:08:46 -06:00
John Miller
2fec7cb20e Make kernelinfo language agnostic.
Or at least don't try to call Python code when the kernel language is not
Python.
2018-02-14 18:25:23 -06:00
John Miller
f63451ca03 ein-notebooklist: Improved ein:notebook-update-url-or-port.
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.
2017-11-07 15:14:45 -06:00
Sam Steingold
0be2524001 add ein:notebook-reconnect-kernel to menu 2017-10-19 12:37:22 -04:00
John Miller
85968e476c ein-jedi: Truly integrate jedi into ac backend.
Until now autocompletion was using kernel complete mechanism regardless of
`ein:completion-backend' setting.
2017-08-03 08:50:07 -05:00
John Miller
96ae9f8316 Merge branch 'master' into back-to-eieio 2017-07-16 19:38:31 -05:00
John Miller
08d2792d69 Better interface for customizing code completion in ein.
Please see the new variable `ein:completion-backend'. Use this variable to
configure which completion backend to use in ein. Currently we support
auto-complete, company-mode, and jedi using auto-complete.
2017-07-14 19:53:14 -05:00
John Miller
c78711a7c4 Back to eieio
It seems there are enough people out there still on Emacs 24 to warrant undoing
some of my recent moves away from eieio to cl-generic. For the near future I
will try to keep any changes that are incompatible with Emacs 24 to a
development branch. There is still probably plenty of opportunity to make the
code more future-proof for an eventual move away from eieio (I'm looking at you
oref and sref...)
2017-07-12 14:38:04 -05:00
John Miller
4a487ab9b8 ein-notebooklist: New function ein:notebooklist-change-url-port
Like `ein:notebook-update-url-or-port', but for all the notebooks opened from the
current notebooklist buffer.

Fix bug in `ein:notebook-update-url-or-port' that was keeping the kernel from
restarting.
2017-05-24 09:53:58 -05:00
John Miller
b39634d64a ein-org: Fix add link feature for modern org mode.
Modern org (i.e. as of version 9) uses `org-link-set-parameters' to configure
storing and using of custom link types, deprecating the use of
`org-add-link-type' and `org-store-link-functions'.

Also update autoload definitions else user will never see the changes!

Additional documentation for `ein:notebook-update-url-or-port'.
2017-05-24 08:32:59 -05:00
Sam Steingold
69e5bbc901 ein:notebook-save-notebook: run before-save-hook in the notebook buffer (fix issue#173) 2017-04-19 13:35:09 -04:00