Commit graph

949 commits

Author SHA1 Message Date
Nathaniel Nicandro
8f0acca6df Move output buffer related functions to jupyter-base.el
* jupyter-repl.el (jupyter-output-buffer-marker, jupyter-output-buffer-request-id):
(jupyter--reset-output-buffer-p, jupyter-with-output-buffer): Do it.
(jupyter-repl-get-special-buffer): Do it and rename to jupyter-get-buffer-create.

* jupyter-client.el: See above.
2018-11-13 18:17:44 -06:00
Nathaniel Nicandro
ba13ef2419 Move inspection related functions to jupyter-client.el
* jupyter-repl.el (jupyter-inspect, jupyter-inspect-at-point): Do it.

* jupyter-client.el: See above.
2018-11-13 18:17:44 -06:00
Nathaniel Nicandro
10d1e18ffa jupyter-hb--send-ping: Refactor for readability 2018-11-13 17:47:55 -06:00
Nathaniel Nicandro
ff2feaab69 jupyter-shutdown-kernel: Report progress when shutting down 2018-11-13 17:47:55 -06:00
Nathaniel Nicandro
9aff88331a jupyter-start-new-kernel: Simplify
Remove the need to wrap in a progn. Un-pause heartbeat after waiting so that we
know for sure the kernel can be communicated with.
2018-11-13 17:47:55 -06:00
Nathaniel Nicandro
0c8edf9928 Update jupyter-ioloop-wait-until
It now takes the same arguments as `jupyter-wait-until` and behaves in much the
same way.

* jupyter-ioloop.el (jupyter-ioloop-wait-until): Add CB and PROGRESS-MSG
arguments. Use `jupyter-with-timeout`. Behave in the same way as
`jupyter-wait-until`, but for EVENT. Update all callers.
(jupyter-ioloop-last-event): New function.
(jupyter-ioloop-handler):
Add :before method that saves the last event.
Remove unnecessary methods.
Don't raise an error on built-in ioloop events in fall-back method.
2018-11-13 17:47:55 -06:00
Nathaniel Nicandro
84695e98d0 jupyter-start-channel: Don't un-pause the heartbeat channel
Starting a channel means that it is open for communication. It is already
un-paused by jupyter-start-new-kernel, so it is ok to make this change here.
2018-11-13 17:46:19 -06:00
Nathaniel Nicandro
d083ff5746 jupyter-hb-unpause: Simplify 2018-11-13 17:46:19 -06:00
Nathaniel Nicandro
a82ae13438 Add jupyter-with-timeout macro
* jupyter-base.el (jupyter-default-timeout)
(jupyter-long-timeout): Moved from jupyter-client.el
(jupyter-with-timeout): Do it.

* jupyter-client.el (jupyter-wait-until): Use it.

* jupyter-kernel-manager.el (jupyter-shutdown-kernel)
(jupyter-interrupt-kernel, jupyter-start-new-kernel):
(jupyter-start-kernel): Use it.

use timeout
2018-11-13 17:46:19 -06:00
Nathaniel Nicandro
bbf1d19af3 jupyter-drop-request: Decouple debugging statements from primary method
* jupyter-client.el (jupyter-drop-request):
New :before method that prints debugging statements.
Remove debugging statements from primary method.
2018-11-13 17:46:19 -06:00
Nathaniel Nicandro
82e0e2cda9 jupyter-ioloop-printer 2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
f18c3dfcc6 jupyter-finalize: Kill process if necessary
If an error happens early, the process won't get killed before we kill the
buffer.

* jupyter-client.el (jupyter-finalize): Do it.
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
af32a3352f Promote the execution-state to be a slot of jupyter-kernel-client
* jupyter-client.el (jupyter-kernel-client): Do it.
(jupyter-run-hook-with-args-until-success): Pass client as first argument to
hooks.
(jupyter-execution-state): New convenience function.
(jupyter--set-execution-state): New helper function. Add as global IOPUB
message hook to set the execution-state slot.

* jupyter-repl.el (jupyter-repl-client): Remove execution-state slot.
(jupyter-handle-status): Don't set the execution-state slot.
(jupyter-repl-ret, jupyter-repl-interaction-mode-line): Use
jupyter-execution-state.
(jupyter-repl-initialize-hooks): Take into account changes to message hooks.

