This variable is `let` bound by `org-babel-execute:jupyter` and its value reset
after that function has completed and therefore does not need to be set to
`nil` by `jupyter-drop-request`.
fixes#234fixes#235
* jupyter-org-client.el: Remove duplicated `defvar` of
`org-babel-jupyter-current-src-block-params`.
(jupyter-drop-request): Remove use of
`org-babel-jupyter-current-src-block-params`.
* jupyter-org-client.el (jupyter-drop-request): Reset
`org-babel-jupyter-current-src-block-params` if its value matches the dropped
request's `block-params`.
* jupyter-base.el: Don't add `jupyter-server-mode--unset-client-soon` to
`server-switch-hook` at toplevel
(jupyter-server-mode-set-client): Add `jupyter-server-mode--unset-client-soon`
to `server-switch-hook` if necessary.
* jupyter-client.el: (jupyter--run-callbacks): Use `when-let`.
(jupyter--set-callback): Remove.
(jupyter--add-callback): Use `add-function`.
* jupyter-ioloop.el (jupyter-ioloop-add-arg-type): Use `setf` along with `alist-get`.
(jupyter-ioloop--replace-args): Use `pcase`.
(jupyter-ioloop--event-dispatcher): Extract out event cases into variable `user-events`.
(jupyter-ioloop--body): New function.
(jupyter-ioloop--function): Use it.
* jupyter-kernel-process-manager.el
(jupyter--kernel-died-process-sentinel)
(jupyter-stop-channels): Use `when-let`.
* jupyter-org-client.el (jupyter-org-interaction-mode): Use `cl-callf2?`.
* jupyter-server.el: Add TODO.
* jupyter-tramp.el: Remove unused function declaration.
Verify that the `major-mode` of the `buffer-base-buffer` is derived from
`org-mode` if the `current-buffer` happens to be an indirect one. This should
allow `emacs-jupyter` to work better with `polymode`. See #171.
When the `:display` header argument is used and a particular message type
doesn't return a mime bundle with one of the requested mime types, include the
message type in the warning that is displayed.
This should clarify the situation where an `:execute-result` and
`:display-data` message both return data to display, but one of them does not
have one of the mimetypes requested in the `:display` header argument.
Closes#144.
This is needed because `org-mode` merges many sources of source block params so
its not enough to just re-compute the parameters in `jupyter-generate-request`
using `org-babel-get-src-block-info` or `org-babel-log-get-info`.
* jupyter-org-client.el (jupyter-handle-stream): Remove control code handling.
(jupyter-org--handle-control-codes): New function.
(jupyter-org--do-insert-result): Do it.
* jupyter-org-client.el (jupyter-org--image-result):
Be more stringent on checking the value of `org-image-actual-width`. `listp`
returns t when passed nil, a valid value of `org-image-actual-width`.
Use absolute filenames when calling `create-image`.
* jupyter-org-client.el (jupyter-org-request-at-point): Do it.
(org-babel-jupyter-src-block-session): New declare.
* ob-jupyter.el (org-babel-jupyter-session-clients): Add doc about keys.
* test/jupyter-test.el (jupyter-org-request-at-point): New test.
Make less assumptions about where `point` is at when inserting results and
about the insertion context by relying only on
`org-babel-where-is-src-block-result` to move `point`. Centralize handling of
`point` to `jupyter-org--do-insert-result`.
* jupyter-org-client.el
(jupyter-org--first-result-context-p): Handle more cases.
(jupyter-org--append-stream-result-p): New function.
(jupyter-org--prepare-append-result): New function, abstracted from
`jupyter-org--insert-result`.
(jupyter-org--normalized-insertion-context): New function.
(jupyter-org--do-insert-result): New function.
(jupyter-org--insert-result): Move the bulk of the work to
`jupyter-org--do-insert-result`.
(jupyter-org--add-result): Use it.
Also consider indentation when inserting results. This was fairly easy to do
and didn't seem to warrant a separate commit.
* jupyter-org-client.el
(jupyter-org--insert-element): Remove. Update all callers.
(jupyter-org-delete-blank-line): New function.
(jupyter-org--delete-element): Use it.
(jupyter-org--stream-context-p): Consider indentation.
(jupyter-org--fixed-width-append): Remove. Update all callers.
(jupyter-org--append-to-fixed-width): Move example block promotion to
`jupyter-org--append-stream-result`.
(jupyter-org--append-to-example-block): New function.
(jupyter-org--append-stream-result): Use it.
(jupyter-org-indent-inserted-region): New macro.
(jupyter-org--insert-result): New method that splits the bulk of the old
function `jupyter-org--append-result` into a more manageable structure. Uses
new macro.
(jupyter-org--append-result): Remove it. Update all callers.
(jupyter-org--add-result): Refactor to consider above changes.