Commit graph

1675 commits

Author SHA1 Message Date
Nathaniel Nicandro
e1564dfc93 jupyter-org-result: Include message type in warning
When the `:display` header argument is used and a particular message type
doesn't return a mime bundle with one of the requested mime types, include the
message type in the warning that is displayed.

This should clarify the situation where an `:execute-result` and
`:display-data` message both return data to display, but one of them does not
have one of the mimetypes requested in the `:display` header argument.

Closes #144.
2019-09-12 17:30:48 -05:00
Nathaniel Nicandro
c5fd3edc85 jupyter-available-kernelspecs: Clarify documentation 2019-09-12 17:24:54 -05:00
Nathaniel Nicandro
438ac0afd4 jupyter-org--image-result: Prefer when instead of if 2019-09-10 13:43:02 -05:00
Nathaniel Nicandro
4de01643c8 jupyter-eval: Revert back to not using jupyter-eval-string
`jupyter-eval-string` adds unwanted callbacks to the request. `jupyter-eval` is
meant to evaluate code without any changes occurring in the buffer.
2019-09-03 18:09:16 -05:00
Nathaniel Nicandro
79ddd9357e Add org-babel-jupyter-current-src-block-params
This is needed because `org-mode` merges many sources of source block params so
its not enough to just re-compute the parameters in `jupyter-generate-request`
using `org-babel-get-src-block-info` or `org-babel-log-get-info`.
2019-09-01 11:43:46 -05:00
Nathaniel Nicandro
aa9b634e7b jupyter-eval-string-command: Fix wrong number of arguments 2019-08-28 15:43:54 -05:00
Nathaniel Nicandro
091857a21b Remove unnecessary uses of jupyter-weak-ref 2019-08-27 14:02:53 -05:00
Nathaniel Nicandro
0ff69491cd jupyter-inspect: Fix commentary 2019-08-27 14:02:53 -05:00
Nathaniel Nicandro
0484fa1191 jupyter-server-ioloop: Spend more time waiting for input
As opposed to spending most of the time waiting for websocket messages.

This makes Emacs more responsive in scenarios where we are sending input to a
kernel and immediately waiting for a response, e.g. in `jupyter-repl-ret` and
`jupyter-eval`.
2019-08-27 14:01:37 -05:00
Nathaniel Nicandro
fbabaa2303 Update CHANGELOG 2019-08-24 21:29:54 -05:00
Nathaniel Nicandro
91957986e1 Evaluation overlays
* README.org: Add section on `jupyter-eval-use-overlays`, minor formatting fix

* jupyter-client.el (jupyter-eval-overlay): New face.
(jupyter-eval-use-overlays, jupyter-eval-overlay-prefix): New custom variables.
(jupyter--display-eval-result): Remove function.
(jupyter-eval): Use `jupyter-eval-string`.
(jupyter-eval-result-callbacks): New function.
(jupyter-eval-add-callbacks): Result callbacks now obtained from
`jupyter-eval-result-callbacks`, only add callbacks for non-result message
types. Allow `beg` and `end` arguments remove `result-cb` argument, update all
callers.
(jupyter-eval-string): Allow `beg` and `end` arguments remove `cb` argument,
update all callers.
(jupyter-eval-string-command): Remove `cb` argument, update all callers.
(jupyter-eval-region): Ditto.
(jupyter-eval-line-or-region): Refactor.
(jupyter-eval-overlay-keymap): New keymap.
(jupyter-eval-ov--delete, jupyter-eval-ov--remove-all)
(jupyter-eval-ov--propertize, jupyter-eval-ov--fold-boundary)
(jupyter-eval-ov--expand-string, jupyter-eval-ov--make)
(jupyter-eval-ov--expand, jupyter-eval-ov--fold)
(jupyter-eval-toggle-overlay, jupyter-eval-remove-overlays)
(jupyter-eval-display-overlay, jupyter-eval-display-with-overlay-p): New
functions.

