Commit graph

327 commits

Author SHA1 Message Date
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
Guillaume Anciaux
1c549e72d7
addîng the slide info in prompt and allow switch slide type with C-c C-d 2016-07-19 10:37:00 +02:00
John Miller
71ee42a803 Load secure cookies when using secure connection.
Secure connections (i.e. wss, https) store cookies in a secure jar,
websocket connections now take this into account when connecting
using wss protocol.
2016-04-08 21:22:14 -05:00
John Miller
bd9668702a Fix for issue #92
Use lexical-let vs let in `ein:notebooklist-render.`
2016-03-23 12:31:47 -05:00
John Miller
a752e45772 Undo buffer-file-name madness.
No longer set buffer-file-name for ein:notebook buffers. This was
causing unexpected and potentially disastrous (as in data corruption)
behavior.

Some updates to travis configuration and testing. Still a long ways
from having that working, though.
2016-03-03 08:31:05 -06:00
John Miller
c5cf44a795 Fix saving new notebooks, whitespace updates.
Newly created notebooks no longer error on saving - bug in how
kernelspec metadata was being filled in.

Also a number of miscellaneous fixes to indentation that have
inexplicably appeared in the code.

Some small fixes for typos and catching up on version info.
2016-03-01 16:02:00 -06:00
John Miller
6facffd586 Be even more respectful of kernelspec data. 2016-01-13 18:24:59 -06:00
John Miller
5dec56eec2 Respect kernelspec info in notebook metadata.
This should allow us to reload notebooks using the same
kernel they were running when saved.
2016-01-13 18:07:15 -06:00
John Miller
a89aa6aebd Including kernelspecs into the notebooklist view.
EIN now shows kernels available for the Jupyter server being view in the
notebooklist buffer. We don't do much with the info, yet, though.
2016-01-13 07:52:02 -06:00
John Miller
25d1437de6 Ask for kernel when creating named notebook.
We don't do anything with the info, yet, but it is a good
test for our code for getting available kernels from the Jupyter
server.
2016-01-11 20:21:19 -07:00
John Miller
4f382f7312 Merge branch 'master' into kernelspecs 2016-01-11 15:40:08 -07:00
John Miller
1987f601c7 Fix event firing for content save errors.
Code wasn't calling `ein:notebook-save-notebook-error` when content
saving failed. Small detail, but would result in "Notebook saving"
eternally hanging out in notebook message display.
2016-01-11 15:11:14 -07:00
John Miller
447854fdac Query Jupyter for kernelspecs
Structures and logic for querying Jupyter server for a list of available
kernelspecs.
2016-01-11 09:20:40 -07:00