Commit graph

351 commits

Author SHA1 Message Date
Nathaniel Nicandro
ab79985580 Fix initialize-instance method signature 2019-05-09 10:56:02 -05:00
Nathaniel Nicandro
112769e0c6
Bump version 2019-05-04 03:31:50 -05:00
Nathaniel Nicandro
f744661ac7
jupyter-eval-string: Add callback for :display-data messages 2019-04-11 22:13:39 -05:00
Nathaniel Nicandro
6606fc65e5 Move all debug printing into jupyter-client.el 2019-04-11 20:13:44 -05:00
Nathaniel Nicandro
b2294dceb2 Generalize communication with a kernel
The previous mechanism to communicate with a kernel was too low level from the
perspective of a client. The client interfaced directly with the subprocess
abstraction, `jupyter-ioloop`, and had to handle all "events" that occurred in
the `jupyter-ioloop`, e.g. when a channel was started or stopped. But in
reality such events should not be the concern of a client.

A client should only care about events that are directly related to kernel
messages and not events related to the implementation details of *how*
communication occurs.

This commit abstracts out the way in which a client communicates with its
kernel by introducing a new `jupyter-comm-layer` class. The
`jupyter-comm-layer` class takes care of managing the communication channel
between a kernel and its clients as well as sending events to all registered
clients. This way, clients operate solely at the level of events on the
communication layer. All a client does is register itself to receive events on
the communication layer and send events on the layer.

* jupyter-base.el (jupyter-session-endpoints): New function.

* jupyter-client.el (jupyter-kernel-client): Remove ioloop and channels slots.
  Add kcomm slot.
(initialize-instance): Unconditionally stop channels.
(jupyter-initialize-connection): Change into a method call.
Call `jupyter-initialize-connection` on the `kcomm` slot.
(jupyter-with-client-buffer): Remove stale comment.
(jupyter-send): Call `jupyter-send` on the `kcomm` slot.
(jupyter-ioloop-handler): Remove all method definitions, replace `sent` and
`message` methods with their `jupyter-event-handler` equivalents.
(jupyter-hb-pause, jupyter-hb-unpause, jupyter-hb-beating):
(jupyter-channel-alive-p, jupyter-start-channel, jupyter-stop-channel):
(jupyter-start-channels, jupyter-stop-channels):
Replace with calls to their equivalents using the `kcomm` slot.

* jupyter-comm-layer.el: New file.

* jupyter-kernel-manager (jupyter-make-client): Set a client's `kcomm` slot to
  `jupyter-channel-ioloop-comm`.

* jupyter-messages.el (jupyter-decode-message): Use `list` directly. There
  seemed to be issues when using the new `jupyter-sync-channel-comm` due to
  using quoted lists.

* test/jupyter-test.el: Add `jupyter-comm-layer` test. Update other tests.

* test/test-helper.el: Add `jupyter-comm-layer` mock objects. Update
  `jupyter-echo-client`.
2019-04-11 20:13:44 -05:00
Nathaniel Nicandro
2cfdd6ecfb
Add jupyter-weak-ref(-resolve)? 2019-04-08 12:44:48 -05:00
Nathaniel Nicandro
03a8067e6e
jupyter-handle-message: Only examine :execute-reply of owned requests 2019-03-29 12:29:16 -05:00
Nathaniel Nicandro
d4e24d7870
jupyter-handle-message: Fix update of execution-count 2019-03-29 01:20:39 -05:00
Nathaniel Nicandro
2f18192ae7
Remove redundant :execute-input handlers
The `execution-count` slot of a `jupyter-kernel-client` is now updated higher
up in the message handling process which makes these handlers unnecessary.
2019-03-25 13:19:02 -05:00
Nathaniel Nicandro
a6e476a624
Update a client's execution-count slot on an :execute_input message 2019-03-24 00:11:22 -05:00
Nathaniel Nicandro
8c11fc0615
jupyter-initialize-connection: Refactor 2019-03-23 18:31:35 -05:00
Nathaniel Nicandro
e299a3b3eb
jupyter-code-context (completion): Only consider the deepest nested parenthesis level
This is a better default when considering kernels like Clojupyter.
2019-03-17 20:31:25 -05:00
Nathaniel Nicandro
ffb53244ce jupyter-completion--company-idle-begin: Shorter delay 2019-03-17 02:07:00 -05:00
Nathaniel Nicandro
5e1e30630b jupyter-handle-message: Properly handle :shutdown-reply
A shutdown-reply message received by a request implies that no other messages
will be received for that request since the kernel will shutdown. Also set
`jupyter-request-idle-received-p` to `t` in such cases.
2019-03-17 02:01:00 -05:00
Nathaniel Nicandro
08d974f4db jupyter-requests-pending-p: Fix issues and add test
* Use `hash-table-count`