* jupyter-kernel-manager (jupyter-start-new-kernel): Update callback.
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
9f2c88d252 Refactor callback handling
* jupyter-client.el (jupyter--run-callbacks): Simplify.
(jupyter--set-callback): New macro.
(jupyter--add-callback): Use new macro.
(jupyter-add-callback): Make more readable.

callbacks
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
0221a9571d Light refactoring
* jupyter-client.el (jupyter-wait-until): Let `with-timeout` handle errors.
(jupyter--run-handler-maybe, jupyter-add-callback):
(jupyter-kernel-info): Readability.
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
8a6aa9baf5 Refactor client channel methods
* jupyter-client.el (jupyter-initialize-connection):
Stop channels if any are running.
Fix wrong usage of collect when constructing channel plist.
(jupyter-ioloop-handler): Remove usage of `with-slots` when a slot is only
accessed once.
(jupyter-start-channel, jupyter-stop-channel): Split waiting for channel to
start/stop into an :after method. Verify CHANNEL argument is valid.
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
19868e3ec9 Use jupyter-channel-alive-p instead of testing socket directly
* jupyter-channels (jupyter-hb-pause, jupyter-channel--reset-socket): Do it.
(jupyter-start-channel): Always reset the socket.
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
bd5d4d3eea jupyter-repl-append-output: Revert usage of with-silent-modifications
Font locking is actually still needed when appending output. It's not enough to
temporarily disable it and insert since the text we inserted doesn't get font
locked properly. This is most notable when inserting markdown text.
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
4dc229935b jupyter-messages.el: Update commentary 2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
1371947785 jupyter-message-type-as-keyword: Simplify loop
* jupyter-messages.el (jupyter-message-type-as-keyword): Do it.
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
d3dc23d2b1 jupyter--decode: Simplify post processing of :msg_type key
* jupyter-messages.el (jupyter--decode): Do it.
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
0fb39492e3 jupyter-encode-message: Refactor
* jupyter-messages.el (jupyter-encode-message): Do it.
(jupyter--message-header): Require MSG-ID argument. Given by
`jupyter-encode-message'.
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
344e7b72ce jupyter--split-identities: Simplify loop
* jupyter-messages.el (jupyter--split-identities): Do it.
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
d124ea2d64 jupyter-decode-message: Remove unnecessary quoting
* jupyter-messages.el (jupyter-decode-message): Do it.
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
8c870cf592 jupyter-sign-message: Simplify loop
* jupyter-messages.el (jupyter-sign-message): Do it.
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
7aa43f6464 Decode :date fields on demand
* jupyter-messages.el (jupyter--decode): Remove handling of :date field.
(jupyter-message-time): Decode :date field if necessary.
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
a93f38608c Allow a SIGNER argument to message encode, decode, and signing functions
* jupyter-messages.el: (jupyter--sign-message)
(jupyter--decode-message, jupyter--encode-message):
Promote to public functions. Update all callers.
(jupyter-sign-message): Add optional SIGNER argument.
(jupyter-decode-message, jupyter-encode-message): Add SIGNER key argument.
SIGNER argument defaults to `jupyter-hmac-sha256`
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
0a127766f5 Re-organize code
* jupyter-org-client.el (jupyter-org-result): Move :around method of :text/plain
  results near the :text/plain primary method.
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
6c16d184b3 jupyter-handle-message: Let bind `jupyter-current-client' when handling messages
This is necessary to allow for the `jupyter-lang' method specializer to work in
contexts other than the REPL buffer, such as in an `org-mode` buffer when
handling `jupyter-org-request' objects.

* jupyter-client.el (jupyter-handle-message): (CLIENT ...) Do it.

* jupyter-org-client.el (jupyter-org-add-result):
Don't let bind `jupyter-current-client`.
Remove CLIENT argument. Update all callers.
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
a819067e6c Implement the jupyter-org-result method
This is in replacement of the `jupyter-org-prepare-result` and
`jupyter-org-transform-result`. A single method with both primary and :around
methods is sufficient.

