Commit graph

142 commits

Author SHA1 Message Date
Nathaniel Nicandro
e4c3088749 Add jupyter-inhibit-handlers
This removes the need for `jupyter-request-inhibit-handlers`
2018-01-17 20:34:32 -06:00
Nathaniel Nicandro
1159342c26 Make jupyter-initialize-connection a function instead of a method
Initializing a connection does not change depending on the client. Or at least
it doesn't seem likely.
2018-01-17 20:15:50 -06:00
Nathaniel Nicandro
91a45c3ce3 Remove :jupyter- prefix for ioloop process plist 2018-01-17 20:15:10 -06:00
Nathaniel Nicandro
bd1d4c8908 Fix callbacks when multiple callbacks exist for a single message type 2018-01-17 20:11:43 -06:00
Nathaniel Nicandro
3c1416a3f6 Add -buffer slot for a jupyter-kernel-client
Since client local variables are associated with a buffer a buffer needs to be
present when the client is first initialized. This buffer is also used as the
process buffer of the ioloop subprocess.
2018-01-16 12:08:33 -06:00
Nathaniel Nicandro
e9bd7e5542 Warn if the channel subprocess did not shutdown in time 2018-01-16 12:02:23 -06:00
Nathaniel Nicandro
123a51b648 Process the list of channels once in jupyter--ioloop-filter 2018-01-16 12:01:07 -06:00
Nathaniel Nicandro
06acb2ab8c Handle quit signal when sending input to a kernel 2018-01-16 11:58:55 -06:00
Nathaniel Nicandro
ce19029838 Revert back to old behavior in jupyter--ioloop-filter
Do not rely on message handling to be fast when processing subprocess output
2018-01-16 11:55:53 -06:00
Nathaniel Nicandro
a0effbf359 Use client local value of jupyter-include-other-output 2018-01-16 11:54:11 -06:00
Nathaniel Nicandro
b50522102f Use quoted lists 2018-01-16 11:53:35 -06:00
Nathaniel Nicandro
bb7cd76380 Handle signal interruptions when polling in the ioloop subprocess 2018-01-15 13:01:24 -06:00
Nathaniel Nicandro
faf1ee35e8 Run handler in ioloop filter
Do this because the process buffer is current in the filter, see
`zmq-start-process`. Since we store buffer local values of variables (like
message hooks) there we
would like to have access to them in the handlers.
2018-01-14 02:17:05 -06:00
Nathaniel Nicandro
3897eff3ba Update comment section headers 2018-01-13 22:51:27 -06:00
Nathaniel Nicandro
0ad92ce933 Fix use of jupyter-include-other-output 2018-01-13 14:05:03 -06:00
Nathaniel Nicandro
2d83b757a6 Fix problems with with-jupyter-client-buffer
- Supply `with-current-buffer` with an actual buffer
- Actually expand the `client` argument
2018-01-13 13:34:02 -06:00
Nathaniel Nicandro
a5d188e32f Move jupyter-wait-until-startup to jupyter-kernel-manager.el
Also make `jupyter-wait-until-startup` private by renaming to
`jupyter--wait-until-startup`. Startup messages are only sent once at kernel
startup, since the only way to start a kernel is through a
`jupyter-kernel-manager` it makes more sense to only allow a kernel manager to
wait for a startup message.
2018-01-12 18:14:04 -06:00
Nathaniel Nicandro
7d516f2126 No need for apply-partially 2018-01-12 18:07:39 -06:00
Nathaniel Nicandro
6b5742e4cf Introduce message hook variables for received messages
The `jupyter-<channel>-message-hook` variables (where <channel> is one of
`shell`, `stdin`, or `iopub`) are run as the first step when calling the
`jupyter-handle-message` methods for a channel. The hooks take a single
argument, the message which was received on the channel.

