Commit graph

1435 commits

Author SHA1 Message Date
Nathaniel Nicandro
6b7ecfcf08
Add execution-count slot to a jupyter-kernel-client
This allows the default `jupyter-kernel-client' implementation to do the work
of updating the execution count instead of having subclasses track it.
2019-01-13 22:19:25 -06:00
Nathaniel Nicandro
0c92afea26
Add the jupyter-handle-payload method
This replaces the `jupyter-repl--handle-payload` function and allows payloads
to be handled in other contexts than the REPL, for example inserting a new
source block when receiving a set_next_input payload for the `org-mode` client.
2019-01-13 22:19:25 -06:00
Nathaniel Nicandro
bf057552d8
Promote org-babel-jupyter--cleanup-file-links to a public function 2019-01-13 22:19:25 -06:00
Nathaniel Nicandro
36d2cd32ca
Better dynamic keybindings for Jupyter src-block's 2019-01-13 22:19:25 -06:00
Nathaniel Nicandro
2231eb2378
Add the org-babel-jupyter-transform-code method
This method allows kernel languages to do transformations of a src-block's code
based on the parameters supplied to the src-block before sending the code to
the kernel. The method is called in `org-babel-expand-body:jupyter`. Currently
the only parameter supported is the `:dir` option of a src-block.
2019-01-13 22:05:35 -06:00
Nathaniel Nicandro
30be4a37d3
Be more robust when creating request objects in an org-mode buffer 2019-01-13 22:05:35 -06:00
Nathaniel Nicandro
e2a9d9b645
Support inline Jupyter code blocks 2019-01-13 22:05:35 -06:00
Nathaniel Nicandro
5c004a43a5
Remove stale comments; fix documentation 2019-01-13 22:05:35 -06:00
Nathaniel Nicandro
37b80ddbcd
Fix some typos and formatting issues 2019-01-12 20:57:22 -06:00
Nathaniel Nicandro
05011fa04e
Support images with width and height metadata 2019-01-12 20:38:35 -06:00
Nathaniel Nicandro
1fcbf6ac5b
Delete files of unreachable links from org-babel-jupyter-resource-directory 2019-01-12 20:38:35 -06:00
Nathaniel Nicandro
86ec099379
jupyter-completion-at-point: Inhibit completion when the kernel is busy 2019-01-12 20:27:19 -06:00
Nathaniel Nicandro
2294add50b
Add jupyter-org-interaction-mode
This is a minor mode, enabled in `org-mode` buffers by default, that provides
completion and Jupyter specific keybindings in Jupyter code blocks.

Whenever `point` is inside a Jupyter code block, some of the keybindings
available in `jupyter-repl-interaction-mode` are available directly in the
`org-mode` buffer. Completion is also available from the `org-mode` buffer.
2019-01-12 20:27:19 -06:00
Nathaniel Nicandro
8f1826dabb
jupyter-org--coalesce-stream-results: Loop over list once 2019-01-12 20:21:48 -06:00
Nathaniel Nicandro
86da392a17
Run append image link tests on asynchronous code blocks 2019-01-12 20:21:48 -06:00
Nathaniel Nicandro
cee0db9b2b
Remove unused function 2019-01-11 11:35:48 -06:00
Nathaniel Nicandro
786ff55ff4
Add test for appending multiple file links in org-mode blocks 2019-01-10 23:08:27 -06:00
Nathaniel Nicandro
cabb7e022b
Properly handle org element objects when appending results
Any `org-element` that has a type in `org-element-all-objects` does not have a
newline appended to it when converting to a string representation. This commit
ensures that a newline is added wherever necessary for such elements.

Fixes #8
2019-01-10 23:08:27 -06:00
Nathaniel Nicandro
8e142b32f3
Fix file headers 2019-01-10 23:08:27 -06:00
Nathaniel Nicandro
4c16398448
jupyter-test-ipython-kernel-version: Set the process-environment
Needed to pick up `PYTHONPATH` settings and the like.
2019-01-10 23:08:27 -06:00
Adam B
fc4d2c3487 Cleanup table of keybindings for jupyter-repl-interaction-mode (#7)
Misnamed function and duplicate entry removed. Functions of form
jupyter-repl-eval-* were updated in README to point to new form jupyter-eval-*.
2019-01-10 23:07:00 -06:00
Nathaniel Nicandro
f4eb8fee7c
org-babel-jupyter--after-execute: Remove redundancy
`jupyter-org--append-result` already handles making the right buffer current.
2019-01-08 20:26:31 -06:00
Nathaniel Nicandro
b2368a920c
jupyter-org--clear-request-id: Ensure the correct buffer is current 2019-01-08 20:25:50 -06:00
Nathaniel Nicandro
bbcafd4276
jupyter-insert-markdown: Fontify inline LaTeX 2018-12-28 12:59:03 -06:00
Nathaniel Nicandro
38d6712200
jupyter-eval-string: Include the error name 2018-12-28 12:59:03 -06:00
Nathaniel Nicandro
f5fe8df750
Cleanup of function documentation 2018-12-28 12:59:03 -06:00
Nathaniel Nicandro
5a3b3bde3a
Use font-lock-fontify-region-function in a REPL buffer
Uses the new function `jupyter-repl-font-lock-fontify-region` to fontify a REPL
buffer. This function will only fontify regions corresponding to input cells
and excludes all other regions from fontification. Regions besides input cells
correspond mainly to output from the kernel and use font-lock-face to fontify
their contents.

This allows us to remove the functions and variables related to adding syntax
properties to the output of a cell since these were previously used to avoid
syntactic fontification of the output.
2018-12-28 12:59:03 -06:00
Nathaniel Nicandro
675bfb0a38
jupyter-repl-initialize-fontification: Use regexp-quote 2018-12-20 19:26:25 -06:00
Nathaniel Nicandro
109ee2cce5
jupyter-repl-initialize-fontification: Fix syntax propertize function
Adds `jupyter-repl--syntax-propertize` which generalizes the old
`syntax-propertize-function` to handle regions containing both cell code and
cell output.
2018-12-20 18:58:23 -06:00
Nathaniel Nicandro
80ac63598f
jupyter-org-result: Handle ANSI color codes in text/plain results 2018-12-20 17:15:33 -06:00
Nathaniel Nicandro
03141c6535
jupyter-read-expression: Cleanup variables on minibuffer exit 2018-12-19 21:09:32 -06:00
Nathaniel Nicandro
169b5647e5
jupyter-rep-sync-execution-state: Only update the last cell count 2018-12-19 21:05:12 -06:00
Nathaniel Nicandro
b31c23861e
jupyter-handle-error (:after, python): Inherit text properties
This ensures that the `jupyter-repl-traceback` face is used for the face of the
inserted spaces.
2018-12-19 21:01:35 -06:00
Nathaniel Nicandro
ac2b5ccfbe
jupyter-start-new-kernel: Use default wait time when starting the kernel
`jupyter-start-kernel` defaults to `jupyter-long-timeout` which already
defaults to 10 s.
2018-12-19 20:59:31 -06:00
Nathaniel Nicandro
3debb298e1
jupyter-completion--arg-extract: Handle ; in Julia kernels
This also saves the separator after an argument so that
`jupyter-completion--make-arg-snippet` uses the right separator (either `,` or
`;`)
2018-12-19 20:56:47 -06:00
Nathaniel Nicandro
ee0402ab8e
jupyter-inspect: Ensure jupyter-current-client is valid 2018-12-19 20:55:42 -06:00
Nathaniel Nicandro
8add10db86
jupyter-org--append-result: Fix handling of org-element objects
In particular, file link objects. When an object (in the sense of the
`org-element` API) is inserted by `org-element-interpret-data` it does not
insert a newline since objects are entities that can appear inline with a
paragraph. But for our purposes, we need the newline.

Previously we handled this by wrapping `result` in a list with a newline as the
second element before calling `org-element-interpret-data`, but this interfered
with what `jupyter-org-babel-result-p` (called by
`jupyter-org--wrap-result-maybe`) expected as its argument. With this commit,
the result is never wrapped in a list.
2018-12-19 06:54:41 -06:00
Nathaniel Nicandro
b735c1a192
Update tests consider changes in jupyter-repl-cell-code-end-position 2018-12-16 18:48:41 -06:00
Nathaniel Nicandro
df1d135433
jupyter-with-repl-cell: Don't move point after narrowing
Leave this up to the callers of this macro.
2018-12-16 14:56:14 -06:00
Nathaniel Nicandro
bcfdf170b5
jupyter-repl-update-cell-count: Don't assume the buffer has a cell
This avoids a beginning-of-buffer error during initialization of the REPL.
2018-12-16 14:52:36 -06:00
Nathaniel Nicandro
f4e2768886
Silence byte compiler 2018-12-12 11:59:28 -06:00
Nathaniel Nicandro
5db8ded2f0
jupyter-repl-cell-code-end-position: Fix what is considered the end position
In Emacs, the end position of a region is exclusive. So functions like
`delete-region` will delete the entire region specified excluding the end
position. Follow this convention with the cell code position.

This fixes issues when adding syntax properties to a cell's code. See
`jupyter-repl-initialize-fontification`.
2018-12-12 11:54:58 -06:00
Nathaniel Nicandro
bc7f9b4fb5
jupyter-eval: Raise an error if one is returned by the kernel 2018-12-11 21:36:00 -06:00
Nathaniel Nicandro
6f67c0a3d5
jupyter-eval-string: Fix wrong interactive spec 2018-12-11 21:34:57 -06:00
Nathaniel Nicandro
2e12acd8e3
jupyter-org--fixed-width-to-example-block: Use jupyter-org--delete-element 2018-12-10 22:12:24 -06:00
Nathaniel Nicandro
7e42bdd80e
jupyter-start-kernel: Create jupyter-runtime-directory is necessary
Closes #3
2018-12-10 21:45:41 -06:00
Nathaniel Nicandro
ad3ba3bdf5
org-babel-execute:jupyter: Modify block parameters after obtaining results 2018-12-10 21:36:35 -06:00
Nathaniel Nicandro
460b94f17f
Add jupyter-repl-update-cell-count 2018-12-10 21:36:35 -06:00
Nathaniel Nicandro
da1340ac2d
Update README 2018-12-10 21:36:35 -06:00
Nathaniel Nicandro
8d009bb0ba
jupyter-org--add-result: Remove special handling of sync results
Results are not added using `jupyter-org--add-result` anymore for sync results.
They are added by the `org-babel` machinery using `:results raw`.
2018-12-10 21:36:35 -06:00