* jupyter-org-client.el (jupyter-org-mime-types): New variable.
(jupyter-org-prepare-and-add-result): Remove.
(jupyter-handle-execute-result, jupyter-handle-display-data):
Do the work previously done by `jupyter-org-prepare-and-add-result`.
Abstract out the python handling to a `jupyter-org-result` method.
(jupyter-org--image-result): Add PARAMS argument.
Move setup done previously in `jupyter-org-prepare-result` to this function.
(jupyter-org-prepare-result): Remove.
Replace with calls to the `jupyter-org-result' method.
(jupyter-org-result): New method.
(text/html) Remove special handling of <img> tags, this was done due to old
versions of the Julia kernel.
(jupyter-org-transform-result): Remove.
Replace with a `jupyter-org-result` :around method.
Remove all callers.

* jupyter-python.el (jupyter-org-transform-result): Remove.
Replace with a `jupyter-org-result` :around method.

* jupyter-tests.el (jupyter-org-result): Add tests.

org-result
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
175a09b3c5 Make jupyter-org-clear-request-id a private function
* jupyter-org-client.el (jupyter-org-clear-request-id): Rename to
  `jupyter-org--clear-request-id`.
All callers changed.
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
f64a84c923 Simplify setting of :silent slot for `jupyter-org-request' objects
* jupyter-org-client.el (jupyter-generate-request): Do it.
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
0c504856d0 Add jupyter-loop-over-mime
* jupyter-base.el (jupyter-loop-over-mime): Do it.
(jupyter-insert): (PLIST ...) Use it.

* jupyter-tests.el (jupyter-loop-over-mime): Add test.
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
72caad77e8 Add tests for jupyter-insert with display IDs 2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
08363178ac jupyter-mime.el: Mention all methods defined in the file 2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
c4f37a0156 Implement rudimentary Jupyter display API
Adds methods which operate on Jupyter displays. A Jupyter display is a part of
the frame tagged with a display ID. The current implementation just associates
part of a buffer with a jupyter-display text property and demarcates the
beginning of a display with a jupyter-display-begin property.

* jupyter-mime.el (jupyter-current-display):
(jupyter-beginning-of-display):
(jupyter-end-of-display):
(jupyter-next-display-with-id):
(jupyter-delete-current-display): New methods to work with display IDs.
(jupyter-update-display): Ditto. Was previously a function.

* jupyter-repl.el (jupyter-handle-display-data): Remove handling of
`jupyter-display-ids`.
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
126d4bacf8 jupyter-update-display: Be more efficient when replacing displays
Instead of re-computing the inserted data whenever multiple displays exist with
the same ID, copy the previously inserted region to all other regions.

* jupyter-mime.el (jupyter-update-display): Do it.
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
8146fe660f Move display ID routines from jupyter-repl.el to jupyter-mime.el
jupyter-mime.el might not be the best place for these functions but they are
moved there because that is the current location of `jupyter-insert-with-id`.

* jupyter-repl.el (jupyter-repl-next-display-with-id):
(jupyter-repl-update-display): Move to jupyter-mime.el, replace `jupyter-repl-`
prefix with `jupyter-`.
(jupyter-delete-display-at-point): Move to jupyter-mime.el.
(jupyter-handle-update-display-data): Replace occurrence of
`jupyter-repl-update-display` with `jupyter-update-display`.

* jupyter-mime.el (jupyter-next-display-with-id):
(jupyter-delete-display-at-point):
(jupyter-update-display): Moved from jupyter-repl.el, which see. Promote
`jupyter-next-display-with-id` and `jupyter-delete-display-at-point` to
methods. This is in anticipation of having other kinds of displays besides text
in a buffer, e.g. controlling the display of an external browser.
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
321efd4c9c Refactor jupyter-repl-update-display
* jupyter-repl.el (jupyter-delete-display-at-point): New helper function.
(jupyter-repl-update-display): Use new helper function. Use
`jupyter-with-insertion-bounds` to obtain the region to highlight after
insertion. Use `jupyter-insert-with-id` for insertion. Use
`pulse-momentarily-highlight-region`.
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
df64f6b801 Add jupyter-fontify-region-according-to-mode
* jupyter-mime.el (jupyter-fontify-region-according-to-mode): Do it.

* jupyter-python.el (jupyter-insert): Use it.
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
e01f8df624 Remove jupyter-repl-insert-message
The purpose of this function was to conveniently insert a message property list
and allow contributors to perform post insert fixing up depending on the
mimetype inserted via the method `jupyter-repl-after-insert-message`. This same
effect can be done by extending `jupyter-insert` without the need of adding a
new method.

