Commit graph

107 commits

Author SHA1 Message Date
Nathaniel Nicandro
33bae1762d
org-babel-execute:jupyter: Remove export sync hook before waiting 2019-03-18 10:41:44 -05:00
Nathaniel Nicandro
3b6b60d803 jupyter-org-insert-async-id -> jupyter-org-pending-async-results 2019-03-17 02:06:00 -05:00
Nathaniel Nicandro
c0d13396bb org-babel-execute:jupyter: Make all blocks synchronous during export 2019-03-17 02:04:00 -05:00
Nathaniel Nicandro
129f53f7a8 Add org-babel-jupyter-language-p 2019-03-17 02:03:00 -05:00
Nathaniel Nicandro
3adf0dc336
Add TODO on supporting ":results link" in org-mode source blocks 2019-03-15 14:41:22 -05:00
Nathaniel Nicandro
e4110ae81b
org-babel-execute:jupyter: Also remove file params in synchronous blocks
See #59.
2019-03-15 14:41:22 -05:00
Nathaniel Nicandro
83af335166
Bump version 2019-03-14 09:29:11 -05:00
Nathaniel Nicandro
f28d4a5400
Avoid recursive require when loading ob-jupyter
This can happen, e.g. when loading jupyter-org-client.el directly from source
since `org-element` requires `org`.
2019-03-14 09:29:11 -05:00
Nathaniel Nicandro
662e983612
Don't require subr-x at runtime 2019-03-14 09:16:44 -05:00
UndeadKernel
d065b2f25c Port scimax's source block helper functions (#45)
* Port scimax's org facility functions

We provide a hydra to easily use the functions.
By default, the binding to call the hydra is `C-c h`
The hydra is only created if the hydra package is loaded.

* Move org extensions to its own file.

* Integrate revision comments

* Replaced manual placement of src blocks with
`org-element-interpret-data`
* Refactor some functions

* Add a hydra to `jupyter-org-interaction-mode-map`

Only actually define the Hydra if the package `hydra` exists.

* Refactor org extension functions.

* org-extensions: refactor and cleanup

* Remove compiler warnings
* Change condition-case for ignore-errors
* Functions that restart the kernel now work
* Use ivy and avy functions only if package exists

* org-extensions: change hydra bindings

* Match the hydra bindings better to emacs conventions

* org-extensions: improvements and code refactoring

* add where external functions should be found
* take into account empty RESULTS when moving blocks

* org-extensions: use context variable for jumping

* org-extensions: improve jumping to block function

* Set a default variable to specify how many lines of context to show
* Consider the case when a user supplies the nil value
2019-03-14 02:26:30 -05:00
Nathaniel Nicandro
581aab10b6
jupyter-kernel-language: Change return value to be a symbol
This avoids interning a string for every method dispatch using the
jupyter-lang method specializer.
2019-03-07 22:51:25 -06:00
Nathaniel Nicandro
dbfcac1c90
Add org-babel-jupyter-override-src-block
Closes #41.
2019-03-01 18:09:27 -06:00
Nathaniel Nicandro
f7df9cb9cf Allow table results to be suppressed by ":results scalar" 2019-02-22 08:29:00 -06:00
Nathaniel Nicandro
ea5ae74c1d
Don't rely on temporarily clearing :file header argument
Attempt at #16.
2019-02-20 13:34:10 -06:00
Nathaniel Nicandro
d4969cbfcc CHANGELOG.org: Add function to change version numbers 2019-02-14 23:05:00 -06:00
Nathaniel Nicandro
46fd8bec20
Generalize org-babel-jupyter-setup-export 2019-02-14 16:54:33 -06:00
Nathaniel Nicandro
3f5aa0039e
Add org-babel-jupyter-setup-export
This function is used to ensure that export variables are setup to handle
Jupyter src-blocks.
2019-02-12 11:49:17 -06:00
Nathaniel Nicandro
63717b9e39
Bump version 2019-02-12 09:17:06 -06:00
Nathaniel Nicandro
4978c28add
Revert jupy- prefix to jupyter- for org-mode src-blocks
Closes #5.
2019-02-12 09:17:06 -06:00
Nathaniel Nicandro
771e267034
Fix checkdoc errors 2019-02-06 22:49:41 -06:00
Nathaniel Nicandro
9bb0415255
Handle :file parameter in a cleaner way
Temporarily remove the :file parameter from the src-block parameters so that
`org-babel` does insert it as the result of the src-block.
2019-01-26 18:44:23 -06:00
Nathaniel Nicandro
ee1078d0c7
org-babel-jupyter-cleanup-file-links: Handle links with no directory 2019-01-26 16:17:15 -06:00
Nathaniel Nicandro
1054dc8857
Use when-let* 2019-01-22 12:14:32 -06:00
Nathaniel Nicandro
0e6192c86e
Refactor implementation of :dir option in Jupyter src-block's 2019-01-18 23:01:57 -06:00
Nathaniel Nicandro
c138d35b83
Remove stale comments 2019-01-17 20:45:45 -06:00
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