Commit graph

20 commits

Author SHA1 Message Date
Nathaniel Nicandro
0222a236e9 jupyter-tramp--get-directory-or-file-model: Support newer versions of Jupyter 2023-02-13 20:30:20 -06:00
Nathaniel Nicandro
d88ef94169 jupyter-tramp-write-region: Decode text read from temp file after appending
If the text is kept unibyte, the `princ` call made internally by
`json-encode-plist` on the text will turn byte sequences like "\310"
into "\\310" before doing the actual encoding.  Using plain `insert`
instead, like was done before
emacs-mirror/emacs@428339e231, keeps the
byte sequence intact.
2023-02-13 20:30:20 -06:00
Nathaniel Nicandro
cbd521dc72 Remove jupyter-find-server
The same `jupyter-server` instance is always returned for the same URL
by a call to `jupyter-server` so there is no need to find a server
anymore.
2023-02-13 20:25:05 -06:00
Jürgen Hötzel
4d62a88951 Use TRAMP handler for access-file
Fixes file-not-found error when using `dired`.
2023-02-04 20:18:06 -06:00
Nathaniel Nicandro
403c70c83c Bump version 2020-04-07 15:13:51 -05:00
Nathaniel Nicandro
b66ddf50eb Fix missing argument in call to tramp-run-real-handler
* jupyter-tramp.el (jupyter-tramp-expand-file-name): Do it.
2020-03-17 17:39:54 -05:00
Nathaniel Nicandro
045f2b8b42 Fix recursive loading caused by autoload in jupyter-tramp.el
fixes #172
fixes #215

* jupyter-tramp.el (jupyter-tramp-file-name-p): Change to `defsubst`.
2020-03-14 14:39:35 -05:00
Nathaniel Nicandro
be8ee2c482 Remove unused function
That also happens to use a ZMQ function.

* jupyter-rest-api.el (jupyter-api-upload-large-file): Do it.

* jupyter-tramp.el: Remove mention of `jupyter-api-upload-large-file` in a
  comment.
2020-03-13 19:14:32 -05:00
conao3
fb8c2c75fd two spaces after a period 2020-03-12 18:20:15 -05:00
conao3
1546a72f57 clean header 2020-03-10 23:39:35 -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
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
81b034dad9 Remove unused jupyter-tramp.el functions 2019-08-24 16:27:46 -05:00
Nathaniel Nicandro
98adac6d31 Fix definitions of jupyter-tramp-file-name(-method)?-p
Fixes #155.

* jupyter-tramp.el (jupyter-tramp-file-name-method-p):
(jupyter-tramp-file-name-p): Adhere to documentation.

* test/jupyter-tramp-test.el (jupyter-tramp-file-name-p): Add test.
2019-07-27 12:22:47 -05:00
Nathaniel Nicandro
fa3f7c8b31 Handle encoding when making REST API requests
* jupyter-rest-api.el: Ensure strings are encoded before making HTTP request.
(jupyter-api-http-request): Encode JSON as utf-8.
(jupyter-api-xsrf-header-from-cookies): Ensure header isn't multibyte.
(jupyter-api-authenticate): For the token method, ensure token isn't multibyte.
(jupyter-api-copy-file): Encode string before encoding to base64 for binary content.
(jupyter-api-read-file-content): Decode content as utf-8 when necessary.

* jupyter-tramp.el
(jupyter-tramp-write-region): Ensure only `utf-8` or `binary` coding systems
are used since Jupyter only supports those.

* test/jupyter-tramp-test.el: Update for above changes.
2019-07-24 16:59:04 -05:00
Nathaniel Nicandro
933e5c65a6 Cache file model contents in a buffer
* jupyter-rest-api.el (jupyter-api-content-buffer): New function.
(jupyter-api-insert-model-content): Use it.

* jupyter-tramp.el (jupyter-tramp-file-local-copy): Use it.
2019-07-24 16:59:04 -05:00
Nathaniel Nicandro
d018434b4a jupyter-tramp-get-file-model: Break up into more functions 2019-07-24 16:59:04 -05:00
Nathaniel Nicandro
e35981d147 jupyter-rest-api.el: Refactor login and authentication 2019-07-24 16:59:04 -05:00
Nathaniel Nicandro
5bd164c224 Error when trying to read a notebook through a server
We can't do much with a JSON representation of a notebook right now.
2019-07-24 16:59:04 -05:00
Nathaniel Nicandro
4a87d35f76 Jupyter notebook contents API integration with TRAMP 2019-07-24 16:59:04 -05:00