Commit graph

1739 commits

Author SHA1 Message Date
Nathaniel Nicandro
3509cccbda Prioritize shell messages more than others
This avoids problems with a reply message and a status idle message being
received at identical times for a request. Two messages can be received at the
same time when the fractional seconds resolution of the time stamps received
from the kernel are not high enough. If the iopub channel had a higher priority
it would mean that the idle message would be received before the reply when
they have identical time stamps. Since request objects are removed from the
client when an idle message is received this would prevent any reply callbacks
from running.

To combat this problem, prioritize the shell messages over any other type of
message.
2018-01-06 19:55:44 -06:00
Nathaniel Nicandro
9dd45c6f3e Be consistent with how other channels are stopped
Specifically move the `jupyter-channel-alive-p` check into
`jupyter-stop-channel` for the heartbeat channel.
2018-01-06 19:54:40 -06:00
Nathaniel Nicandro
b1c96bd286 Only bind json variables when calling json-read-file 2018-01-06 19:54:40 -06:00
Nathaniel Nicandro
c143557fb9 Care more about the width of lines 2018-01-06 19:54:40 -06:00
Nathaniel Nicandro
bb55075080 Remove a redundant check of jupyter-request-idle-received-p 2018-01-06 19:54:36 -06:00
Nathaniel Nicandro
5ab0534eb4 Don't use cond as a variable name 2018-01-06 19:53:46 -06:00
Nathaniel Nicandro
bcaa7ef2d7 Add jupyter-request-inhibit-handlers for convenience 2018-01-06 19:53:46 -06:00
Nathaniel Nicandro
068f09fa9e Update callback interface
- Introduce `run-handlers-p` for `jupyter-request` objects. When this field is
  non-nil, a clients `jupyter-handle-message` method will pass the message to
  the channels `jupyter-handle-message` after running any callbacks. Otherwise
  the channel handlers will not be run. This gives a way to suppress the
  channel handlers for a request.

- Also remove the use of `jupyter-callback` since `jupyter-handle-message` for
  a client just removes requests when an idle message is received. The callback
  object was used to check if a callback actually ran.
2018-01-06 19:47:47 -06:00
Nathaniel Nicandro
3c8cfee3ac Introduce the jupyter-handle-message method
This method dispatches to the appropriate message handlers based on the type of
channel passed to `jupyter-handle-message`. This method is also defined for a
`jupyter-kernel-client` in which case any callbacks for a message will be run
and then the message passed to the channel handlers.
2018-01-06 19:43:21 -06:00
Nathaniel Nicandro
bf81372d7a Update documentation of jupyter-wait-until-idle 2018-01-06 19:27:01 -06:00
Nathaniel Nicandro
745c08f0f6 Use with-timeout in jupyter-wait-until 2018-01-06 19:27:01 -06:00
Nathaniel Nicandro
bfb4f335c8 Cleanup comments, fix indentation, fix argument name 2018-01-06 19:27:01 -06:00
Nathaniel Nicandro
2d16ab4900 Refactor ioloop subprocess communication
- Only modify/access the `:jupyter-pending-requests' property of the ioloop
  subprocess through `jupyter--ioloop-pop-request' and
  `jupyter--ioloop-push-request'

- Push a message into a channels receive queue using
  `jupyter-channel-push-message'