* jupyter-repl.el (jupyter-eval-string): Ensure callbacks are added in the
original (non-REPL) buffer the command was called from. So that
`jupyter-eval-display-with-overlay-p`, indirectly called by
`jupyter-eval-add-callbacks`, works.
(jupyter-repl-interaction-mode-map): Set `C-c C-o` binding to
`jupyter-eval-remove-overlays`.
2019-08-24 21:28:58 -05:00
Nathaniel Nicandro
797ce5e0e6 jupyter-api-delete-cookies: Fix cookie expiration in test 2019-08-24 17:19:42 -05:00
Nathaniel Nicandro
81b034dad9 Remove unused jupyter-tramp.el functions 2019-08-24 16:27:46 -05:00
Nathaniel Nicandro
96aaedf5b5 jupyter-ioloop--dump-message: Don't abbreviate printed lists 2019-08-13 19:50:53 -05:00
Nathaniel Nicandro
4b97a72cdd Don't overwrite default url-cookie-file during tests
This is now easier to do since the value of `url-cookie-file` is propagated to
websocket subprocesses.
2019-08-11 14:22:28 -05:00
Nathaniel Nicandro
c4dc513c52 Add FIXME 2019-08-08 22:49:48 -05:00
Nathaniel Nicandro
39974d1841 jupyter-repl-restart-kernel: Use a kernel manager to restart if possible
* jupyter-repl.el (jupyter-repl-restart-kernel):
Call the `jupyter-shutdown-kernel` method of the client's kernel manager if
available.
Remove code that started a kernel when restarting if a manager was available,
this is already handled by `jupyter-shutdown-kernel`.
2019-08-08 22:04:27 -05:00
Nathaniel Nicandro
7a1c91eef4 Add the jupyter-kernel-process-manager class
So as to further generalize and separate out the abstract kernel manager class
from its various implementations.

* jupyter-kernel-manager.el (jupyter-meta-kernel): Fix documentation.
(jupyter-kernel-process, jupyter-command-kernel, jupyter-spec-kernel):
Move related functions and methods to `jupyter-kernel-process-manager.el`
(jupyter-kernel-manager-base): Remove class.
(jupyter-kernel-manager): Re-purpose class as the base class of all kernel
managers. The class corresponding to the old functionality is now named
`jupyter-kernel-process-manager`. Move all related functions and methods for
`jupyter-kernel-process-manager` to `jupyter-kernel-process-manager.el`.

* jupyter-kernel-process-manager.el: New file.

* jupyter-repl.el: Require `jupyter-kernel-process-manager` instead of
`jupyter-kernel-manager`.

* jupyter-server.el (jupyter-server-kernel-manager): Inherit from
`jupyter-kernel-manager` instead of `jupyter-kernel-manager-base`.

* test/jupyter-test.el (jupyter-kernel-lifetime)
(jupyter-command-kernel): Use `jupyter-kernel-process-manager` instead of
`jupyter-kernel-manager`.

* test/test-helper.el: Require `jupyter-kernel-process-manager` instead of
`jupyter-kernel-manager`.
2019-08-08 22:04:27 -05:00
Nathaniel Nicandro
23f41cf86c Add jupyter-kernel-alive-p method for a jupyter-kernel-client
* jupyter-client.el (jupyter-kernel-alive-p): Do it.

* jupyter-repl.el (jupyter-repl-connected-p): Use it.
2019-08-08 21:55:22 -05:00
Nathaniel Nicandro
8c711dd3ce jupyter-repl-client-has-manager-p -> jupyter-client-has-manager-p
* jupyter-client.el (jupyter-client-has-manager-p): New function.

* jupyter-repl.el (jupyter-repl-client-has-manager-p): Remove function.
(jupyter-repl-connected-p, jupyter-repl-kill-buffer-query-function):
(jupyter-repl-restart-kernel, jupyter-repl-display-kernel-buffer):
Rename calls to `jupyter-repl-client-has-manager-p` to
`jupyter-client-has-manager-p`.

* test/jupyter-test.el (jupyter-repl-client-predicates):
Rename calls to `jupyter-repl-client-has-manager-p` to
`jupyter-client-has-manager-p`.
2019-08-08 21:55:22 -05:00
Nathaniel Nicandro
3beb736853 Add jupyter-repl-completing-read-repl-buffer
* jupyter-repl.el (jupyter-repl-completing-read-repl-buffer): Do it.
(jupyter-repl-restart-kernel, jupyter-repl-associate-buffer): Use it.
2019-08-08 18:22:59 -05:00
Nathaniel Nicandro
7e4b24288b jupyter-add-callback: Mention behavior for multiple callbacks 2019-08-08 17:51:35 -05:00
Nathaniel Nicandro
f4aa755126 Add jupyter-server--refresh-comm 2019-08-08 17:51:20 -05:00
Nathaniel Nicandro
388d7b923c Add Gitter badge 2019-08-02 13:58:41 -05:00
Nathaniel Nicandro
5b34e99bbf jupyter-hb-channel: Increase timeouts
See #141 and #164.

* jupyter-zmq-channel.el (jupyter-hb-max-failures): Reduce to 3.
(jupyter-hb-channel): Increase `time-to-dead` slot to 10 s.
2019-08-02 11:48:28 -05:00
Nathaniel Nicandro
6b1baf1fde jupyter-api-with-subprocess-setup: Set url-cookie-file to its parent process value 2019-08-01 16:26:43 -05:00
Nathaniel Nicandro
4e3a8d4dc2 README.org: Mention jupyter-api-authentication-method 2019-07-31 14:28:01 -05:00
Nathaniel Nicandro
8f35f135d7 jupyter-gc-servers: Delete cookies when cleaning up servers
See #161

