Commit graph

1032 commits

Author SHA1 Message Date
John Miller
334bb46000 ein-cell-edit: Smarter major mode selection.
Do a better job of selecting the major mode for cell edit buffers. Will try to
detect if there is a cell magic, like %%html or %%latex, and set an appropriate
major mode.

If it cannot determine what the major mode should be and the cell type is raw,
the major mode will default to whatever is set in the user customizable variable
`ein:raw-cell-default-edit-mode', which by default is set to `'LaTeX-mode'.
2017-06-02 21:05:02 -05:00
John Miller
179cec48ae ein-cell: Fix slideshow metadata.
Was using wrong name for slide type; should be 'slide_type' not 'slide-type'.
2017-06-02 15:05:21 -05:00
John Miller
0196407b42 ein-core: More stable ipython version checking.
Try to be more graceful when a null sneaks in for the server version. Also
experiment using deferred:$ in `ein:jupyter-server-start'.
2017-06-02 07:24:08 -05:00
John Miller
22cc948975 ein:notebooklist-change-url-port: Better deferred syntax, use lexical bindings. 2017-05-30 14:33:31 -05:00
John Miller
e3eca1115d ein-notebooklist: Avoid auth issues when changing host url.
When calling `ein:notebooklist-change-url-port' first make call to
notebooklist-open to ensure cookies are properly created/refreshed before trying
to save notebook and restart kernels.

Note this uses a bit of magic from deferred, which was already being used in
ein-jedi.el, but somehow never made it into the list of required pacakges. We
are now correcting that oversite.

Extend the timeout when querying the ipython/jupyter version. Also try to detect
when timeouts occur and in such cases temporarily assume a version (4 for the
moment).
2017-05-30 14:05:02 -05:00
John Miller
8a231bfb2d ein-loaddefs: Update autoloads. 2017-05-24 09:58:14 -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
John Miller
3697273a84 slideshow: Clean up variable names (no more underscores). 2017-05-22 08:02:42 -05:00
Dov Grobgeld
6b752fd32b Update ein-cell.el
Fixed typo.
2017-05-18 22:22:40 +03:00
John Miller
c97c85eae8 ein-cell-output: Remove duplicate code. 2017-05-18 10:17:10 -05:00
John Miller
4b92b3adcc ein-kernel: Support (anew) starting kernels in older versions of jupyter.
Overzealously looking to the future was my sin here.
2017-05-18 09:04:49 -05:00
John Miller
f2b138b4f7 ein-file: Remove unused code. 2017-05-17 20:14:23 -05:00
John Miller
d9c77492d6 Balancing parenthesis. 2017-05-16 15:07:14 -05:00
John Miller
4f4cfa8f0a Ensure new cells have metadata set. 2017-05-16 14:34:40 -05:00
John Miller
43a1afe49b Preserve metadata information when saving.
EIN should now respect when other actors (namely nbextensions) set metadata for
a cell.
2017-05-16 13:55:43 -05:00
John Miller
db07da61d3 ob-ein: Always return full uri's for sessions, even if only port has been given. 2017-04-26 21:09:39 -05:00
John Miller
461e400c9d ob-ein: Handle full uri's in :session argument.
Correctly handle full uri's when they are provided as a :session. Also ob-ein
converts :session arguments that just specify the port into full uri's.
2017-04-26 21:09:39 -05:00
John Miller
5ed0b871ce ein-file.el: handle text encoding on windows
Try to sanely decode text on windows sytems to avoid getting a buffer full of ^M
EOL symbols when opening files through ein's notebooklist buffer.

This doesn't appear to be necessary on Unix systems, and by extension I am going
to assume it is also the same on Mac OS X.
2017-04-21 20:29:19 -05:00
John Miller
5c2f34ceeb Implement company locate command.
ein company backend now dutifully looks for the file and line where an object is
defined when company so asks it. When ein fails in its duty it fails silently
and I am not sure yet if that is the correct behavior. For now it will stand,
until I think of something better.
2017-04-21 19:07:16 -05:00
John Miller
91b5f605ee Implementat company doc-buffer command.
ein company backend will now show results of inspect_request in a company
documentation buffer when company requests documentation via the doc-buffer
command.
2017-04-21 17:57:16 -05:00
John Miller
ab106032a8 Fixing bug in company backend.
The backend was working properly only when completing at the beginning of the
lines. For example, completing `import IPython.` would end up replacing the
import and moving IPython to the beginning of the line. EIN's company backend no
longer does this.
2017-04-20 19:55:00 -05:00
John Miller
3aac45257c Cosmetic tweaks to ein-company.el 2017-04-20 16:33:56 -05:00
John Miller
7ad1faf452 Fix completion issues with ein's company backend.
Also tweak names of buffers for editing non-notebook files.
2017-04-20 16:21:54 -05:00
John Miller
16d5c73d39 Merge branch 'master' into company-async-complete-ng 2017-04-20 07:54:45 -05:00
John Miller
88595dede6 Support filetypes other than ipynb
EIN now lists other file types in notebooklist buffer and will allow user to
open those files for editing. The new buffer will get the right major-mode most
of the time, but has a hard time getting the line coding right on Windows
platform.
2017-04-20 07:47:05 -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
06269b72bb Update autoloads for ein-company.el 2017-04-19 10:57:19 -05:00
John Miller
d13e85b370 Minimally functional company-mode support.
There is now a company mode backend for ein. It generates completions by sending
complete_request to the running kernel so for the moment no jedi integration.

