Commit graph

1481 commits

Author SHA1 Message Date
Nathaniel Nicandro
c18de820e9 .travis.yml: Quiet shell output during testing 2019-05-09 09:41:19 -05:00
Nathaniel Nicandro
c9770d1789 appveyor.yml: Call WaitForExit() on the Emacs process before checking its exit code 2019-05-09 08:41:16 -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
4302da35ef Shutdown kernel properly when testing 2019-05-07 22:47:22 -05:00
Nathaniel Nicandro
e948d4f705 Try to make jupyter-weak-ref test more reliable 2019-05-07 22:47:22 -05:00
Nathaniel Nicandro
1d8f28f2fc Simplify test macros
Also fix misuse of `alist-get`. `alist-get` uses `assq` for comparison by
default, but we are comparing strings. This caused issues when caching REPL
buffers and the subsequent re-use of them during testing.
2019-05-07 17:30:16 -05:00
Nathaniel Nicandro
87d078edca Add more tests
* Add tests for `jupyter-weak-ref`, `jupyter-add-finalizer`, and `jupyter-eval`
2019-05-07 17:30:16 -05:00
Nathaniel Nicandro
820202eca7 Fix typo 2019-05-07 00:38:01 -05:00
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