Commit graph

32 commits

Author SHA1 Message Date
jackkamm
1befd70e98 Handle isolated metadata property for HTML results of the R kernel (#115) 2019-05-19 22:40:51 -05:00
Nathaniel Nicandro
b715ada492 Always name method arguments
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.
2019-05-09 13:32:45 -05:00
Nathaniel Nicandro
112769e0c6
Bump version 2019-05-04 03:31:50 -05:00
jackkamm
748598b7be Add pandoc conversion of rich outputs (#97) 2019-04-28 15:17:19 -05:00
Nathaniel Nicandro
00fa25a117
jupyter-insert-latex: Temporarily set kill-buffer-hook to nil 2019-03-31 10:40:09 -05:00
Nathaniel Nicandro
efeae99131 Add jupyter-ansi-color-apply-on-region 2019-03-20 21:08:53 -05:00
Nathaniel Nicandro
83af335166
Bump version 2019-03-14 09:29:11 -05:00
Nathaniel Nicandro
6894a73d57
Cleanup stale comments 2019-03-07 22:51:25 -06:00
Nathaniel Nicandro
4d247595bb
jupyter-insert-html: Don't use proportional fonts
Closes #52.
2019-03-06 11:16:54 -06:00
Nathaniel Nicandro
0579dbcd97
jupyter-insert-latex: Remove modification-hooks from overlays
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.
2019-02-16 11:27:44 -06:00
Nathaniel Nicandro
d4969cbfcc CHANGELOG.org: Add function to change version numbers 2019-02-14 23:05:00 -06:00
Nathaniel Nicandro
63717b9e39
Bump version 2019-02-12 09:17:06 -06:00
Nathaniel Nicandro
a6a04e44c5
jupyter-with-control-code-handling: Properly handle \r
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.
2019-01-22 23:32:14 -06:00
Nathaniel Nicandro
0ed7f58c35
Add optional USE-FACE argument to fontification functions 2019-01-17 20:45:45 -06:00
Nathaniel Nicandro
bbcafd4276
jupyter-insert-markdown: Fontify inline LaTeX 2018-12-28 12:59:03 -06:00
Nathaniel Nicandro
0c0547dd95
Add jupyter-normalize-data 2018-12-01 15:06:07 -06:00
Nathaniel Nicandro
3752fff116 jupyter-insert-image: Support needs_background metadata key 2018-11-26 12:37:37 -06:00
Nathaniel Nicandro
7783e402f9 jupyter-insert-html: Recognize html that should be parsed as XML
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.
2018-11-17 15:43:40 -06:00
Nathaniel Nicandro
465d3222a4 Delete all script tags before parsing html
There is an issue where SVG images containing script tags would cause the SVG
render to error.
2018-11-17 15:00:49 -06:00
Nathaniel Nicandro
e04a81a3ad jupyter-fontify-buffer: Don't store fontify buffers 2018-11-16 17:29:47 +00:00
Nathaniel Nicandro
b39f9020c5 jupyter-fontify-according-to-mode: Don't show the fontify buffer 2018-11-16 17:24:18 +00:00
Nathaniel Nicandro
081f329da1 v0.6.0 2018-11-16 00:27:47 -06:00
Nathaniel Nicandro
66c2ee40cb jupyter-insert: Allow for passing in message property lists
* jupyter-mime.el (jupyter-insert): Do it.
2018-11-15 23:04:27 -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
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
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