Commit graph

127 commits

Author SHA1 Message Date
Nathaniel Nicandro
1b1a55ef3f Add jupyter-org-request-at-point
* jupyter-org-client.el (jupyter-org-request-at-point): Do it.
(org-babel-jupyter-src-block-session): New declare.

* ob-jupyter.el (org-babel-jupyter-session-clients): Add doc about keys.

* test/jupyter-test.el (jupyter-org-request-at-point): New test.
2019-07-14 17:20:41 -05:00
Nathaniel Nicandro
31b551bdc1 org-babel-jupyter--run-repl: Make language aliases for remote kernelspecs 2019-07-09 13:50:20 -05:00
Nathaniel Nicandro
0f01a2a2ed ob-jupyter.el: Don't make language aliases at load time 2019-07-09 13:47:17 -05:00
Nathaniel Nicandro
7b78ca7013 jupyter-runtime-directory: Don't call shell commands at load time
* jupyter-env.el (jupyter-runtime-directory): Remove custom status.
New function definition.

* jupyter-kernel-manager.el (jupyter-write-connection-file):
Use new function.

* ob-jupyter.el (org-babel-jupyter--run-repl):
Remove setting of `jupyter-runtime-directory`.

* test/jupyter-test.el (jupyter-runtime-directory): New test.
2019-07-08 20:23:23 -05:00
Nathaniel Nicandro
9dd8e8d9ec Localize functions defined in jupyter-base.el to their call sites
Fixes #137

* jupyter-base.el (jupyter-kernelspec): Un-require.
(jupyter-command, jupyter-locate-python)
(jupyter-runtime-directory): Move to new file `jupyter-env.el`
(jupyter-include-other-output, jupyter-iopub-message-hook)
(jupyter-shell-message-hook)
(jupyter-stdin-message-hook): Move to `jupyter-client.el`
(jupyter-sha256, jupyter-hmac-sha256):
(jupytern-new-uuid): Move to `jupyter-messages.el`. Add declaration of
`jupyter-new-uuid` to account for its removal.
(jupyter-create-connection-info)
(jupyter-write-connection-file): Move to `jupyter-kernel-manager.el`
(jupyter-connect-endpoint, jupyter-connect-channel): Move to `jupyter-channels.el`

* jupyter-channels.el: Accept moved functions.

* jupyter-client.el: Accept moved variables.

* jupyter-kernel-manager.el: Accept moved functions.
(jupyter-env, jupyter-kernelspec): New requires.

* jupyter-kernelspec (jupyter-env): New require.
(jupyter-command): Remove declaration.
(jupyter-read-plist-from-string): New declaration.

* jupyter-messages.el: Accept moved functions.
(hmac-def, json): New requires.

* jupyter-org-extensions.el (jupyter-kernelspec): New require.

* jupyter-repl.el (jupyter-kernelspec): New require.

* jupyter-env.el: New file.

* ob-jupyter.el (jupyter-env, jupyter-kernelspec): New requires.

* test/jupyter-test.el (jupyter-env): New require.
2019-06-29 10:29:55 -05:00
Nathaniel Nicandro
25ff5dd871 jupyter-org-client: Remove unnecessary block-params slot 2019-06-23 16:11:27 -05:00
Nathaniel Nicandro
1913da83fa org-babel-jupyter-scratch-buffer: Don't switch buffers when inside edit buffer 2019-06-12 23:22:20 -05:00
Nathaniel Nicandro
5ea32a70f0 Change License to GPL3 2019-05-31 09:44:39 -05:00
Nathaniel Nicandro
e05ef4f8d5 org-babel-jupyter-initiate-session-by-key: Support remote kernel starts 2019-05-20 22:46:46 -05:00
Nathaniel Nicandro
edf3097b04 org-babel-jupyter-override-src-block: Be more robust
Fixes #118
2019-05-20 14:52:26 -05:00
Nathaniel Nicandro
240dc7ab08 org-babel-expand-body:jupyter: Correct arguments to language specific expander
The language specific expander only expects (BODY PARAMS)
2019-05-19 23:16:46 -05:00
Nathaniel Nicandro
d0000e8382 org-babel-jupyter-aliases-from-kernelspecs: Use symbols in org-src-lang-modes
This avoids a bug in `org-mode`. Although the documentation of
`org-src-lang-modes` says the mode can be a symbol or a string, the
customization type only specifies symbol so having a string causes errors when
`custom-initialize-reset` is called after
`org-babel-jupyter-aliases-from-kernelspecs`.
2019-05-08 23:26:07 -05:00
Nathaniel Nicandro
5cd1e55616 org-babel-jupyter-strip-ansi-escapes: Handle blocks without results
Fixes #112.
2019-05-08 10:36:38 -05:00
Nathaniel Nicandro
2091a01b52 org-babel-jupyter-strip-ansi-escapes: Avoid when-let* 2019-05-07 00:38:01 -05:00
Ning Xu
59275f655a Fix two org-src-lang-modes calc issues (#107)
For assoc lang org-src-lang-modes may return symbol sh, (inter 'sh) will
return an error.

For some languages like C++, the corresponding language mode shall be c++
2019-05-06 23:53:29 -05:00
Nathaniel Nicandro
112769e0c6
Bump version 2019-05-04 03:31:50 -05:00
Nathaniel Nicandro
3f382a8fe8
Require ob-python when its needed 2019-05-03 14:02:01 -05:00
Nathaniel Nicandro
e08d451f2a
Don't use most-positive-fixnum as a timeout
There are sometimes intermittent failures which seem to originate from this.
2019-04-08 12:44:48 -05:00
Nathaniel Nicandro
580776bf58 Add org-babel-jupyter-src-block-session 2019-03-28 23:29:02 -05:00
Nathaniel Nicandro
7fec895c03 Before export, remove ANSI escapes from source block results 2019-03-20 21:08:53 -05:00
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