Commit graph

105 commits

Author SHA1 Message Date
Nathaniel Nicandro
611b069f91 Don't slow down src-block result insertion if no latex results
Check for a latex fragment org-element instead of skipping over words. The
previous behavior would cause a large slow down if the results contained a
large amount of text.
2019-02-09 14:32:00 -06:00
Nathaniel Nicandro
44652c2d7a jupyter-org-image-link: Simplify construction of attribute string 2019-02-09 09:18:00 -06:00
Nathaniel Nicandro
f85993e2ba jupyter-org-request-silent -> jupyter-org-request-silent-p 2019-02-09 09:16:00 -06:00
Nathaniel Nicandro
10d189f373 Fix #12: Pop up traceback when :results silent 2019-02-09 09:15:00 -06:00
Nathaniel Nicandro
0a34860707
Fix package-lint errors 2019-02-07 11:17:24 -06:00
Nathaniel Nicandro
771e267034
Fix checkdoc errors 2019-02-06 22:49:41 -06:00
Nathaniel Nicandro
70f0429e07
jupyter-org--append-result: Handle appending to a table result 2019-01-26 18:42:15 -06:00
Nathaniel Nicandro
9abdc3644d
Document functions related to jupyter-org-define-key 2019-01-22 18:39:17 -06:00
Nathaniel Nicandro
ab7399f9c0
jupyter-org--set-current-src-block: Consider :post-affiliated keyword 2019-01-19 15:27:11 -06:00
Nathaniel Nicandro
c138d35b83
Remove stale comments 2019-01-17 20:45:45 -06:00
Nathaniel Nicandro
814300e883
jupyter-org-with-src-block-client: Mention that a client is created 2019-01-17 19:00:43 -06:00
Nathaniel Nicandro
9b955398cd
Fix 09ebdac jupyter-org-result (text/plain): Be stricter with usage of `org-babel-script-escape
I guess I should actually run the tests before uploading to github...
2019-01-16 18:50:02 -06:00
Nathaniel Nicandro
03c75caf32
jupyter-drop-request (jupyter-org-request): Verify marker 2019-01-16 17:56:32 -06:00
Nathaniel Nicandro
09ebdac3f0
jupyter-org-result (text/plain): Be stricter with usage of org-babel-script-escape 2019-01-16 17:56:08 -06:00
Nathaniel Nicandro
8aec6a9f2e
jupyter-org-result: Fix method arguments 2019-01-16 17:53:57 -06:00
Nathaniel Nicandro
4878f6a41e
Don't assume point is in the org-mode buffer 2019-01-13 22:37:54 -06:00
Nathaniel Nicandro
27c5b34717
Remove redundancy 2019-01-13 22:19:25 -06:00
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
36d2cd32ca
Better dynamic keybindings for Jupyter src-block's 2019-01-13 22:19:25 -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
05011fa04e
Support images with width and height metadata 2019-01-12 20:38:35 -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
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
b2368a920c
jupyter-org--clear-request-id: Ensure the correct buffer is current 2019-01-08 20:25:50 -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
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
f4e2768886
Silence byte compiler 2018-12-12 11:59:28 -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
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
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
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
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