Adding a function to `jupyter-iopub-message-hook` in combination with setting
`jupyter-include-other-output` to t eliminate the need for
`jupyter-missing-request` which was a way to add callbacks for messages which
did not have a parent header. Namely the status: starting message.
2018-01-12 18:07:02 -06:00
Nathaniel Nicandro
eae62a50af Remove cl requirement
It was previously only used for `lexical-let`, but the file now sets
`lexical-binding` to t.
2018-01-12 17:51:31 -06:00
Nathaniel Nicandro
1a81182112 Add missing group definition 2018-01-12 17:51:16 -06:00
Nathaniel Nicandro
5f8717981b Add jupyter-include-other-output 2018-01-12 17:50:24 -06:00
Nathaniel Nicandro
10f8115b8e Add with-jupyter-client-buffer, jupyter-set, jupyter-get
Use a client's IOLoop subprocess buffer as a way to store variables local to a
client
2018-01-12 17:49:22 -06:00
Nathaniel Nicandro
8ac8d2de15 Update doc strings 2018-01-12 17:43:55 -06:00
Nathaniel Nicandro
15583eab19 Refactor of jupyter--ioloop-pop-request 2018-01-12 17:42:53 -06:00
Nathaniel Nicandro
12b11e421b Cleanup comments in jupyter-kernel-client shell handler method 2018-01-12 17:41:53 -06:00
Nathaniel Nicandro
af82c55b1c Introduce jupyter-wait-until-startup 2018-01-11 12:14:35 -06:00
Nathaniel Nicandro
8f774120c9 Better handling of when to remove requests from a client's request table
For each message received in response to a request, record the
`last-message-time` of any received messages for a request. When a request's
`idle-received-p` field is non-nil and the `last-message-time` is larger than
some number of seconds, remove the request from the request table.
2018-01-11 12:06:26 -06:00
Nathaniel Nicandro
62691611e4 Add jupyter--ioloop-collect-messages to simplify jupyter--ioloop even more 2018-01-11 12:04:42 -06:00
Nathaniel Nicandro
46b70e85d0 Refactor jupyter-initialize-connection
- Use `ignore-errors` around `jupyter-connection` slots since they can be
  inherited by the `parent-instance`. Note that checking if the slot is
  available does not also check if the slots availability in the
  `parent-instance`

- Set `addr` where it is used, namely in `cl-loop`
2018-01-11 00:26:03 -06:00
Nathaniel Nicandro
34b0d45078 Use quoted lists 2018-01-11 00:25:08 -06:00
Nathaniel Nicandro
56e5f047bd car instead of caar in jupyter--ioloop-queue-message
`elem` is a list not a list of lists
2018-01-11 00:22:19 -06:00
Nathaniel Nicandro
f705dc96fe Indentation 2018-01-09 00:44:35 -06:00
Nathaniel Nicandro
f3951ee9af Fix debug message 2018-01-09 00:44:35 -06:00
Nathaniel Nicandro
839e5d855a [WIP] Add ability to stop channels initially in jupyter-start-channels
Also add TODO about channel methods
2018-01-09 00:44:35 -06:00
Nathaniel Nicandro
a9f2bac2c8 Better logic on when to send queued messages in an ioloop subprocess 2018-01-09 00:44:34 -06:00
Nathaniel Nicandro
b198a02f45 Add note about how `jupyter-channel's are used in a client 2018-01-09 00:44:34 -06:00
Nathaniel Nicandro
912a367190 Error out when no ioloop process is present in jupyter-send 2018-01-09 00:44:34 -06:00
Nathaniel Nicandro
c358e37b23 Add missing initform 2018-01-09 00:44:34 -06:00
Nathaniel Nicandro
c7dee4aa55 Simplify kernel shutdown and interruptions in a kernel manager 2018-01-09 00:44:34 -06:00
Nathaniel Nicandro
9ba6ad331e Remove uses of lexical-let 2018-01-09 00:44:34 -06:00
Nathaniel Nicandro
326ff15d92 Add standard header comments 2018-01-09 00:44:33 -06:00
Nathaniel Nicandro
ebd616998e Add/update lots of documentation 2018-01-09 00:44:33 -06:00
Nathaniel Nicandro
7e36ea1101 Add jupyter-missing-request
This is a function which should be called on a `jupyter-kernel-client` and it
returns a request object which can be used to add callbacks to messages that
have no parent message such as the status: startup message sent be a kernel.
2018-01-09 00:44:33 -06:00
Nathaniel Nicandro
7169c5072a warn instead of error when handling unknown message types 2018-01-09 00:44:33 -06:00
Nathaniel Nicandro
44c75944d3 Fix missing argument 2018-01-09 00:44:33 -06:00
Nathaniel Nicandro
f904dc7d2a Rename jupyter-push-message -> jupyter-queue-message 2018-01-09 00:44:33 -06:00
Nathaniel Nicandro
c706d07f02 Refactor jupyter--ioloop
Break it into several macros which perform various subtasks like processing a
command received from the parent emacs process and collecting messages into a
sorted list based on `jupyter-message-time`
2018-01-09 00:44:33 -06:00
Nathaniel Nicandro
b846af6c00 Remove unreachable code 2018-01-07 19:54:52 -06:00
Nathaniel Nicandro
71c4314a86 jupyter-connection inherits from eieio-instance-inheritor
This way when creating kernel clients with `jupyter-kernel-manager`, we can set
the `parent-instance` of the newly created client to the manager thereby
inheriting the `jupyter-session` from the kernel manager.

Also have `jupyter-channel` objects inherit from a `jupyter-connection` so that
we can define `jupyter-send` and `jupyter-recv` methods for channels in the future.
2018-01-07 14:53:12 -06:00