* Fix the check on determining how many pending requests there are
2019-03-17 02:00:00 -05:00
Nathaniel Nicandro
89ab86ca18
jupyter-eval-string: Don't message error when traceback is being shown 2019-03-16 16:34:18 -05:00
Nathaniel Nicandro
4f168bfc47 jupyter-handle-message: Always handle a startup message 2019-03-14 19:57:00 -05:00
Nathaniel Nicandro
1cc29e2ba0 Add jupyter-requests-pending-p 2019-03-14 19:56:00 -05:00
Nathaniel Nicandro
83af335166
Bump version 2019-03-14 09:29:11 -05:00
Nathaniel Nicandro
6a81470be9
jupyter-eval-short-result-display-function: Don't fail when result has '%' characters 2019-03-14 09:16:44 -05:00
Nathaniel Nicandro
662e983612
Don't require subr-x at runtime 2019-03-14 09:16:44 -05:00
Nathaniel Nicandro
744e27e945
jupyter-eval-string: Don't inhibit :input-request handler
See #35.
2019-03-12 18:35:44 -05:00
Nathaniel Nicandro
fbbef48bee
jupyter-completion-at-point: Handle edge case
Some kernels (e.g. IPython) do not send a `:complete-reply` when the
`:complete-request` is empty, handle this case.
2019-03-07 23:16:37 -06:00
Nathaniel Nicandro
6894a73d57
Cleanup stale comments 2019-03-07 22:51:25 -06:00
Nathaniel Nicandro
581aab10b6
jupyter-kernel-language: Change return value to be a symbol
This avoids interning a string for every method dispatch using the
jupyter-lang method specializer.
2019-03-07 22:51:25 -06:00
Nathaniel Nicandro
57e9af3a13
jupyter-handle-message: Update execution-state for any status message 2019-03-02 18:14:49 -06:00
Nathaniel Nicandro
bdc52c485d
Add jupyter-pop-up-frame
Closes #34
2019-03-01 15:52:42 -06:00
Nathaniel Nicandro
484b0934a3 Fix typos 2019-02-17 23:06:00 -06:00
Nathaniel Nicandro
bad068f15b
jupyter--display-eval-result: Prefer markdown if available
If both plain text and markdown are provided, use markdown. IJulia provides
both representations when, e.g. asking for help on a symbol using ? at the
REPL.
2019-02-17 12:45:26 -06:00
Nathaniel Nicandro
249a088e2e
jupyter-handle-input-request: Be more secure when reading passwords 2019-02-17 12:19:16 -06:00
Nathaniel Nicandro
87f1acbf86
jupyter-read-expression: Show the language when prompting 2019-02-16 11:27:44 -06:00
Nathaniel Nicandro
67befbc10c
jupyter-channel-alive-p: Handle an invalid ioloop process 2019-02-14 23:48:51 -06:00
Nathaniel Nicandro
fafdf0d1b2 jupyter-code-context (completion): Larger context inside nested parens 2019-02-14 23:07:00 -06:00
Nathaniel Nicandro
d4969cbfcc CHANGELOG.org: Add function to change version numbers 2019-02-14 23:05:00 -06:00
Nathaniel Nicandro
32d886cf7e jupyter-eval-string: Better validation of jupyter-current-client 2019-02-14 16:11:00 -06:00
Nathaniel Nicandro
7f12b0e8e7
jupyter-read-expression: Proper use of history variable
Also add the read expression as a history element in the REPL history if the
client is a REPL client.
2019-02-13 16:50:51 -06:00
Nathaniel Nicandro
63717b9e39
Bump version 2019-02-12 09:17:06 -06:00
Nathaniel Nicandro
034f309222
Add jupyter-display-current-buffer-reuse-window
Closes #27.
2019-02-11 16:01:41 -06:00
Nathaniel Nicandro
7ddbcc1efc
Cleanup documentation 2019-02-10 02:25:05 -06:00
Nathaniel Nicandro
3d6dece151 Fix jupyter-inspect in org-mode 2019-02-09 14:33:00 -06:00
Sebastian Pech
81f9f60705 Add variables to customize how short evaluation results are displayed (#21)
* Add `jupyter-eval-short-result-display-function`

* Add `jupyter-eval-short-result-max-lines`
2019-02-08 19:28:54 -06:00
Nathaniel Nicandro
5f264ab03a
jupyter-eval-string: Remove redundancy 2019-02-07 13:34:36 -06:00
Nathaniel Nicandro
0a34860707
Fix package-lint errors 2019-02-07 11:17:24 -06:00
Nathaniel Nicandro
771e267034
Fix checkdoc errors 2019-02-06 22:49:41 -06:00
Nathaniel Nicandro
d709b31a64
Add jupyter-message-lambda
This simplifies the writing of message callbacks.
2019-01-22 18:39:17 -06:00
Nathaniel Nicandro
e01f09d97e
Add jupyter-kernel-busy-p 2019-01-18 22:06:37 -06:00
Nathaniel Nicandro
4795032335
jupyter-completion-prefix: Complete argument lists only in IJulia
Python will interpret a completion request here as asking for all possible
completions which is slow.
2019-01-18 22:02:24 -06:00
Nathaniel Nicandro
876c080f7f
Add jupyter-kernel-language-mode-properties and related functions 2019-01-17 19:53:04 -06:00
Nathaniel Nicandro
0dd3946e1e
jupyter-inspect: Increase default timeout 2019-01-16 17:54:59 -06:00
Nathaniel Nicandro
5689819fc6
jupyter-eval-string: Handle stderr 2019-01-16 17:54:44 -06:00