Configuring is maybe non-obvious - user should at minimum set
`ein:use-auto-complete` and `ein:use-auto-complete-superpack` to nil. Adding a
`(require 'ein-company)` probably should be done somewhere in the user's init
file. This could all be done better so I will attempt to address in later
commits.
2017-04-19 10:12:45 -05:00
John Miller
63b064cc33 Merge branch 'company-mode-support' into company-async-complete-ng 2017-04-18 17:49:46 -05: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
d189d8b924 Implement uploads per #170. 2017-04-02 14:33:56 -05:00
John Miller
e88f7f3d5f Fix for #188.
Make even more unique edit-cell buffer names. Check that an edit-cell-buffer
does not already exits before creating one.

Also try to be even more aggressive in limiting output in backtraces when
debugging ein.
2017-04-02 08:59:02 -05:00
Charl P. Botha
61ba1e9a30 ein:get-kernel works in edit-cell-mode
Modify ein:get-kernel so it can retrieve the kernel from the local
worksheet variable in edit-cell-mode. This is done so that functions
such as ein:completer-complete and tooltips / inline help are
availeble to be bound by the user.
2017-03-22 12:22:36 +02:00
Josiah Schwab
68cc6f59b0 Add guard to allow for links in older org-mode versions 2017-03-20 11:26:04 -07:00
John Miller
80fc8b1f7d Fix for #181.
Only enable ein:pager-mode for pager buffers that don't already have the mode
enabled.
2017-03-19 13:19:01 -05:00
John Miller
8cb69fe4e7 Update to latest sessions API
Set POST body during session creation per
http://jupyter-api.surge.sh/#!/sessions/get_sessions.
2017-03-16 22:28:17 -05:00
John Miller
095d758670 Even more cl-generic-ification. 2017-03-16 16:55:10 -05:00
John Miller
b195fbdd70 ein-traceback has been cl-generic-ified. 2017-03-16 16:42:03 -05:00
John Miller
0ea4a9adef Cleaning up compile warnings.
Slowly move towards cl-generic instead of EIEIO.

Got rid of json encoding defadvices. So far so good.
2017-03-16 16:16:16 -05:00
John Miller
fdb20813cf Give another try at company-mode integration. 2017-03-04 21:25:21 -06:00
John Miller
68b2e94a75 Merge branch 'master' into company-mode-support 2017-03-04 21:23:17 -06:00
John Miller
7cff07321a Whitespace cleanup. 2017-03-04 20:57:37 -06:00
John Miller
1d82941c98 Bump versions for dependencies. 2017-02-25 21:40:49 -06:00
Thierry BM
740c1ca999 Fix for the copy cell feature 2017-02-23 19:14:01 -05:00
Sam Steingold
ac74ff8868 extract ein:pytools-jump-to-source-1 from ein:pytools-jump-to-source
Check that `filename` actually exists before jumping to it.
Without this patch M-. on an arbitrary word ZZZ creates two empty buffers,
one named "None" and the other named (yes, this is the actual buffer name):
"code.py:456: UserWarning: Argument given (ZZZ) can't be found as a variable or as a filename."
2017-02-22 11:03:24 -05:00
John Miller
6b7e251658 Allow user to specify additional arguments to start the jupyter server.
See customizable variable `ein:jupyter-server-args'.
2017-02-20 18:07:17 -06:00
John Miller
3fc73b98d8 Attempt at workaround for curl cookie jar issues
Login and notebooklist requests have a tendency to fail with the curl request
backend when there is no cookie jar file. Request will create the cookiejar, but
apparently with the asynchronous nature of ein this happens too slowly causing
content REST queries to fail. My tactic here is to repeat the call once, and
only once when a failure is detected. It is a difficult problem to reliably
create so I'm not sure if this is a good fix or not. Time will tell.
2017-02-17 15:06:59 -06:00