* jupyter-repl.el (jupyter-repl-insert-message):
(jupyter-repl-after-insert-message): Remove.
(jupyter-inspect): Replace calls to `jupyter-repl-insert-message` with
`jupyter-insert`.

* jupyter-python.el (jupyter-repl-after-insert-message): Replace with
`jupyter-insert` :around method.
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
092b7f9853 Refactor of fontification routines
* jupyter-mime.el (jupyter-fontify-buffer-name): New helper function.
(jupyter-get-fontify-buffer): Rename to `jupyter-fontify-buffer`. Use
`jupyter-fontify-buffer-name`.
(jupyter-fontify-according-to-mode): Replace call of
`jupyter-get-fontify-buffer` with `jupyter-fontify-buffer`. Remove
`with-silent-modifications`, this prevents modes like markdown from being
fontified correctly.

Allow modifications otherwise markdown mode doesn't work
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
227b4fde49 Use jupyter-with-insertion-bounds in more places
* jupyter-mime.el (jupyter--delete-javascript-tags): Now takes bounds of region
to check as arguments.
(jupyter-insert-html): Do it.
(jupyter-insert-latex): Do it.
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
959eb0b9b7 Use delay-mode-hooks
* jupyter-mime (jupyter-get-fontify-buffer): Do it.
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
75a08c26d0 Implement jupyter-insert method
The goal of this method is to act as a single entry point for insertion of
kernel results in any context. One would simply add another method to handle a
specific context.

* jupyter-base.el (jupyter-mime-types):
(jupyter-nongraphic-mime-types): New variables that give mime-types that can be
handled.
(jupyter-insert): New method for dispatching to code that inserts mimetype
representations in the current buffer.

* jupyter-mime.el: New file.
(jupyter-display-ids):
(jupyter-handle-control-codes):
(jupyter-fontify-buffers):
(jupyter-get-fontify-buffer):
(jupyter-fixup-font-lock-properties):
(jupyter-add-font-lock-properties):
(jupyter-fontify-according-to-mode):
(jupyter-insert-html):
(jupyter-markdown-mouse-map):
(juputer-markdown-follow-link-at-point):
(jupyter-insert-markdown):
(jupyter-insert-latex):
(jupyter-insert-ansi-coded-text): Moved from jupyter-repl.el, replaced
`jupyter-repl-` prefix with `jupyter-`.
(jupyter--shr-put-image): Ditto. Also add `shr-` prefix.
(jupyter--delete-javascript-tags): Ditto. Also mark as private functions.
(jupyter-insert-image): Ditto. Also mark as a public function.
(jupyter-insert): (DISPLAY-ID ...) Moved from jupyter-repl.el. Was
`jupyter-repl-insert-data-with-id`.
(jupyter-with-control-code-handling):
(jupyter-markdown-follow-link): Moved from jupyter-repl.el
(jupyter-insert): Implement methods to do the work previously done by
`jupyter-repl-insert-data`.

* jupyter-repl.el (jupyter-repl-graphic-mimetypes): Moved to jupyter-base.el,
 inverted and renamed to `jupyter-nongraphic-mime-types`.
(jupyter-repl-graphic-data-p): Remove unused function.
(jupyter-repl-insert-data): Remove, replace calls with `jupyter-insert`.
(jupyter-repl-add-font-lock-properties):
(jupyter-repl-fixup-font-lock-properties):
(jupyter-repl-get-fontify-buffer):
(jupyter-repl-fontify-according-to-mode):
(jupyter-repl-delete-javascript-tags):
(jupyter-repl-put-image):
(jupyter-repl-insert-html):
(jupyter-repl-markdown-mouse-map):
(jupyter-repl-markdown-follow-link-at-point):
(jupyter-repl-insert-markdown):
(jupyter-repl-insert-latex):
(jupyter-repl--insert-image): Moved to jupyter-mime.el, which see.
(jupyter-repl-insert-data-with-id): Ditto. Changed to a `jupyter-insert` method
dispatched on a string argument.
(jupyter-repl-insert-ansi-coded-text): Ditto. Replace calls with
`jupyter-insert-ansi-coded-text`.
(jupyter-with-control-code-handling):
(jupyter-markdown-follow-link): Moved to jupyter-mime.el.

