Commit graph

1622 commits

Author SHA1 Message Date
Nathaniel Nicandro
178ce69ace Clarify documentation of jupyter-channel methods 2019-05-07 00:38:01 -05:00
Nathaniel Nicandro
2091a01b52 org-babel-jupyter-strip-ansi-escapes: Avoid when-let* 2019-05-07 00:38:01 -05:00
Nathaniel Nicandro
d8781d594c Fix byte compile warning 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
abd7bed138
Fast finish when testing on Travis 2019-05-04 09:33:38 -05:00
Nathaniel Nicandro
112769e0c6
Bump version 2019-05-04 03:31:50 -05:00
Nathaniel Nicandro
598359459c
jupyter-R.el: Fix byte compilation warnings 2019-05-04 02:56:08 -05:00
Nathaniel Nicandro
0357961777 Add Appveyor build script 2019-05-04 02:33:11 -05:00
Nathaniel Nicandro
c8dd1236df Generalize tests for Windows 2019-05-04 02:33:11 -05:00
Nathaniel Nicandro
f4bf16079d jupyter-start-kernel: Don't check access time of conn. file on Windows 2019-05-04 02:33:11 -05:00
Nathaniel Nicandro
f890238345 Handle Windows systems when using jupyter-ioloop
On Windows systems we can't poll the STDIN of the created subprocess when using
`jupyter-ioloop` since Windows does not allow polling file handles. To get
around this we create a (PUSH, PULL) socket pair that the parent Emacs process
uses to communicate with its subprocess. See dzop/emacs-zmq#10 and thanks to
@fleimgruber for investigating this issue.
2019-05-04 02:33:11 -05:00
Nathaniel Nicandro
32ce45b707
Fix Travis 2019-05-04 01:41:31 -05:00
Nathaniel Nicandro
4a07dc143e
Add test for jupyter-ioloop-wait-until 2019-05-04 01:27:54 -05:00
Nathaniel Nicandro
1ff22c1827
jupyter-ioloop-last-event: Return nil when there is no process 2019-05-04 01:27:54 -05:00
Nathaniel Nicandro
67d7bce1e3
jupyter-ioloop-add-callback: Use jupyter-send 2019-05-04 01:27:54 -05:00
Nathaniel Nicandro
6bb9390c0e
Update Travis build script 2019-05-04 01:25:59 -05:00
Nathaniel Nicandro
ea9c752823
Bump required zmq version 2019-05-03 14:02:40 -05:00
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