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.
If method arguments are not named it gives rise to errors like
`Args out of range: "", 0`
that originate in `help-function-arglist` when calling `describe-function` on
those methods.
The modification-hooks added by `org-format-latex` cause the overlay to be
deleted whenever it is modified and this will also happen during text property
changes which we want to avoid. Since the buffer is read-only anyways, there is
no need for this hook.
If a \r appears as the last character in the inserted text of BODY,
`jupyter-handle-control-codes` does not delete the whole line. Instead it makes
the character invisible. It waits until future output comes in to delete the
whole line. The issue was that `jupyter-with-control-code-handling` was not
taking into account the \r character from previous output.
If the `text/html` results returned from the kernel contain an XML prolog then
use `libxml-parse-xml-region` to parse the results otherwise use
`libxml-parse-html-region`.
* jupyter-mime (jupyter-insert-html): Do it.
* test/jupyter-test.el (jupyter-html-output): Add test for html output.
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`.
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.
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.
* 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
* 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.
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`