* jupyter-org-client.el (jupyter-handle-error): Replace
  `jupyter-repl-insert-ansi-coded-text` with `jupyter-insert-ansi-coded-text`.

* jupyter-tests.el (jupyter-insert): Add tests for `jupyter-insert`
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
08a20ebf71 Update tests
* jupyter-tests.el (jupyter-with-echo-client): Call `jupyter-finalize`.
(jupyter-channels): Remove references to asynchronous
channels and old channel slots of a `jupyter-kernel-client`. Replace with
using the new `channels` slot of a `jupyter-kernel-client`.
(jupyter-messages): Test message signing and decoding.
(jupyter-ioloop-test-handler-called): New variable for tests.
(jupyter-ioloop-handler): New method for tests.
(jupyter-ioloop-lifetime):
(jupyter-ioloop-setup):
(jupyter-ioloop-teardown):
(jupyter-ioloop-add-event):
(jupyter-channel-ioloop-send-event):
(jupyter-channel-ioloop-start-channel-event):
(jupyter-channel-ioloop-stop-channel-event): New tests.
(jupyter-channels): Split into `jupyter-sync-channel`, `jupyter-hb-channel`.
(jupyter-test-conn-info-plist): New function for tests.
(jupyter-client): Split into `jupyter-initialize-connection`,
`jupyter-inhibited-handlers`. Remove `jupyter-finalizer` test.
(jupyter-client-channels): New test.
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
12085afa96 Add jupyter-channel-ioloop
This commit extracts out the IOLoop functions which are used to define an
IOLoop that send and receive messages on Jupyter channels into is own object.

* jupyter-channel-ioloop.el: New file.
(jupyter-channel-ioloop): A sub-type of `jupyter-ioloop` that sets up an IOLoop
to send/receive messages on Jupyter channels.
(jupyter-ioloop-channels):
(jupyter-ioloop-session): New variables used in `jupyter-channel-ioloop`
events.
(jupyter-ioloop-add-arg-type jupyter-channel): Moved from `jupyter-client.el`.
(jupyter-channel-ioloop-add-session): New function.
(jupyter-ioloop-start): Setup ioloop to communicate with Jupyter channels.
(jupyter-channel-ioloop-recv-messages):
(jupyter-channel-ioloop-add-start-channel-event):
(jupyter-channel-ioloop-add-stop-channel-event):
(jupyter-channel-ioloop-add-send-event): Moved from `jupyter-client.el`,
replaced jupyter-ioloop prefix with jupyter-channel-ioloop.

* jupyter-client.el: Require `jupyter-channel-ioloop` instead of
`jupyter-ioloop`.
(jupyter-kernel-client): Change type of `ioloop` to `jupyter-channel-ioloop`.
(jupyter-client--ioloop-setup-form): Remove.
(jupyter-ioloop-add-arg-type jupyter-channel): Move to
`jupyter-channel-ioloop.el`.
(jupyter-ioloop-add-start-channel-event):
(jupyter-ioloop-add-stop-channel-event):
(jupyter-ioloop-add-send-event): Move to `jupyter-channel-ioloop.el`, replace
jupyter-ioloop prefix with jupyter-channel-ioloop.
(jupyter-ioloop-start): Remove.
(jupyter-start-channels): Ensure `jupyter-ioloop-start` method of
`jupyter-channel-ioloop` is called. Set ioloop process buffer to `-buffer` slot
of client.

