Commit graph

1082 commits

Author SHA1 Message Date
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
Nathaniel Nicandro
0416923c50
Update README 2018-12-01 15:05:59 -06:00
Nathaniel Nicandro
4683785553
jupyter-eval: Inhibit client handlers 2018-11-29 02:02:02 -06:00
Nathaniel Nicandro
669f1716aa Remove unused functions 2018-11-26 12:37:37 -06:00
Nathaniel Nicandro
2d85d1a17a Update org-mode tests 2018-11-26 12:37:37 -06:00
Nathaniel Nicandro
9d01315b56 Fix completion prefix for Julia kernels
Always add \ to the prefix when completing latex.
2018-11-26 12:37:37 -06:00
Nathaniel Nicandro
f735bed7e6 Split out latex handling in jupyter-org-client.el 2018-11-26 12:37:37 -06:00
Nathaniel Nicandro
8e534edad0 Be more intelligent when parsing LaTeX
It seems `org-element-latex-fragment-parser` expects that a latex fragment can
really be parsed because there were false positives when it was called trying
to parse a latex environment such as `\begin{equation*}...\end{equation*}`. It
would consider `\begin{equation*}` as the fragment.
2018-11-26 12:37:37 -06:00
Nathaniel Nicandro
e378103db1 Add jupyter-org--wrap-result-maybe
This abstracts out some of the work done by `jupyter-org--append-result`
2018-11-26 12:37:37 -06:00
Nathaniel Nicandro
76725efcfd Update README.org 2018-11-26 12:37:37 -06:00
Nathaniel Nicandro
ed24a1cb54 Add TODO about stream output 2018-11-26 12:37:37 -06:00
Nathaniel Nicandro
ee00769959 Add jupyter-org-toggle-latex 2018-11-26 12:37:37 -06:00
Nathaniel Nicandro
5555faa785 Remove the status handler for jupyter-org-clients
The work done by the status handler is now done by the execute reply handler.
2018-11-26 12:37:37 -06:00
Nathaniel Nicandro
c5a03da4e0 jupyter-repl-finalize-cell: Fix setting of buffer-undo-list
Don't set `buffer-undo-list` to a boundary entry, set it to an entry which
indicates on undo information.
2018-11-26 12:37:37 -06:00
Nathaniel Nicandro
3752fff116 jupyter-insert-image: Support needs_background metadata key 2018-11-26 12:37:37 -06:00
Nathaniel Nicandro
a9caf5185a Add jupyter-region-context
Also update the default code context for completion requests to be the current
line up to `point`.

This allows completion in python kernels to work as expected. Previously when
sending the whole line, the python completer would not return expected results.
For example, if you had something like

os.mkdir(os.path.|, 0777)

then you would not receive any completions for the os.path namespace, only for
the global namespace.
2018-11-26 12:37:37 -06:00
Nathaniel Nicandro
74130eaab2 jupyter-inspect: Don't capture a reference to a client
Ensure that `help-setup-xref` doesn't keep the client around longer than
expected.
2018-11-26 12:37:37 -06:00
Nathaniel Nicandro
32ce9d33bc Fix jupyter-instance-tracker initialization
A property of the tracking symbol was being checked instead of the symbol's
value.
2018-11-26 12:37:37 -06:00
Nathaniel Nicandro
512dcafc46 jupyter-completion--company-idle-begin: Behave similarly to company-post-command 2018-11-26 12:37:37 -06:00
Nathaniel Nicandro
c9a5651245 jupyter-eval: Display a message if no results are returned 2018-11-26 12:37:37 -06:00
Nathaniel Nicandro
46e0c24930 Update org-mode tests 2018-11-26 12:37:37 -06:00
Nathaniel Nicandro
c580543cc7 jupyter-insert: Search for required field when fontifying Python inspect results
The Type: field will always be present in an inspect request.
2018-11-26 12:37:37 -06:00
Nathaniel Nicandro
2a7b221009 Don't require an external package that may not exist everywhere 2018-11-26 12:37:37 -06:00
Nathaniel Nicandro
383f897023 Small refactoring 2018-11-26 12:37:37 -06:00
Nathaniel Nicandro
3781c07151 Add the jupyter-org-error-location method
This method is to support jumping to the line where an error occurred in a code
block directly from the `org-mode` buffer.
2018-11-26 12:37:37 -06:00
Nathaniel Nicandro
2ac0a8b621 Do not conform to the semantics of org-babel-insert-result
There was an ugly hack that destructively modified the source block parameters
supplied to the org-babel execute function to make `org-babel-insert-result` do
all of the insertion work. This relied too much on knowing the internals of
that function. I also could never figure out how to insert stream results in a
clean way.

Instead we manually insert the results by taking advantage of the `org-element`
API. Specifically the function `org-element-interpret-data` which takes an org
syntax tree and returns its printed representation. Now the
`jupyter-org-result` method returns either a string or a syntax tree. If the
latter is returned, it is filtered through `org-element-interpret-data` to
obtain the string representation for insertion.

In addition, all source blocks insert results in a RESULTS drawer. This allows
for inserting stream output as raw text in the drawer and allows for a way to
append results since the end of the drawer acts as an insertion point.
2018-11-26 12:37:37 -06:00