Commit graph

1705 commits

Author SHA1 Message Date
Nathaniel Nicandro
3f382a8fe8
Require ob-python when its needed 2019-05-03 14:02:01 -05:00
jackkamm
748598b7be Add pandoc conversion of rich outputs (#97) 2019-04-28 15:17:19 -05:00
jackkamm
18a3a27139 Remove buggy R html parsing (#96) 2019-04-28 15:12:23 -05:00
Nathaniel Nicandro
9d685b0be4
jupyter-repl-mode-map: Don't override default point motion keys
Closes #100
2019-04-25 12:04:41 -05:00
UndeadKernel
f6421ab72e org-extensions: (un)fold src block hydra command (#95) 2019-04-24 21:56:47 -05:00
Nathaniel Nicandro
81de2fba62
Add initial support for C++ 2019-04-22 17:38:09 -05:00
Nathaniel Nicandro
b9498b5410
jupyter-available-kernelspecs: Fix documentation 2019-04-22 11:41:28 -05:00
Nathaniel Nicandro
9dc814e38a
Add test for jupyter-connect-repl 2019-04-15 21:39:55 -05:00
Nathaniel Nicandro
9d39fbeaff
jupyter-connect-repl: Set kcomm slot of client before initializing connection
Fixes #92
2019-04-15 21:39:55 -05:00
Nathaniel Nicandro
8926e90f37
jupyter-handle-is-complete-reply (jupyter-repl-client): Handle unknown status 2019-04-12 17:06:14 -05:00
Nathaniel Nicandro
34a4833fdd
Add jupyter-repl-allow-RET-when-busy
Closes #82
2019-04-12 11:09:29 -05:00
jackkamm
e7de8b31af Integration for R (#89) 2019-04-12 08:56:20 -05:00
Nathaniel Nicandro
f744661ac7
jupyter-eval-string: Add callback for :display-data messages 2019-04-11 22:13:39 -05:00
Nathaniel Nicandro
6606fc65e5 Move all debug printing into jupyter-client.el 2019-04-11 20:13:44 -05:00
Nathaniel Nicandro
cdc9d1fc6f Increase timeout when cleaning up test REPLs 2019-04-11 20:13:44 -05:00
Nathaniel Nicandro
b2294dceb2 Generalize communication with a kernel
The previous mechanism to communicate with a kernel was too low level from the
perspective of a client. The client interfaced directly with the subprocess
abstraction, `jupyter-ioloop`, and had to handle all "events" that occurred in
the `jupyter-ioloop`, e.g. when a channel was started or stopped. But in
reality such events should not be the concern of a client.

A client should only care about events that are directly related to kernel
messages and not events related to the implementation details of *how*
communication occurs.

This commit abstracts out the way in which a client communicates with its
kernel by introducing a new `jupyter-comm-layer` class. The
`jupyter-comm-layer` class takes care of managing the communication channel
between a kernel and its clients as well as sending events to all registered
clients. This way, clients operate solely at the level of events on the
communication layer. All a client does is register itself to receive events on
the communication layer and send events on the layer.

* jupyter-base.el (jupyter-session-endpoints): New function.

* jupyter-client.el (jupyter-kernel-client): Remove ioloop and channels slots.
  Add kcomm slot.
(initialize-instance): Unconditionally stop channels.
(jupyter-initialize-connection): Change into a method call.
Call `jupyter-initialize-connection` on the `kcomm` slot.
(jupyter-with-client-buffer): Remove stale comment.
(jupyter-send): Call `jupyter-send` on the `kcomm` slot.
(jupyter-ioloop-handler): Remove all method definitions, replace `sent` and
`message` methods with their `jupyter-event-handler` equivalents.
(jupyter-hb-pause, jupyter-hb-unpause, jupyter-hb-beating):
(jupyter-channel-alive-p, jupyter-start-channel, jupyter-stop-channel):
(jupyter-start-channels, jupyter-stop-channels):
Replace with calls to their equivalents using the `kcomm` slot.

* jupyter-comm-layer.el: New file.

* jupyter-kernel-manager (jupyter-make-client): Set a client's `kcomm` slot to
  `jupyter-channel-ioloop-comm`.

* jupyter-messages.el (jupyter-decode-message): Use `list` directly. There
  seemed to be issues when using the new `jupyter-sync-channel-comm` due to
  using quoted lists.

* test/jupyter-test.el: Add `jupyter-comm-layer` test. Update other tests.

* test/test-helper.el: Add `jupyter-comm-layer` mock objects. Update
  `jupyter-echo-client`.
2019-04-11 20:13:44 -05:00
Nathaniel Nicandro
923e30e0f7
Update section in README about how to start a remote kernel
Closes #86
2019-04-10 09:44:43 -05:00
Nathaniel Nicandro
49571ecd8d
jupyter-repl-display-kernel-buffer: Ensure that the manager has a kernel process 2019-04-08 12:44:49 -05:00
Nathaniel Nicandro
a6e41c5b42
jupyter-ioloop--function: Don't set jupyter-ioloop-timeout to 0
This was too arbitrary. Leave the setting of `jupyter-ioloop-timeout` to users.
2019-04-08 12:44:48 -05:00
Nathaniel Nicandro
29bc5f6c2d
jupyter-ioloop--function: Byte compile after setup
This accounts for changes in
dzop/emacs-zmq@b35b0b5fcd, in particular byte
compiling the form passed to `zmq-start-process` too early causes issues with
macro expansion if there are library dependencies.
2019-04-08 12:44:48 -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
0859d455ef
jupyter-hb--send-ping: Don't capture a strong reference to the channel
This ensures that the channel is allowed to get garbage collected if a client
goes out of scope without calling `jupyter-hb-pause`.
2019-04-08 12:44:48 -05:00
Nathaniel Nicandro
89fb38da05
Add jupyter-error-if-not-client-class-p 2019-04-08 12:44:48 -05:00
Nathaniel Nicandro
2cfdd6ecfb
Add jupyter-weak-ref(-resolve)? 2019-04-08 12:44:48 -05:00
Nathaniel Nicandro
53c2ffdd51
jupyter-repl-after-change (julia): Use :user-expressions key to compute Pkg prompt (#73)
Instead of using `jupyter-eval` which creates unnecessary `:execute-input` and
`:execute-result` messages, use the `:user-expressions` key of an execute
request to compute the Pkg prompt. This way the only message generated is an
`:execute-reply` and we avoid modifying the execution count.

This requires JuliaLang/IJulia.jl@85eb54ae17
2019-04-06 12:40:17 -05:00
Daniel Gomez
96c872fb7c Set show-trailing-whitespace to nil for jupyter buffers. (#83) 2019-04-06 12:39:00 -05:00
Nathaniel Nicandro
82ec2fb786 Handle all valid arguments in client propagating advise
Fixes #76.
2019-04-01 21:45:00 -05:00
Nathaniel Nicandro
128a10c156 jupyter-org-insert-src-block: Simplify insertion of blank lines 2019-04-01 21:44:00 -05:00
Nathaniel Nicandro
314edc19a8
Wrap jupyter shell command calls into the function jupyter-command
This also removes the use of `shell-command-to-string`, replacing it directly
with `process-file`. `shell-command-to-string` uses `shell-file-name` directly
which may not work properly when `default-directory` is a remote directory as
the remote directory may have a different shell than the local one. See #75.
2019-03-31 10:40:09 -05:00
Nathaniel Nicandro
00fa25a117
jupyter-insert-latex: Temporarily set kill-buffer-hook to nil 2019-03-31 10:40:09 -05:00
Nathaniel Nicandro
6a1afa1623
jupyter-org-restart-and-execute-to-point: Make argument optional 2019-03-31 10:40:09 -05:00
Nathaniel Nicandro
03ead7392e
jupyter-org-insert-src-block: Avoid space at end of header line 2019-03-31 10:40:09 -05:00
Nathaniel Nicandro
80c623ab40
jupyter-org--set-current-src-block: Simplify calculation of block end
This also fixes an edge case when there is only one blank line after the source
block. The previous version would consider the beginning of the last line of
the code block as the end instead of the beginning of the `#+end_src` line in
that case.
2019-03-31 10:40:09 -05:00
Nathaniel Nicandro
460eba73ec
Update tests to consider changes in message handling 2019-03-29 12:57:54 -05:00
Nathaniel Nicandro
03a8067e6e
jupyter-handle-message: Only examine :execute-reply of owned requests 2019-03-29 12:29:16 -05:00
Nathaniel Nicandro
d4e24d7870
jupyter-handle-message: Fix update of execution-count 2019-03-29 01:20:39 -05:00
Nathaniel Nicandro
2c005cab7b
jupyter-org-insert-src-block: Find the closest language to use
If `point' is not on a source block, look near `point' for a source block with
a Jupyter language and use that one.

Closes #66.
2019-03-29 00:37:38 -05:00
Nathaniel Nicandro
fbdbe60c95 Add jupyter-org-execute-subtree 2019-03-28 23:29:02 -05:00
Nathaniel Nicandro
7301d6a58c jupyter-org-execute-to-point: Be more aware of the kernel session 2019-03-28 23:29:02 -05:00
Nathaniel Nicandro
580776bf58 Add org-babel-jupyter-src-block-session 2019-03-28 23:29:02 -05:00
Nathaniel Nicandro
5c1643bf77
jupyter-org-jump-to-visible-block: Don't byte compile undefined macro
`avy-with` is a macro that might not be defined at compile time, but at the
same time we do not want to depend on `avy` so we have to ensure that we only
do byte compilation when first loading the function at run time.
2019-03-28 21:55:42 -05:00
Nathaniel Nicandro
c3e67281f1
Add TOC in README 2019-03-28 14:31:17 -05:00
Nathaniel Nicandro
9ff1722293
jupyter-org-with-src-block-client: Macro hygiene 2019-03-27 22:26:26 -05:00
Nathaniel Nicandro
ad5113b9a7
jupyter-start-kernel: Better error reporting during kernel startup
See https://github.com/dzop/emacs-jupyter/issues/70#issuecomment-476940527

* jupyter-kernel-manager.el
(jupyter--kernel-sentinel): Make ignored argument optional.
(jupyter--start-kernel): Don't set the process sentinel.
(jupyter-start-kernel): Report any errors after timeout.
Set the process sentinel as a last step.
2019-03-27 14:34:27 -05:00
Nathaniel Nicandro
4a01e375ae
Update Emacs version used for travis 2019-03-25 14:36:20 -05:00
Nathaniel Nicandro
25975b9fae
Use the right type predicates 2019-03-25 13:19:02 -05:00
Nathaniel Nicandro
2f18192ae7
Remove redundant :execute-input handlers
The `execution-count` slot of a `jupyter-kernel-client` is now updated higher
up in the message handling process which makes these handlers unnecessary.
2019-03-25 13:19:02 -05:00
Nathaniel Nicandro
569ae50214
jupyter-repl-ret: Avoid syncing execution state
There is really no reason for this sync since it happens after checking if the
kernel is busy and the execution-count is now updated whenever an execute_input
message is received in the `jupyter-handle-message` of a
`jupyter-kernel-client`.
2019-03-24 00:11:22 -05:00
Nathaniel Nicandro
a6e476a624
Update a client's execution-count slot on an :execute_input message 2019-03-24 00:11:22 -05:00
Nathaniel Nicandro
67984994a8
jupyter-org-insert-src-block: Consider edge cases when preserving whitespace 2019-03-23 23:33:24 -05:00