* jupyter-ioloop.el (jupyter-ioloop-start): Remove :before method.
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
6942a20e8a Add new jupyter-ioloop implementation
A `jupyter-kernel-client' defers most of its message sending, receiving, and
message processing to a subprocess which sends its messages to the kernel
through zmq sockets and polls for any messages to received from the kernel.
This commit generalizes this by introducing a new `jupyter-ioloop` type which
encapsulates the subprocess and the code necessary to build up the function
that does the work of communicating with a kernel in the subprocess
environment.

* jupyter-channels.el: Remove `jupyter-async-channel`

* jupyter-ioloop.el: New file.
(jupyter-ioloop-poller):
(jupyter-ioloop-nsockets):
(jupyter-ioloop-pre-hook):
(jupyter-ioloop-post-hook):
(jupyter-ioloop--argument-types): New variables.
(jupyter-ioloop): New function to create `jupyter-ioloop` objects.
(jupyter-ioloop-add-setup):
(jupyter-ioloop-add-teardown):
(jupyter-ioloop-add-arg-type):
(jupyter-ioloop-add-event): New macros.
(jupyter-ioloop-handler):
(jupyter-ioloop-add-callback):
(jupyter-ioloop-start):
(jupyter-ioloop-stop): New methods.
(jupyter-send): Method addition for `jupyter-ioloop` objects.
(jupyter-ioloop-wait-until): Moved function from `jupyter-client.el`, changed
argument order.
(jupyter-ioloop--replace-args):
(jupyter-ioloop--event-dispatcher):
(jupyter-ioloop--function):
(jupyter-ioloop--filter):
(jupyter-ioloop--sentinel): Helper functions.

* jupyter-client.el: Add `jupyter-ioloop` require.
Remove `jupyter-shell-channel`, `jupyter-iopub-channel`,
`jupyter-stdin-channel` classes.
(jupyter-kernel-client): Change type of `ioloop` slot to `jupyter-ioloop`,
remove `shell-channel`, iopub-channel`, `stdin-channel`, and `hb-channel`
slots. Add `channels` slot.
(jupyter-initialize-connection): Replace channel initialization with
initialization of new `channels` slot.
(jupyter-send): Add better assertion. Call an ioloop's `jupyter-send` method.
Expect a Jupyter channel keyword as the `channel` argument.
(jupyter--ioloop-do-command):
(jupyter--ioloop-with-lock-file):
(jupyter--ioloop-unlock):
(jupyter--ioloop-lock):
(jupyter--ioloop):
(jupyter--ioloop-sentinel):
(jupyter--get-channel):
(jupyter--ioloop-filter):
(jupyter--start-ioloop): Remove functions/macros.
(jupyter-ioloop-wait-until): Move to `jupyter-ioloop.el`
(jupyter-hb-pause):
(jupyter-hb-unpause):
(jupyter-hb-beating-p): Use `channels` slot.
(jupyter-client--ioloop-setup-form): New constant.
(jupyter-ioloop-add-arg-type): New jupyter-channel argument type.
(jupyter-ioloop-add-start-channel-event):
(jupyter-ioloop-add-stop-channel-event):
(jupyter-ioloop-add-send-event): New `jupyter-ioloop` event types for clients.
(jupyter-ioloop-start):
(jupyter-ioloop-handler): Method additions specializing to
`jupyter-kernel-client`s.
(jupyter-start-channel):
(jupyter-stop-channel):
(jupyter-channel-alive-p): Method additions for a client utilizing `channels` slot.
(jupyter-start-channels):
(jupyter-stop-channels):
(jupyter-channels-running-p): Use new `jupyter-ioloop` interface and channel
methods.
(jupyter-handle-message): (`jupyter-kernel-client` method) Add new `msg`
argument. Remove call to `jupyter-get-message`.
(jupyter-handle-message): (All channel methods) Replace
`jupyter-stdin-channel`, `jupyter-iopub-channel`, and `jupyter-shell-channel`
with `(eql :stdin)`, `(eql :iopub)`, and `(eql :shell)`
(jupyter-handle-input-request):
(jupyter-send-execute-request):
(jupyter-send-inspect-request):
(jupyter-send-complete-request):
(jupyter-send-history-request):
(jupyter-send-is-complete-request):
(jupyter-send-comm-info-request):
(jupyter-send-comm-open):
(jupyter-send-comm-msg):
(jupyter-send-comm-close):
(jupyter-sned-kernel-info-request):
(jupyter-send-shutdown-request): Remove uses of `shell-channel` and
`stdin-channel` slot. Pass in expected channel keyword as the `channel`
argument in the call to `jupyter-send`
2018-11-13 17:46:03 -06:00
Nathaniel Nicandro
dcd6e0fd25 Add jupyter-with-insertion-bounds
This function will prove useful in the future for applying text properties to
inserted text once the new `jupyter-insert` method is introduced.

* jupyter-base.el (jupyter-with-insertion-bounds): Add the new macro.

* jupyter-repl.el (jupyter-with-control-code-handling): Use it.
2018-11-10 08:41:13 -06:00
Nathaniel Nicandro
11dda1b9ab Prioritize images in org-mode buffers 2018-11-09 09:02:28 -06:00