Commit graph

1107 commits

Author SHA1 Message Date
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
Nathaniel Nicandro
ffd680fa95
Remove duplicated save-restriction 2018-12-10 21:36:35 -06:00
Nathaniel Nicandro
689d18ce54
jupyter-code-context: Return the full code block in an org-mode context
Better support for completions in the Jupyter org-mode source blocks

A line context is often insufficient. For example, the Julia kernel will parse
up to the current point and return dictionary keys as completions or method
arguments. Similarly a Python kernel may use Jedi for completion which does
static analysis of the code block to resolve import paths for completion
results.
2018-12-10 21:36:35 -06:00
Nathaniel Nicandro
7c01766da3
jupyter-completion--arg-extract: Don't assume spaces exist after separator 2018-12-10 21:36:35 -06:00
Nathaniel Nicandro
8fdde6c756
Update some documentation 2018-12-10 21:36:35 -06:00
Nathaniel Nicandro
c6efda58b1
jupyter-org-insert-sync-results -> jupyter-org-sync-results
Change the behavior of `jupyter-org-sync-results` to return the org formatted
result string and modify the result parameters in `org-babel-execute:jupyter`
to add the "raw" result parameter so that the result string is directly
inserted into the buffer.

This is to work towards better support for in-lined code blocks.
2018-12-10 21:36:35 -06:00
Nathaniel Nicandro
c5ebd7bcbd
jupyter-org--same-src-block-p: Handle nil markers 2018-12-10 21:36:35 -06:00
Nathaniel Nicandro
3cd9078c0c
Ensure with-current-buffer is called on a live buffer 2018-12-10 21:36:35 -06:00
Nathaniel Nicandro
706a0ba6bc
Add jupyter-repl-traceback face 2018-12-10 21:36:35 -06:00
Nathaniel Nicandro
747e82fc22
Be clearer in REPL history functions 2018-12-10 21:36:35 -06:00
Nathaniel Nicandro
7f5c8d8a4b
Be more robust when determining if a call to a command was interactive
As per the `called-interactively-p` documentation.
2018-12-10 21:36:35 -06:00
Nathaniel Nicandro
b1a5e9a914
jupyter-repl-sync-execution-state: Remove stale code
The `execution-state` slot is now a `jupyter-kernel-client` slot and is updated
by that class.
2018-12-10 21:36:35 -06:00
Nathaniel Nicandro
2dcb16ef72
Add jupyter-org-raw-string, jupyter-org-raw-string-p
This allows for the distinction between raw org syntax and stream results.
2018-12-10 21:36:35 -06:00
Nathaniel Nicandro
13ee746ee9
jupyter-org-goto-error-map: Add documentation 2018-12-10 21:36:35 -06:00
Nathaniel Nicandro
9a50c9c9fc
jupyter-org--append-result: Append newlines when inserting objects
This ensures that org-element objects are always returned by the functions like
`jupyter-org-file-link`. Previously functions that returned org objects would
return the object wrapped in a list.
2018-12-10 21:36:35 -06:00
Nathaniel Nicandro
7b7ddea90f
jupyter-org-scalar: Abstract out table conversion 2018-12-10 21:36:35 -06:00
Nathaniel Nicandro
fc7004dd16
jupyter-org-scalar: Return org-elements unchanged 2018-12-10 21:36:35 -06:00
Nathaniel Nicandro
ec9713c0aa
Add jupyter-org-comment 2018-12-10 21:36:35 -06:00
Nathaniel Nicandro
ad738b5803
jupyter-org--element-end-preserve-blanks -> jupyter-org-element-end-before-blanks
Also simplify its definition.
2018-12-10 21:36:35 -06:00
Nathaniel Nicandro
b4d29e8950
Proper usage of org-babel-min-lines-for-block-output 2018-12-10 21:36:35 -06:00
Nathaniel Nicandro
15cd6b9f2d
Add org-mode stream result tests 2018-12-10 21:36:35 -06:00
Nathaniel Nicandro
e25cec237f
Remove unneeded function declaration
jupyter-base.el already requires subr-x
2018-12-10 18:31:39 -06:00
Nathaniel Nicandro
3d3dc6420d
jupyter-with-timeout: Update documentation 2018-12-10 18:31:39 -06:00
Nathaniel Nicandro
dab4afc4c6
Dynamically update org-babel stream results
Previously stream results would be placed directly inside the RESULTS drawer.
The issue with this is that sometimes the stream results can be represented as
org syntax.

Instead of inserting stream results directly into a RESULTS drawer, insert them
as either fixed-width or example-block org elements depending on
`org-babel-min-lines-for-block-output`. In addition, coalesce all stream
results so that multiple stream messages in succession produces only one
fixed-width or example-block element.
2018-12-10 18:31:33 -06:00
Nathaniel Nicandro
621fe77c62
jupyter-org--append-result: Move buffer cleanup to jupyter-org--wrap-result-maybe
This may still not be the best place to put buffer modifications, but it
"spreads out the logic" a little more and simplifies
`jupyter-org--append-result`.
2018-12-10 18:04:31 -06:00
Nathaniel Nicandro
c218c976e3
jupyter-org--wrap-result-maybe: Use cond 2018-12-10 18:04:31 -06:00
Nathaniel Nicandro
d269f00036
jupyter-org--append-result: Clear the ID at a higher level 2018-12-01 15:06:07 -06:00
Nathaniel Nicandro
df54627f68
jupyter-org-client.el: Add outline sections 2018-12-01 15:06:07 -06:00
Nathaniel Nicandro
0c0547dd95
Add jupyter-normalize-data 2018-12-01 15:06:07 -06:00