Commit graph

82 commits

Author SHA1 Message Date
Nathaniel Nicandro
0423fd6168
Simplify extraction of src-block kernel language 2019-01-17 19:00:28 -06:00
Nathaniel Nicandro
bf761b7990
org-babel-jupyter-cleanup-file-links: Another fix for search bound
`org-babel-result-end` assumes that `point` is on the first line of the result
not on the line containing the RESULTS keyword.
2019-01-15 16:05:48 -06:00
Nathaniel Nicandro
51a4d9b2d6
org-babel-jupyter-cleanup-file-links: Fix search bound 2019-01-14 19:00:36 -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
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
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
1fcbf6ac5b
Delete files of unreachable links from org-babel-jupyter-resource-directory 2019-01-12 20:38:35 -06:00
Nathaniel Nicandro
cee0db9b2b
Remove unused function 2019-01-11 11:35:48 -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
ad3ba3bdf5
org-babel-execute:jupyter: Modify block parameters after obtaining results 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
669f1716aa Remove unused functions 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
Nathaniel Nicandro
99a50c7b80 Satisfy the :dir source block argument when initializing a session 2018-11-26 12:37:37 -06:00
Nathaniel Nicandro
cec69a6d30 Change jupyter- org-mode prefix to jupy-
This is to avoid name clashing with another popular package that uses the same
prefix.
2018-11-24 22:13:28 -06:00
Nathaniel Nicandro
081f329da1 v0.6.0 2018-11-16 00:27:47 -06:00
Nathaniel Nicandro
79538c67a0 org-babel-jupyter-aliases-from-kernelspecs: Handle tangling extensions 2018-10-25 23:17:28 -05:00
Nathaniel Nicandro
5395d4d44a Rename connect-jupyter-repl -> jupyter-connect-repl, run-jupyter-repl -> jupyter-run-repl 2018-10-25 23:17:27 -05:00
Nathaniel Nicandro
477b1ceeb1 ob-jupyter.el: Ensure that macros are available when compiling 2018-10-25 23:17:27 -05:00
Nathaniel Nicandro
d2d0452c82 org-babel-jupyter-initiate-session-by-key: Take into account changes to run-jupyter-repl 2018-10-25 23:17:27 -05:00
Nathaniel Nicandro
a9246fcecb Rename with-jupyter-* to jupyter-with
Ensure that all functions and macros have the same
pseudo-namespace
2018-10-25 23:17:25 -05:00
Nathaniel Nicandro
a8231db79b Rename jupyter-repl-current-client to jupyter-current-client
Also move `jupyter-current-client` to `jupyter-client.el`
2018-10-25 23:07:46 -05:00
Nathaniel Nicandro
8bb43e6c68 Rename jupyter-repl-language to jupyter-kernel-language
Also move `jupyter-kernel-language` to `jupyter-client.el`
2018-10-25 23:07:46 -05:00
Nathaniel Nicandro
c070f2d04d Update documentation and comments 2018-10-25 22:57:23 -05:00
Nathaniel Nicandro
9fcfcdd32c Rename no-execute to delay-eval in org-babel-prep-session:jupyter 2018-10-25 22:10:16 -05:00
Nathaniel Nicandro
51131cde63 Pass the request object to org-babel-jupyter-clear-file-param 2018-10-25 22:10:16 -05:00
Nathaniel Nicandro
7d30fe0615 Pass the right arguments to jupyter-send-execute-request 2018-10-25 22:10:16 -05:00
Nathaniel Nicandro
9c99e5f2f9 Add jupyter-org-file-header-arg-p 2018-10-25 22:10:16 -05:00
Nathaniel Nicandro
55449c1d6a Introduce jupyter-org-client
- A `jupyter-org-client` is a subclass of a `jupyter-repl-client` and replaces
  the use of callbacks in `org-babel-execute:jupyter` to handle the insertion
  of code block results in an `org-mode` buffer. `ob-jupyter.el` now only
  contains the integration with `org-babel` and all integration with
  `emcacs-jupyter` is placed in `jupyter-org-client.el`

- Introduce `jupyter-org-request`, which inherits all of the field of a
  `jupyter-request` and adds the fields necessary for keeping track of the
  source code block information a request was generated from during the
  lifetime of the request.
2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
bbb677c573 Pop up traceback buffer on errors when executing code blocks 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
892ab84148 Silence byte compiler warnings 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
23cecb9c0f [WIP] Widget support in ob-jupyter 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
c207bea8d4 Fix indentation 2018-08-30 18:02:25 -05:00
Nathaniel Nicandro
22b1e809a0 Update documentation, cleanup comments 2018-08-30 18:02:13 -05:00
Nathaniel Nicandro
c357ee9c00 Avoid unnecessary work, remove improper usage of variable in ob-jupyter
- Do not add callbacks if source code block has no results

- Remove improper use of language argument to `org-babel-insert-result`
2018-05-28 01:25:01 -05:00
Nathaniel Nicandro
8a2468973e Fix wrong order of variable names 2018-05-16 20:46:10 -05:00
Nathaniel Nicandro
3b3fe9c43f jupyter-<type> -> jupyter-send-<type> where appropriate 2018-05-16 12:25:57 -05:00
Nathaniel Nicandro
ffb84c5354 Slight refactor of org-babel-execute:jupyter 2018-05-15 16:45:26 -05:00
Nathaniel Nicandro
62e63412de Tiny changes 2018-05-15 16:45:26 -05:00
Nathaniel Nicandro
7d7b7650b9 Mainly code style changes 2018-05-15 16:45:24 -05:00
Nathaniel Nicandro
670611ded1 Update code comments and documentation 2018-05-15 16:45:24 -05:00
Nathaniel Nicandro
9ee557f6e5 Small changes to org-babel-jupyter-prepare-result 2018-05-15 16:45:23 -05:00
Nathaniel Nicandro
c3b897bae3 Refactor org-babel-jupyter-file-name 2018-05-15 16:45:23 -05:00
Nathaniel Nicandro
ff47cc6812 Refactor org-babel-jupyter-initiate-session-by-key 2018-05-15 16:45:23 -05:00
Nathaniel Nicandro
b6cfb0aac1 Attempt to convert scalar strings into tables in org-babel-jupyter--transform-result 2018-05-15 16:45:23 -05:00
Nathaniel Nicandro
ae7ef51607 Run org-babel-after-execute-hook after async execution finishes 2018-05-15 16:45:23 -05:00
Nathaniel Nicandro
8e9569ac3e Handle errors properly for file results 2018-05-15 16:45:23 -05:00
Nathaniel Nicandro
eb001c3e83 Rename id-cleared to first-async-insertion 2018-05-15 16:45:23 -05:00
Nathaniel Nicandro
59ea82f066 Properly insert the execution ID before async file results are available 2018-05-15 16:45:23 -05:00