Commit graph

1307 commits

Author SHA1 Message Date
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
Nathaniel Nicandro
acaafd46be Exclude some package files used for development 2018-11-26 12:37:37 -06:00
Nathaniel Nicandro
a7148927fe Add jupyter-repl-propertize-regex
Previously, when propertizing the output of the REPL, a regular expression was
generated every time to take into account the comment characters of the kernel
language. Adding this variable ensure that we only create the expression once.
2018-11-26 12:37:37 -06:00
Nathaniel Nicandro
4ad72e4781 Rename jupyter-output-buffer-* to jupyter-display-buffer-*
An output buffer implies output from the kernel, but they are used for more
general purposes other than displaying output form the kernel.
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
faa28913dc Update org-mode tests 2018-11-26 12:37:37 -06:00
Nathaniel Nicandro
916b2cf912 jupyter-with-message-content: Fix debug declaration 2018-11-26 12:37:37 -06:00
Nathaniel Nicandro
f534fe16df jupyter-org-result: Wrap markdown results in an export block
This is to be consistent with other results that are wrapped in a block such as
latex results.
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
4d494607fd Rework `org-mode' source block completion
Cache the current source block's information so that there is no need to
constantly retrieve it during completion.
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
99c0bf0f55 Remove unused code 2018-11-21 12:35:34 -06:00
Nathaniel Nicandro
fca89359fd Rename jupyter-repl-display-traceback to jupyter-display-traceback
Also move the function to jupyter-client.el from jupyter-repl.el

* jupyter-repl.el (jupyter-repl-display-traceback): Do it.

* jupyter-client.el (jupyter-display-traceback): Do it.
2018-11-21 12:35:34 -06:00
Nathaniel Nicandro
872c5cde79 Ensure the execution state is always set regardless of jupyter-inhibit-handlers
`jupyter-iopub-message-hook` is called in a channel's `jupyter-handle-message`
method, but setting the execution state should be independent of the value of
`jupyter-inhibit-handlers. So move setting the execution state into the
client's `jupyter-handle-message` method.
2018-11-21 12:35:30 -06:00
Nathaniel Nicandro
6a1da44904 Move evaluation functions from jupyter-repl.el to jupyter-client.el
These functions are general and not only useful for REPLs.
2018-11-19 08:50:32 -06:00
Nathaniel Nicandro
2f7268c8dc Temporarily set the timezone when testing time encoding/decoding 2018-11-17 16:26:03 -06:00
Nathaniel Nicandro
7783e402f9 jupyter-insert-html: Recognize html that should be parsed as XML
If the `text/html` results returned from the kernel contain an XML prolog then
use `libxml-parse-xml-region` to parse the results otherwise use
`libxml-parse-html-region`.

* jupyter-mime (jupyter-insert-html): Do it.

* test/jupyter-test.el (jupyter-html-output): Add test for html output.
2018-11-17 15:43:40 -06:00
Nathaniel Nicandro
c859d34faf Add jupyter-repl-cell-output
* jupyter-repl.el (jupyter-repl-cell-output): Do it.
2018-11-17 15:24:11 -06:00
Nathaniel Nicandro
465d3222a4 Delete all script tags before parsing html
There is an issue where SVG images containing script tags would cause the SVG
render to error.
2018-11-17 15:00:49 -06:00
Nathaniel Nicandro
9f52459325 Add Travis badge 2018-11-17 12:21:57 -06:00
Nathaniel Nicandro
1b8032f5ef jupyter-get-buffer-create: Remove unnecessary keybindings
`special-mode' already provides they keybindings.
2018-11-17 11:53:05 -06:00
Nathaniel Nicandro
6aed12011a jupyter-repl-append-output: Mark output as read only
This used to be done by `jupyter-repl-insert`, but this is no longer the case
as all insertion of results is handled by the functions in jupyter-mime.el
while `jupyter-repl-insert` is more specific to insertion in the REPL buffer.
2018-11-17 11:47:55 -06:00
Nathaniel Nicandro
82cea4c0d1 Break up large tests into smaller ones 2018-11-17 11:47:55 -06:00
Nathaniel Nicandro
df44d53528 Tests work on Travis 2018-11-17 11:47:55 -06:00
Nathaniel Nicandro
1ecd029f6c More clearly show that an error occurs if no kernel info is received
* jupyter-kernel-manager.el (jupyter--error-if-no-kernel-info): New function.
(jupyter-start-new-kernel): Use it.
2018-11-17 11:47:55 -06:00
Nathaniel Nicandro
4842ac2198 jupyter-delete-all-kernels: Remove old cleanup
`jupyter-kernel-manager--cleanup` is intended to replace what was removed.
2018-11-17 11:47:55 -06:00