It still sometimes isn't caught but it is more reliable. This mainly affects
testing.
* jupyter-client.el (jupyter-start-channels): Add a small delay after starting
channels.
* jupyter-kernel-manager.el (jupyter-start-kernel): Remove superfluous delay.
* jupyter-client.el (initialize-instance): Stop channels in finalizer.
* jupyter-ioloop.el (jupyter-ioloop--make-filter): New function.
(jupyter-ioloop-start): Make a weak reference OBJECT.
This did not prove useful since after carefully reading the documentation and
with my own tests, the lock files remained most of the time after Emacs
crashes.
* jupyter-ioloop.el (jupyter-ioloop): Inherit from jupyter-finalized-object.
Remove object slot.
(initialize-instance): New method addition.
(jupyter-ioloop--filter, jupyter-ioloop--sentinel): Remove.
(jupyter-ioloop-start): Pass closure as a filter function to the process.
(jupyter-ioloop-stop): No need to nil out process slot.
This is needed as opposed to eieio-instance-tracker so that we can create weak
references to objects. We don't want to have to manually delete an instance.
* jupyter-base.el (jupyter-instance-tracker): Do it.
(jupyter-all-objects): New function.
* jupyter-client.el (jupyter--clients): New variable.
(jupyter-kernel-client): Inherit from new class.
(jupyter-clients): Use jupyter-all-objects.
* jupyter-kernel-manager.el (jupyter-kernel-managers): New function.
* 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.
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.
* 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
* 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.
* 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
* 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.
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.