Commit graph

17 commits

Author SHA1 Message Date
Nathaniel Nicandro
b4a5ea177f Use defsubst for the functions that work with message plists
Also add more convenience functions for working with messages.
2018-01-02 13:50:24 -06:00
Nathaniel Nicandro
a224253a46 Rename jupyter--send-encoded -> jupyter-send, jupyter--recv-decoded -> jupyter-recv 2018-01-02 13:50:12 -06:00
Nathaniel Nicandro
940594fda6 Rename jupyter-request-* to jupyter-*-request
Where `jupyter-request-*` are the `jupyter-kernel-client` request methods. This
required the underlying messages request message functions to be renamed to
`jupyter-message-*-request` from `jupyter-*-request`.
2018-01-02 13:50:08 -06:00
Nathaniel Nicandro
714b23c12f Guard against empty messages when flags are used 2017-12-27 00:17:03 -06:00
Nathaniel Nicandro
6721f91b08 Only attempt to decode time when a date field exists 2017-12-27 00:16:11 -06:00
Nathaniel Nicandro
785c8242d8 Fix time decoding 2017-12-27 00:13:43 -06:00
Nathaniel Nicandro
2616f5d49b Decode datetime into time objects, add more convenience functions 2017-12-22 00:38:03 -06:00
Nathaniel Nicandro
72ab6b1d9e JSON encoded plists convert nil to {} 2017-12-21 18:10:19 -06:00
Nathaniel Nicandro
0f44d88874 Add fractional seconds in timestamp 2017-12-21 18:09:45 -06:00
Nathaniel Nicandro
1e246ee480 [WIP] Move all socket communication to a subprocess
With this new implementation, all communication between the kernel and the
client happens in a subprocess. When the client would like to send a message,
the parent emacs process generates the required plist and sends it to the
subprocess for encoding and sending to the kernel. When a message is received,
the subprocess decodes it and prints it to the pipe for the parent emacs
process to read.

This implementation also introduces the use of futures to avoid having to wait
for subprocess output when sending a message to the kernel. Every
`jupyter-request-*` function now returns a primitive future object which is
just a cons cell with the `car` equal to `:jupyter-future`. When the `cdr` of
the future is non-nil, then it is the message ID of the sent request. This acts
as a check to ensure that the message ID is available from the future object,
if the `cdr` is nil the ID is not available, but if the `cdr` is non-nil then
it is the message ID. The convenience function `jupyter-ensure-id` ensures that
the message ID is available and returns the ID.

The future acts as a stand in for the message ID of the encoded request which
will be retrieved from the subprocess once the message has been encoded and
sent to the kernel. This future object is meant to be passed to
`jupyter-add-receive-callback` and other related functions the same way as an
actual message id.
2017-12-17 02:53:15 -06:00
Nathaniel Nicandro
ac8322cb97 More documentation on variables 2017-12-15 22:29:05 -06:00
Nathaniel Nicandro
ede2dacdd4 Convenience functions for handling messages 2017-12-15 22:28:45 -06:00
Nathaniel Nicandro
ad53e098f6 Move jupyter--received-message-types to jupyter-messages.el
Also fix naming issue, previously `recieved` when it should have been `received`.
2017-12-15 18:16:53 -06:00
Nathaniel Nicandro
d2654de9f6 Use the random state that is already present for generating UUID's
`cl-make-random-state` only creates a random state based on time with seconds
resolution.
2017-12-14 16:14:12 -06:00
Nathaniel Nicandro
725648e10d All messages sent use keys
Also use a variable `jupyter--false` instead of `:json-false` for possibly
supporting other encodings in the future.
2017-12-14 13:53:52 -06:00
Nathaniel Nicandro
bab7305cc8 Mark functions as private 2017-12-14 13:53:48 -06:00
Nathaniel Nicandro
76cf1c5eb7 Semi working prototype 2017-12-13 11:27:13 -06:00