2018-01-06 19:27:00 -06:00
Nathaniel Nicandro
e54ab6e899 Append -reply to reply message handler method names 2018-01-06 19:26:53 -06:00
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
064bf4f031 Add functions to work with a jupyter-channel's recv-queue` 2018-01-02 13:50:13 -06:00
Nathaniel Nicandro
5f2f9fbb3a Cleanup tests to take into account changes in jupyter-client 2018-01-02 13:50:13 -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
8d20384bf3 Remove the need to specify a client in the callback interface
- Also rename `jupyter-add-receive-callback` to `jupyter-add-callback`
2017-12-31 14:17:56 -06:00
Nathaniel Nicandro
276d7a5b53 Cleanup documentation and comments 2017-12-31 13:16:59 -06:00
Nathaniel Nicandro
7ed9f8f147 No need to update the execution counter in an execute result message 2017-12-31 11:50:36 -06:00
Nathaniel Nicandro
3ab46c590e Add code to input history when executing 2017-12-31 11:49:18 -06:00
Nathaniel Nicandro
00e030daa1 Remove unnecessary code when truncating the REPL buffer 2017-12-31 11:48:44 -06:00
Nathaniel Nicandro
4135e00ed1 Add initial support for payloads 2017-12-31 11:48:18 -06:00
Nathaniel Nicandro
d6d5c2a7bd Complete word down to previous space on the current line 2017-12-31 11:47:18 -06:00
Nathaniel Nicandro
237c38d261 Fix fontification of company doc buffers 2017-12-31 11:46:23 -06:00
Nathaniel Nicandro
5c80b4c56f Remove input-start-marker for REPL clients 2017-12-31 11:45:55 -06:00
Nathaniel Nicandro
fd1b9c8ada Add missing REPL prompt variable 2017-12-31 11:45:32 -06:00
Nathaniel Nicandro
311df47325 Return the correct value in jupyter-repl-kill-buffer-query-function 2017-12-31 11:44:31 -06:00
Nathaniel Nicandro
a3fa6d5231 Add documentation, cleanup comments 2017-12-31 11:44:10 -06:00
Nathaniel Nicandro
1b45b1996d Break up REPL initialization into functions 2017-12-31 11:41:53 -06:00
Nathaniel Nicandro
4edf67655c Use jupyter-repl-indent-line when the kernel does not provide identation 2017-12-31 11:39:32 -06:00
Nathaniel Nicandro
1754c8ce3d Add rudimentary history navigation 2017-12-31 10:17:18 -06:00
Nathaniel Nicandro
d9ec556579 Use the jupyter-repl-do-at-request macro 2017-12-31 10:15:19 -06:00
Nathaniel Nicandro
4ad7cd299e Use predicate functions instead of checking text properties 2017-12-31 10:12:50 -06:00
Nathaniel Nicandro
3325ae511a Add missing jupyter-repl-cell-request function 2017-12-31 10:11:50 -06:00
Nathaniel Nicandro
50a2464241 Use overlays for prompts and cleanup how they are inserted 2017-12-31 10:09:45 -06:00
Nathaniel Nicandro
619bf87c69 Handle edge cases in jupyter-repl-goto-request 2017-12-31 09:52:21 -06:00
Nathaniel Nicandro
126fb97b2d Generalize insertion of mimetype data 2017-12-31 09:37:56 -06:00
Nathaniel Nicandro
557e97c179 Fix subprocess sentinel event checking 2017-12-30 23:35:04 -06:00
Nathaniel Nicandro
c7c200d571 Heartbeat channels are implemented with timers instead of a subprocess 2017-12-30 23:32:17 -06:00
Nathaniel Nicandro
b57040e96c Fix wrong function name 2017-12-28 09:47:16 -06:00
Nathaniel Nicandro
8ac10186f2 Change the way prompts are displayed
Allow for visually displaying a cell as busy when submitting the cell's code
and only remove the busy status when the cell receives its execute reply. This
allows for queuing of code cells instead of having to wait for a code cell to
complete.
2017-12-28 09:45:03 -06:00
Nathaniel Nicandro
397e0526d0 Use text property functions instead of field based ones 2017-12-28 09:43:36 -06:00
Nathaniel Nicandro
082bf0e40c Use jupyter-repl-newline 2017-12-27 22:21:10 -06:00
Nathaniel Nicandro
3270fdf141 Refactor execute result handler 2017-12-27 22:17:38 -06:00
Nathaniel Nicandro
27d4283331 Add code sections 2017-12-27 21:55:58 -06:00
Nathaniel Nicandro
fc5b58e355 Add company backend handler when initializing jupyter-repl-mode 2017-12-27 21:55:16 -06:00
Nathaniel Nicandro
9ba4c4125f Tag prompt cells with their requests
- Add a text property `jupyter-request` to the start of an input cell which
  gets filled with the `jupyter-request` object returned by the
  `jupyter-request-execute` method. This way REPL cells can be queued behind
  long running calculations and their proper location found when the kernel
  sends back output or results for the request.
2017-12-27 21:55:04 -06:00