Commit graph

27 commits

Author SHA1 Message Date
Nathaniel Nicandro
db5d06faa6 Remove jupyter-repl-insert
It's main purpose was to not forget to add the `read-only` property to text
that needed it.  The code base is stable enough to where this is not an issue
anymore.

* jupyter-repl.el (jupyter-repl-insert): Remove. Update all callers.

* jupyter-python.el (jupyter-handle-error): Ditto.
2020-04-04 08:39:45 -05:00
conao3
1546a72f57 clean header 2020-03-10 23:39:35 -05:00
Nathaniel Nicandro
6650dd3588 Bump version 2019-07-24 16:03:22 -05:00
Nathaniel Nicandro
5ea32a70f0 Change License to GPL3 2019-05-31 09:44:39 -05:00
Nathaniel Nicandro
b715ada492 Always name method arguments
If method arguments are not named it gives rise to errors like

    `Args out of range: "", 0`

that originate in `help-function-arglist` when calling `describe-function` on
those methods.
2019-05-09 13:32:45 -05:00
Nathaniel Nicandro
112769e0c6
Bump version 2019-05-04 03:31:50 -05:00
Nathaniel Nicandro
83af335166
Bump version 2019-03-14 09:29:11 -05:00
Nathaniel Nicandro
f7df9cb9cf Allow table results to be suppressed by ":results scalar" 2019-02-22 08:29:00 -06:00
Nathaniel Nicandro
d4969cbfcc CHANGELOG.org: Add function to change version numbers 2019-02-14 23:05:00 -06:00
Nathaniel Nicandro
63717b9e39
Bump version 2019-02-12 09:17:06 -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
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
b31c23861e
jupyter-handle-error (:after, python): Inherit text properties
This ensures that the `jupyter-repl-traceback` face is used for the face of the
inserted spaces.
2018-12-19 21:01:35 -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
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
Nathaniel Nicandro
a38df0b29f jupyter-handle-error: Only call Python specialized method in the REPL 2018-11-26 12:37:37 -06:00
Nathaniel Nicandro
081f329da1 v0.6.0 2018-11-16 00:27:47 -06:00
Nathaniel Nicandro
0052d9b30f jupyter-insert: Only fontify the docstring region for Python inspect requests
* jupyter-python.el (jupyter-insert): Do it.
2018-11-15 23:04:27 -06:00
Nathaniel Nicandro
a819067e6c Implement the jupyter-org-result method
This is in replacement of the `jupyter-org-prepare-result` and
`jupyter-org-transform-result`. A single method with both primary and :around
methods is sufficient.

* jupyter-org-client.el (jupyter-org-mime-types): New variable.
(jupyter-org-prepare-and-add-result): Remove.
(jupyter-handle-execute-result, jupyter-handle-display-data):
Do the work previously done by `jupyter-org-prepare-and-add-result`.
Abstract out the python handling to a `jupyter-org-result` method.
(jupyter-org--image-result): Add PARAMS argument.
Move setup done previously in `jupyter-org-prepare-result` to this function.
(jupyter-org-prepare-result): Remove.
Replace with calls to the `jupyter-org-result' method.
(jupyter-org-result): New method.
(text/html) Remove special handling of <img> tags, this was done due to old
versions of the Julia kernel.
(jupyter-org-transform-result): Remove.
Replace with a `jupyter-org-result` :around method.
Remove all callers.

* jupyter-python.el (jupyter-org-transform-result): Remove.
Replace with a `jupyter-org-result` :around method.

* jupyter-tests.el (jupyter-org-result): Add tests.

org-result
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
df64f6b801 Add jupyter-fontify-region-according-to-mode
* jupyter-mime.el (jupyter-fontify-region-according-to-mode): Do it.

* jupyter-python.el (jupyter-insert): Use it.
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
e01f8df624 Remove jupyter-repl-insert-message
The purpose of this function was to conveniently insert a message property list
and allow contributors to perform post insert fixing up depending on the
mimetype inserted via the method `jupyter-repl-after-insert-message`. This same
effect can be done by extending `jupyter-insert` without the need of adding a
new method.

* jupyter-repl.el (jupyter-repl-insert-message):
(jupyter-repl-after-insert-message): Remove.
(jupyter-inspect): Replace calls to `jupyter-repl-insert-message` with
`jupyter-insert`.

* jupyter-python.el (jupyter-repl-after-insert-message): Replace with
`jupyter-insert` :around method.
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
06ae31a699 jupyter-repl-after-insert-message: Fontify Python doc strings after inspect requests 2018-10-31 18:49:37 -05:00
Nathaniel Nicandro
b1bbfd0e1a Move python specific traceback handling to jupyter-python.el 2018-10-27 22:16:54 -05:00
Nathaniel Nicandro
795c9b2542 Add jupyter-load-file-code 2018-10-25 23:59:47 -05:00
Nathaniel Nicandro
8896e88476 Move language support definitions to their own files
* Define `jupyter-load-language-support` which takes a client and loads the
  language support definitions of the client's kernel language.

* Call `jupyter-load-language-support` when initializing a REPL buffer in
  `jupyter-repl-mode`. Note this also takes care of loading the kernel support
  for a `jupyter-org-client' since a REPL buffer is setup before evaluating any
  `org-mode` source code blocks.

* Move language specific methods to their own files named `jupyter-LANGUAGE.el`
2018-10-25 23:59:46 -05:00