Commit graph

289 commits

Author SHA1 Message Date
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
John Miller
f0f0c0d206 Typos, more efficient kernelspec querying.
Silly typo in ein-kernel.el. Querying kernelspecs is slightly more efficient,
caching results when url is a string or port (previously just cached results for
ports).
2017-04-11 17:09:30 -05:00
John Miller
39f5d329f1 Functional tests start jupyter using ein:jupyter-server-start
This reduces some of the complexity in testein.py, but unfortunately running
tests is still unreliable. Running batchwise tests don't work at all in Windows,
and running from inside emacs tests often need to be run multiple times before
they pass.

The worst offender is the delete notebook test, which will pass on usually only
1 out of 3 tries.

Testing seems to have revealed a couple bugs, so win??
2017-04-07 08:18:41 -05:00
John Miller
64267aca7d ein:notebookupdate-url-or-port: Allow user to change a notebook's url-or-port
There may be situations when a jupyter server restarts at a new url/port while a
notebook is open. This function allows the user to specify the new url/port and
continue using the notebook (or at the very least, save any changes made while
the server was down and rebooting). EIN will helpfully try to restart the kernel
once the url is changed. Jupyter may complain about session not being found, but
it does not seem to affect the running kernel.
2017-04-03 20:49:51 -05:00
John Miller
191d27c3ac Make stopping a jupyter server more user-friendly.
When calling `ein:jupyter-server-stop` ask to user if they are sure and also
give them the option to save any unsaved notebooks before killing the server.

Before closing the server also close any open notebook buffers.
2017-02-15 15:02:07 -06:00
John Miller
8ec5d4638e Prototyping the object inspector buffer.
Display value of object's __repr__, link to source when available, and
documentation.

Adding command and keybinding (C-ci) to notebook buffer keymap.

Get rid of unnecessary api check when rendering notebooklist buffer.
2017-02-06 20:19:20 -06:00
John Miller
28ed036d41 Log save hook error warnings to *ein:log-all* instead of *Messages*
Some believe that alerting the user in the *Messages* buffer when there is an
error trying to run the before-save-hooks is overly verbose and a nuisance. EIN
should still warn what is happening, I think, but instead of `warn`ing the
message no goes to the *ein:log-all* buffer.
2017-01-29 11:42:06 -06:00
John Miller
f8e78a421e More robust notebook saving, object source.
More graceful handling of errors in before-save-hook. Also improved
pytools find-source.
2017-01-07 15:07:24 -06:00
John Miller
cfd0e8a3d7 Fix clear_output in the Jupyter age and a bug fix.
Finally do the right thing when clear_output is received. Closes issue #24. Also
fix a nasty bug that might occurr when trying to open a notebook with no
associated kernelspec.
2016-12-23 16:33:35 -06:00
John Miller
9468f40bce Better kernelspec display name, pytools only for python kernels.
Prettier kernelspec names in notebooklist buffers. Only load pytools for python
kernels, which hopefully will help with connecting to non-python kernels.
2016-12-22 14:04:51 -06:00
John Miller
495d652ee0 Cosmetic updates to code formatting. 2016-12-18 19:27:35 -06:00
John Miller
64eb1b1e5b Cleaner indenting, run before-save-hook hooks before saving.
Some users have seen problems indenting Python code in codecells; this may be
due to having `indent-tabs-mode` set to a non-nil value. I now force it to be
nil in all ein notebook/worksheet buffers.

Also before saving a notebook hooks defined in `before-save-hook` are run.
2016-12-12 10:26:38 -06:00
John Miller
87053c7459 Formatting, tweaks to menu and an improved error message.
Adding a couple commands to EIN's menu and an attempt to make cell execution
message more informative.
2016-11-23 12:34:06 -06:00
John Miller
7978961d96 Save a copy of the notebook, fix deleting notebooks.
Can save a copy of an existing notebook to a new name via
`ein:notebook-save-to-command` (I still haven't thought of a good,
default keybinding, however).

Deleting notebooks now works again.
2016-11-10 21:31:38 -06:00
John Miller
c70dee7733 Taceback from cell edit buffer, more informative version
Jump to tracebacks from cell edit buffers.

Slightly more informative on version of jupyter we are working with.
2016-11-05 17:49:52 -05:00
John Miller
1c04701a90 Only autosave if the buffer has been modified. 2016-10-28 14:54:07 -05:00
John Miller
fb1fd315a6 Anaconda-mode workaround, building for a multi-language kernel
Small hack to allow python mode source editing popout buffers (ala C-c')
work with anaconda-mode.

Do major mode selection based on language specified in kernelspec, this
should allow better support when using ein with kernels other than python.
2016-10-28 14:13:32 -05:00
John Miller
c0144e2cbf Edit notebook cells in popout buffer ala org-mode
Using C-c', users can create a temporary buffer running an appropriate
mode to edit the contents of a notebook cell. This functionality is
intentionally very similar to what org-mode provides for editing blocks
of code or other.
2016-10-25 18:00:51 -05:00
John Miller
dd494cba59 Less talkative notebook saving.
EIN now logs messages regarding notebook saving using 'verbose level.
2016-10-23 19:26:21 -05:00
John Miller
701ddbe39c Autosaving and checkpoints as distinct actions.
Saving a notebook and creating a checkpoint are related, but distinct
activities. EIN does better now with this distinction. See updates to
the documentaiton (which should get pushed to github any day now).
2016-10-21 12:10:49 -05:00
John Miller
c7bf4f6521 Update docs, get scoping right for notebook checkpoint calls
Document the new checkpoint functions. Fix issue that was preventing
the list of checkpoints from being updated in the notebook.
2016-10-20 11:14:23 -05:00
John Miller
bb95f71f5e Give ein notebooks content checkpoint functionality. 2016-10-19 14:43:19 -05:00
John Miller
9ca012d1c2 Better notification header.
Interactivity! Click to switch kernels.

Also fixed an embarassing typo...
2016-08-31 09:37:58 -05:00
John Miller
e49fe22774 Bug fix, better info on running kernel.
Fixed bug with `ein:notebook-open-in-browser`; this command should now
work in IPython notebook 3.0 and later.

Notebook/worksheets now display the name of the kernel that the notebook
is running under. Next step is to make this clickable!

Also some documentation for my new super-secret project to add
evaluation of dynamic javascript to ein.
2016-08-31 09:13:25 -05:00
John Miller
5043ba9bb6 A little bit of documentation, add to menu
Document the new interactive function `ein:notebook-switch-kernel`
and add it to the menu. Not sure yet if it is worth giving a default
keybinding.
2016-08-28 20:56:00 -05:00
John Miller
586879598a Switch kernel in running notebook.
Does so by changing kernelspec and restarting notebook.
2016-08-26 20:52:54 -05:00
John Miller
3e1baa0657 Toggle viewing of slide metadata in worksheet.
Let the user control whether or not to view slide attributes in current
worksheet via `ein:worksheet-toggle-slideshow-view` (C-c S).

Also added a couple more slide attributes (fragment, notes) as
these appear to be support in current Jupyter version.
2016-07-20 12:50:04 -05:00
Guillaume Anciaux
62c0c21d28
cleaning some debug messages 2016-07-19 10:46:50 +02:00