* jupyter-rest-api.el (jupyter-api--delete-cookie):
(jupyter-api-delete-cookies): New functions.

* jupyter-server.el (jupyter-gc-servers): Do it.

* test/jupyter-server-test.el (jupyter-api-delete-cookies): New test.
2019-07-31 14:19:15 -05:00
Nathaniel Nicandro
f7f8bfa52c jupyter-api-url-request: Don't override a user customizable variable 2019-07-30 10:24:31 -05:00
Nathaniel Nicandro
bcc438bc1f Add FUNDING.yml 2019-07-29 18:18:32 -05:00
Nathaniel Nicandro
98adac6d31 Fix definitions of jupyter-tramp-file-name(-method)?-p
Fixes #155.

* jupyter-tramp.el (jupyter-tramp-file-name-method-p):
(jupyter-tramp-file-name-p): Adhere to documentation.

* test/jupyter-tramp-test.el (jupyter-tramp-file-name-p): Add test.
2019-07-27 12:22:47 -05:00
Nathaniel Nicandro
a0b33a5861 jupyter-org--fixed-width-to-example-block: Preserve blank lines 2019-07-27 00:06:18 -05:00
Nathaniel Nicandro
c91861cef9 jupyter-org--delete-element -> jupyter-org-delete-element
* jupyter-org-client.el (jupyter-org--delete-element):
Do it and also adhere to documentation. Update all callers.
2019-07-27 00:04:34 -05:00
Nathaniel Nicandro
93f21b077b jupyter-org--do-insert-result: Handle control codes in stream output
* jupyter-org-client.el (jupyter-handle-stream): Remove control code handling.
(jupyter-org--handle-control-codes): New function.
(jupyter-org--do-insert-result): Do it.
2019-07-26 23:16:05 -05:00
Nathaniel Nicandro
dd4b4e3a82 jupyter-server-mode-set-client: Increase timeout in test
There are often failures on Appveyor.
2019-07-25 10:23:23 -05:00
Nathaniel Nicandro
11b293438d jupyter-generate-request (jupyter-org-client): Consider babel-call org elements
Fixes #154.
2019-07-25 03:48:18 -05:00
Nathaniel Nicandro
66c794964c org-babel-jupyter-src-block-session: Consider babel-call org elements 2019-07-25 03:48:18 -05:00
Nathaniel Nicandro
d11aa3f10d Fix byte compile warning 2019-07-24 17:28:25 -05:00
Nathaniel Nicandro
a54aa03010 Update CHANGELOG 2019-07-24 16:59:04 -05:00
Nathaniel Nicandro
a7da89eae4 README.org: Mention naming notebook server kernels 2019-07-24 16:59:04 -05:00
Nathaniel Nicandro
4b55a29726 org-babel-jupyter--server-repl: Associate session name with kernel ID
So that `M-x jupyter-server-list-kernels` will show which kernel corresponds to
an Org mode source block session.
2019-07-24 16:59:04 -05:00
Nathaniel Nicandro
6f97c958da Add jupyter-server-kernel-names variable and associated functions
Used to associate names to kernel IDs.
2019-07-24 16:59:04 -05:00
Nathaniel Nicandro
ea22bd512d Re-authenticate after "Access Forbidden" 2019-07-24 16:59:04 -05:00
Nathaniel Nicandro
e8540667c7 jupyter-api-login: Mark response buffer as dead 2019-07-24 16:59:04 -05:00
Nathaniel Nicandro
c711562207 jupyter-gc-servers: Only stop server comm if it is alive
Bug found by @dcherian, see
https://github.com/dzop/emacs-jupyter/issues/131#issuecomment-510920312
2019-07-24 16:59:04 -05:00
Nathaniel Nicandro
81797ccbb5 Mention server kernel list keybindings in README
Co-Authored-By: Deepak Cherian <dcherian@users.noreply.github.com>
2019-07-24 16:59:04 -05:00
Nathaniel Nicandro
388f593955 jupyter-kernel-alive-p (jupyter-server-kernel): Handle non-existent server 2019-07-24 16:59:04 -05:00
Nathaniel Nicandro
6d7b07333f Add jupyter-api-server-exists-p 2019-07-24 16:59:04 -05:00
Nathaniel Nicandro
36b9edc31e jupyter-server-find-manager: Don't check if the kernel is alive
Delay any errors, e.g. if the server is no longer alive, to where they would be
more useful.
2019-07-24 16:59:04 -05:00
Nathaniel Nicandro
5efa64ff19 jupyter-server-list-kernels: Better documentation 2019-07-24 16:59:04 -05:00