Commit graph

1797 commits

Author SHA1 Message Date
astoff
d4b06c54d3 jupyter-repl-traceback face: use a light background on light themes
The previous value of this face used a dark background even on light themes, making
error messages hard to read.
2020-03-05 18:42:07 -06:00
Arthur Colombini Gusmão
9e3c163358 fix: show pop-up buffer when REPL not visible
The described behavior for when `jupyter-repl-echo-eval-p` is `t` and the REPL buffer is not visible was not working, i.e., no pop-up buffer was being show.
2019-10-19 10:19:58 -05:00
Kevin Foley
8fdc3ae95b Preserve content in current cell when set to echo eval (#188)
* Preserve content in current cell when set to echo eval
2019-10-17 10:37:13 -05:00
Arthur Colombini Gusmão
7d5f978328 Move whitespace to overlay prefix
Move the whitespace that was originally concatenated to the prefix variable `jupyter-eval-overlay-prefix` to the variable itself, so that it can be easily customized. For instance, in the case where one does not want any prefix, with the changes, it can be easily removed by setting the prefix variable to the empty string. Originally one would have to also modify the function `jupyter-eval-ov--propertize` to achieve the same result.
2019-10-16 13:03:56 -05:00
Jack Kamm
7f82e5db8c ob-jupyter: fixes #185 relative path to remote :session json 2019-10-16 13:03:02 -05:00
Nathaniel Nicandro
53da538b66 jupyter-org-hydra/body: Add scratch buffer binding 2019-09-23 20:43:39 -05:00
Nathaniel Nicandro
e92d265869 jupyter-server-kernel-list-mode: Sort list by activity
* jupyter-server.el (jupyter-server--kernel-list-entries):
Add missing jupyter-time text property to activity string.
(jupyter-server-list-kernels): Set `tabulated-list-sort-key`.
2019-09-23 20:40:39 -05:00
Nathaniel Nicandro
c1b597556b Light refactoring
* jupyter-base.el: Don't add `jupyter-server-mode--unset-client-soon` to
`server-switch-hook` at toplevel
(jupyter-server-mode-set-client): Add `jupyter-server-mode--unset-client-soon`
to `server-switch-hook` if necessary.

* jupyter-client.el: (jupyter--run-callbacks): Use `when-let`.
(jupyter--set-callback): Remove.
(jupyter--add-callback): Use `add-function`.

* jupyter-ioloop.el (jupyter-ioloop-add-arg-type): Use `setf` along with `alist-get`.
(jupyter-ioloop--replace-args): Use `pcase`.
(jupyter-ioloop--event-dispatcher): Extract out event cases into variable `user-events`.
(jupyter-ioloop--body): New function.
(jupyter-ioloop--function): Use it.

* jupyter-kernel-process-manager.el
(jupyter--kernel-died-process-sentinel)
(jupyter-stop-channels): Use `when-let`.

* jupyter-org-client.el (jupyter-org-interaction-mode): Use `cl-callf2?`.

* jupyter-server.el: Add TODO.

* jupyter-tramp.el: Remove unused function declaration.
2019-09-22 14:27:40 -05:00
Nathaniel Nicandro
198c036f51 jupyter-org-indent-inserted-region: Reduce verbosity of doc 2019-09-22 13:33:42 -05:00
Nathaniel Nicandro
dcf80d51db Remove jupyter-comm--channel
Since we are using keyword to represent channels on the client level, use a
plist of channels on the comm layer level instead of channel slots. This allows
us to remove `jupyter-comm-channel` and simplify the relevant code somewhat.
2019-09-17 11:42:21 -05:00
Nathaniel Nicandro
470521dac5 jupyter-current-server: Signal an error for non-existent servers
Only do so when asking the user for a URL and no server exists at the URL
provided. See #183.

* jupyter-server.el (jupyter-server-non-existent): New error.
(jupyter-current-server): Signal `jupyter-server-non-existent` when asking the
user for a server URL and a server doesn't exist at URL.
2019-09-15 20:26:54 -05:00
Nathaniel Nicandro
29b3a3d79f .travis.yml: Use nix-emacs-ci instead of evm 2019-09-15 19:01:16 -05:00
Nathaniel Nicandro
8fd5d8d95e Fix error handling in TRAMP functions for Emacs >= 27
TRAMP sets its own value of `signal-hook-function` which interferes with
`signal` data when handling errors in `condition-case` so unbind
`signal-hook-function` until we have a chance to look at `signal` data.

* jupyter-server.el (jupyter-kernel-alive-p): Use `nth`

* jupyter-tramp.el (jupyter-tramp--get-directory-or-file-model)
(jupyter-tramp-delete-directory): Unbind `signal-hook-function`.
2019-09-15 19:00:18 -05:00
Nathaniel Nicandro
aee4d39449 jupyter-decode-time: Remove fractional times before calling parse-iso8601-time-string
Emacs 27 seems not to be able to handle this case, maybe never has been able to
handle it properly.
2019-09-15 16:33:30 -05:00
Nathaniel Nicandro
8cca30aea3 Fix ert--print-backtrace being undefined during tests on Emacs >= 27
This is a workaround until `ert-runner` supports Emacs 27
2019-09-15 16:33:24 -05:00
Nathaniel Nicandro
a149107e2a Don't depend on libjpeg being installed during tests 2019-09-15 16:29:57 -05:00
Nathaniel Nicandro
49ad1eef83 jupyter-comm-id (jupyter-server-kernel-comm): Return kernel alias if available 2019-09-15 14:50:43 -05:00
Nathaniel Nicandro
2245d66b0f org-babel-execute:jupyter: Use "???" as a placeholder when inline results are pending
Closes #175.
2019-09-14 18:20:28 -05:00
Nathaniel Nicandro
774036e378 Update CHANGELOG 2019-09-14 17:49:57 -05:00
Nathaniel Nicandro
afbb9b5134 jupyter-generate-request (jupyter-org-client): Handle indirect buffers
Verify that the `major-mode` of the `buffer-base-buffer` is derived from
`org-mode` if the `current-buffer` happens to be an indirect one. This should
allow `emacs-jupyter` to work better with `polymode`. See #171.
2019-09-14 17:20:52 -05:00
Yuji Nakao
f5560e56f6 Fix minor typo 2019-09-14 13:09:38 -05:00
Nathaniel Nicandro
2df28f2d9c README.org: Update TOC 2019-09-13 01:36:13 -05:00
Nathaniel Nicandro
e1564dfc93 jupyter-org-result: Include message type in warning
When the `:display` header argument is used and a particular message type
doesn't return a mime bundle with one of the requested mime types, include the
message type in the warning that is displayed.

This should clarify the situation where an `:execute-result` and
`:display-data` message both return data to display, but one of them does not
have one of the mimetypes requested in the `:display` header argument.

Closes #144.
2019-09-12 17:30:48 -05:00
Nathaniel Nicandro
c5fd3edc85 jupyter-available-kernelspecs: Clarify documentation 2019-09-12 17:24:54 -05:00
Nathaniel Nicandro
438ac0afd4 jupyter-org--image-result: Prefer when instead of if 2019-09-10 13:43:02 -05:00
Nathaniel Nicandro
4de01643c8 jupyter-eval: Revert back to not using jupyter-eval-string
`jupyter-eval-string` adds unwanted callbacks to the request. `jupyter-eval` is
meant to evaluate code without any changes occurring in the buffer.
2019-09-03 18:09:16 -05:00
Nathaniel Nicandro
79ddd9357e Add org-babel-jupyter-current-src-block-params
This is needed because `org-mode` merges many sources of source block params so
its not enough to just re-compute the parameters in `jupyter-generate-request`
using `org-babel-get-src-block-info` or `org-babel-log-get-info`.
2019-09-01 11:43:46 -05:00
Nathaniel Nicandro
aa9b634e7b jupyter-eval-string-command: Fix wrong number of arguments 2019-08-28 15:43:54 -05:00
Nathaniel Nicandro
091857a21b Remove unnecessary uses of jupyter-weak-ref 2019-08-27 14:02:53 -05:00
Nathaniel Nicandro
0ff69491cd jupyter-inspect: Fix commentary 2019-08-27 14:02:53 -05:00
Nathaniel Nicandro
0484fa1191 jupyter-server-ioloop: Spend more time waiting for input
As opposed to spending most of the time waiting for websocket messages.

This makes Emacs more responsive in scenarios where we are sending input to a
kernel and immediately waiting for a response, e.g. in `jupyter-repl-ret` and
`jupyter-eval`.
2019-08-27 14:01:37 -05:00
Nathaniel Nicandro
fbabaa2303 Update CHANGELOG 2019-08-24 21:29:54 -05:00
Nathaniel Nicandro
91957986e1 Evaluation overlays
* README.org: Add section on `jupyter-eval-use-overlays`, minor formatting fix

* jupyter-client.el (jupyter-eval-overlay): New face.
(jupyter-eval-use-overlays, jupyter-eval-overlay-prefix): New custom variables.
(jupyter--display-eval-result): Remove function.
(jupyter-eval): Use `jupyter-eval-string`.
(jupyter-eval-result-callbacks): New function.
(jupyter-eval-add-callbacks): Result callbacks now obtained from
`jupyter-eval-result-callbacks`, only add callbacks for non-result message
types. Allow `beg` and `end` arguments remove `result-cb` argument, update all
callers.
(jupyter-eval-string): Allow `beg` and `end` arguments remove `cb` argument,
update all callers.
(jupyter-eval-string-command): Remove `cb` argument, update all callers.
(jupyter-eval-region): Ditto.
(jupyter-eval-line-or-region): Refactor.
(jupyter-eval-overlay-keymap): New keymap.
(jupyter-eval-ov--delete, jupyter-eval-ov--remove-all)
(jupyter-eval-ov--propertize, jupyter-eval-ov--fold-boundary)
(jupyter-eval-ov--expand-string, jupyter-eval-ov--make)
(jupyter-eval-ov--expand, jupyter-eval-ov--fold)
(jupyter-eval-toggle-overlay, jupyter-eval-remove-overlays)
(jupyter-eval-display-overlay, jupyter-eval-display-with-overlay-p): New
functions.

* jupyter-repl.el (jupyter-eval-string): Ensure callbacks are added in the
original (non-REPL) buffer the command was called from. So that
`jupyter-eval-display-with-overlay-p`, indirectly called by
`jupyter-eval-add-callbacks`, works.
(jupyter-repl-interaction-mode-map): Set `C-c C-o` binding to
`jupyter-eval-remove-overlays`.
2019-08-24 21:28:58 -05:00
Nathaniel Nicandro
797ce5e0e6 jupyter-api-delete-cookies: Fix cookie expiration in test 2019-08-24 17:19:42 -05:00
Nathaniel Nicandro
81b034dad9 Remove unused jupyter-tramp.el functions 2019-08-24 16:27:46 -05:00
Nathaniel Nicandro
96aaedf5b5 jupyter-ioloop--dump-message: Don't abbreviate printed lists 2019-08-13 19:50:53 -05:00
Nathaniel Nicandro
4b97a72cdd Don't overwrite default url-cookie-file during tests
This is now easier to do since the value of `url-cookie-file` is propagated to
websocket subprocesses.
2019-08-11 14:22:28 -05:00
Nathaniel Nicandro
c4dc513c52 Add FIXME 2019-08-08 22:49:48 -05:00
Nathaniel Nicandro
39974d1841 jupyter-repl-restart-kernel: Use a kernel manager to restart if possible
* jupyter-repl.el (jupyter-repl-restart-kernel):
Call the `jupyter-shutdown-kernel` method of the client's kernel manager if
available.
Remove code that started a kernel when restarting if a manager was available,
this is already handled by `jupyter-shutdown-kernel`.
2019-08-08 22:04:27 -05:00
Nathaniel Nicandro
7a1c91eef4 Add the jupyter-kernel-process-manager class
So as to further generalize and separate out the abstract kernel manager class
from its various implementations.

* jupyter-kernel-manager.el (jupyter-meta-kernel): Fix documentation.
(jupyter-kernel-process, jupyter-command-kernel, jupyter-spec-kernel):
Move related functions and methods to `jupyter-kernel-process-manager.el`
(jupyter-kernel-manager-base): Remove class.
(jupyter-kernel-manager): Re-purpose class as the base class of all kernel
managers. The class corresponding to the old functionality is now named
`jupyter-kernel-process-manager`. Move all related functions and methods for
`jupyter-kernel-process-manager` to `jupyter-kernel-process-manager.el`.

* jupyter-kernel-process-manager.el: New file.

* jupyter-repl.el: Require `jupyter-kernel-process-manager` instead of
`jupyter-kernel-manager`.

* jupyter-server.el (jupyter-server-kernel-manager): Inherit from
`jupyter-kernel-manager` instead of `jupyter-kernel-manager-base`.

* test/jupyter-test.el (jupyter-kernel-lifetime)
(jupyter-command-kernel): Use `jupyter-kernel-process-manager` instead of
`jupyter-kernel-manager`.

* test/test-helper.el: Require `jupyter-kernel-process-manager` instead of
`jupyter-kernel-manager`.
2019-08-08 22:04:27 -05:00
Nathaniel Nicandro
23f41cf86c Add jupyter-kernel-alive-p method for a jupyter-kernel-client
* jupyter-client.el (jupyter-kernel-alive-p): Do it.

* jupyter-repl.el (jupyter-repl-connected-p): Use it.
2019-08-08 21:55:22 -05:00
Nathaniel Nicandro
8c711dd3ce jupyter-repl-client-has-manager-p -> jupyter-client-has-manager-p
* jupyter-client.el (jupyter-client-has-manager-p): New function.

* jupyter-repl.el (jupyter-repl-client-has-manager-p): Remove function.
(jupyter-repl-connected-p, jupyter-repl-kill-buffer-query-function):
(jupyter-repl-restart-kernel, jupyter-repl-display-kernel-buffer):
Rename calls to `jupyter-repl-client-has-manager-p` to
`jupyter-client-has-manager-p`.

* test/jupyter-test.el (jupyter-repl-client-predicates):
Rename calls to `jupyter-repl-client-has-manager-p` to
`jupyter-client-has-manager-p`.
2019-08-08 21:55:22 -05:00
Nathaniel Nicandro
3beb736853 Add jupyter-repl-completing-read-repl-buffer
* jupyter-repl.el (jupyter-repl-completing-read-repl-buffer): Do it.
(jupyter-repl-restart-kernel, jupyter-repl-associate-buffer): Use it.
2019-08-08 18:22:59 -05:00
Nathaniel Nicandro
7e4b24288b jupyter-add-callback: Mention behavior for multiple callbacks 2019-08-08 17:51:35 -05:00
Nathaniel Nicandro
f4aa755126 Add jupyter-server--refresh-comm 2019-08-08 17:51:20 -05:00
Nathaniel Nicandro
388d7b923c Add Gitter badge 2019-08-02 13:58:41 -05:00
Nathaniel Nicandro
5b34e99bbf jupyter-hb-channel: Increase timeouts
See #141 and #164.

* jupyter-zmq-channel.el (jupyter-hb-max-failures): Reduce to 3.
(jupyter-hb-channel): Increase `time-to-dead` slot to 10 s.
2019-08-02 11:48:28 -05:00
Nathaniel Nicandro
6b1baf1fde jupyter-api-with-subprocess-setup: Set url-cookie-file to its parent process value 2019-08-01 16:26:43 -05:00
Nathaniel Nicandro
4e3a8d4dc2 README.org: Mention jupyter-api-authentication-method 2019-07-31 14:28:01 -05:00
Nathaniel Nicandro
8f35f135d7 jupyter-gc-servers: Delete cookies when cleaning up servers
See #161

* jupyter-rest-api.el (jupyter-api--delete-cookie):
(jupyter-api-delete-cookies): New functions.

* jupyter-server.el (jupyter-gc-servers): Do it.

* test/jupyter-server-test.el (jupyter-api-delete-cookies): New test.
2019-07-31 14:19:15 -05:00