Nathaniel Nicandro
32bee0bd67
Fix REPL callbacks to take into account the REPL's status handler
...
The status handler should only run for execute requests and should be
inhibited for other kinds of requests.
2018-02-12 10:58:36 -06:00
Nathaniel Nicandro
c4a1d6aa97
Remove old variable
2018-02-12 10:57:45 -06:00
Nathaniel Nicandro
09534ab6fb
Don't error out in a predicate, just return nil
2018-02-12 10:57:19 -06:00
Nathaniel Nicandro
26544b95ca
Refactor jupyter-repl-ret
to (hopefully) be more obvious in what its doing
2018-02-12 10:55:22 -06:00
Nathaniel Nicandro
656a2d913b
Add org-babel-jupyter
tests
2018-02-12 10:49:41 -06:00
Nathaniel Nicandro
d879e743a4
Refactor tests
2018-02-12 10:49:28 -06:00
Nathaniel Nicandro
56a36b8fa0
Remove the need to queue messages in a complicated way
...
Messages were queued by the messages sent timestamp in the message header as
well as based on the channel the message was received on because there is no
guarantee on the order of the received messages. This matters because a request
is dropped from a client's request table when an idle message is received, but
this idle message is not guaranteed to be the last message received for a
request, for example a reply message may come after the idle message has been
received.
Now if a request has received an idle message already, instead of
dropping it immediately, drop it only when the last received message time for
the request is longer than a few seconds.
2018-02-12 10:47:26 -06:00
Nathaniel Nicandro
ad0aefe307
Handle error messages through the IOPub error handler or callbacks
...
Handler methods are only run on a successful request. If an error occurs during
execution an error message is emitted on the IOPub channel, this is where
errors are handled. Or they can be captured in the reply messages through
callbacks.
2018-02-12 10:25:36 -06:00
Nathaniel Nicandro
24eb475443
Cleanup comments
2018-02-12 10:25:13 -06:00
Nathaniel Nicandro
98c646bfb5
Block until a channel is stopped in jupyter-stop-channel
for async channels
2018-02-12 10:22:13 -06:00
Nathaniel Nicandro
c4170acb77
Remove jupyter-repl-restart-channels
...
The channel process should not have to be restarted. This was needed because
signals weren't being handled properly in the subprocess.
2018-02-09 17:25:15 -06:00
Nathaniel Nicandro
86be51eb72
Don't rely on the event string in a process sentinel
2018-02-09 17:23:46 -06:00
Nathaniel Nicandro
b0186f3201
Take into account messages with no associated requests
...
For example, IOPub messages from other clients
2018-02-09 17:22:45 -06:00
Nathaniel Nicandro
9650fecf82
Remove uses of jupyter-request-run-handlers-p
2018-02-09 17:22:27 -06:00
Nathaniel Nicandro
b68404970f
Add jupyter-repl-language-mode
2018-02-09 17:21:10 -06:00
Nathaniel Nicandro
d73fd28d4d
Handle edge case when point-min
is the beginning of a cell
2018-02-09 17:18:29 -06:00
Nathaniel Nicandro
255247788c
Remove uses of seq
functions
...
Since this is an emacs 25 dependency and there were not many uses of these
functions, remove them.
2018-02-09 09:11:57 -06:00
Nathaniel Nicandro
5f72b85db3
Refactor jupyter-repl-code-context-at-point
for readability
...
Also remove unused code
2018-02-09 03:16:50 -06:00
Nathaniel Nicandro
58f1135262
Add a way to transform kernel results based on kernel language
...
For example for python kernels, we would like to convert results to tables if
they look like a table.
2018-02-08 14:15:27 -06:00
Nathaniel Nicandro
a2decc7baf
Selectively inhibit REPL handlers when executing a Jupyter src-block
...
This allows the REPL client to preserve the execution state of the kernel
while `org-babel-execute:jupyter` takes care of all of the output generated by
the kernel without having to preserve the state of the REPL.
2018-02-08 13:44:40 -06:00
Nathaniel Nicandro
b5f958ac99
More granular way of inhibiting handlers
...
`jupyter-inhibit-handlers` can now be a list of message types. If a message is
received and has one of these message types, then the client handler
corresponding to that message type is prevented from running.
2018-02-08 13:39:55 -06:00
Nathaniel Nicandro
4121cee1ba
Use jupyter-repl-cell-code-beginning-position
when getting position in cell code
2018-02-08 12:49:17 -06:00
Nathaniel Nicandro
d1e008e6d1
Fix edge case in history navigation
...
When the cell code initially does not contain a history element and you would
like to navigate backward in history, the previous behavior did not take into
account the N argument of `jupyter-repl-history-previous` in this case.
The new behavior does.
2018-02-08 12:29:08 -06:00
Nathaniel Nicandro
ff51ee8740
Remove the busy status of a cell when an idle message is received
2018-02-08 12:14:35 -06:00
Nathaniel Nicandro
e032285f9a
[WIP] Make ob-jupyter
unaware of the REPL buffer
...
Try not to modify the REPL buffer in any way from `ob-jupyter` except for
inserting a code cell.
2018-02-07 17:28:33 -06:00
Nathaniel Nicandro
dc7c1e00e8
More generic extraction of image data from html image
2018-02-07 17:26:25 -06:00
Nathaniel Nicandro
83881bf4e0
Ensure the startup message is caught
...
Setup the necessary hooks before starting the kernel so that we can ensure that
the startup message is caught.
A short delay is also added whenever we start a channel. This was necessary for
the client to catch the startup message of a python kernel.
2018-02-07 12:08:07 -06:00
Nathaniel Nicandro
48c07e1f04
Do nothing when there is no render parameter when clearing/injecting one
2018-02-06 17:46:47 -06:00
Nathaniel Nicandro
5f902e1593
Remove unused code
2018-02-06 17:46:07 -06:00
Nathaniel Nicandro
a28952c643
Silence byte compiler
2018-02-06 17:45:53 -06:00
Nathaniel Nicandro
2a602246de
Revert back to correct behavior
2018-02-06 17:45:12 -06:00
Nathaniel Nicandro
85efbf9c04
Refactor org-babel-jupyter-prepare-result
...
- Return the correct result when HTML contains only image data
- Still need to handle all possible cases of the data URL scheme
- Add `org-babel-jupyter--image-result`
2018-02-06 16:49:48 -06:00
Nathaniel Nicandro
072dce7c00
Negligible changes
2018-02-04 18:22:56 -06:00
Nathaniel Nicandro
43fc5a6ab8
Remove superfluous newlines when executing code
2018-02-04 18:21:12 -06:00
Nathaniel Nicandro
731480a4dd
Don't add a newline in stream output
2018-02-04 18:20:11 -06:00
Nathaniel Nicandro
f466b3adcc
[WIP] Better support for display-data messages
2018-02-04 18:19:08 -06:00
Nathaniel Nicandro
8d7e0a3bd7
Update comments
2018-02-04 18:18:19 -06:00
Nathaniel Nicandro
90dd699a7a
Update comments
2018-02-04 18:15:32 -06:00
Nathaniel Nicandro
2cb665e744
Check if the ioloop process is live in jupyter-channel-alive-p
for async channels
2018-02-04 18:10:32 -06:00
Nathaniel Nicandro
e6d9fcbf5a
Add kernel-died-cb
for heartbeat channels
...
This is a callback function which is called when no response has been received
from the kernel after 5 `time-to-dead` periods.
2018-02-04 18:08:05 -06:00
Nathaniel Nicandro
a94c6cc4c6
Remove redundancy in org-babel-execute:jupyter
2018-02-04 18:06:55 -06:00
Nathaniel Nicandro
ca6c2ae37a
Simplify wording of jupyter-add-callback
documentation
2018-02-04 18:06:11 -06:00
Nathaniel Nicandro
8784b9fcc3
Update comments and documentation
2018-02-04 17:58:11 -06:00
Nathaniel Nicandro
09ef799535
Use jupyter-inhibit-handlers
2018-02-04 17:57:18 -06:00
Nathaniel Nicandro
4a0cff991d
Add jupyter-ioloop-wait-until
to wait for events from ioloop subprocess
2018-02-04 17:55:47 -06:00
Nathaniel Nicandro
2ffbf74149
Flush stdout after sending all messages in ioloop subprocess
2018-02-04 17:44:27 -06:00
Nathaniel Nicandro
fe323cf623
Properly stop channels in ioloop subprocess
2018-02-04 17:43:59 -06:00
Nathaniel Nicandro
290f3a2d96
Block until channel is alive in jupyter-start-channel
for async channels
2018-02-04 17:43:20 -06:00
Nathaniel Nicandro
b72713b00c
Remove the special behavior when dropping requests
2018-02-04 17:41:48 -06:00
Nathaniel Nicandro
74ccc47a6e
Get the kernel language from the kernel-info slot of a jupyter-kernel-client
2018-02-04 17:41:13 -06:00