Commit graph

789 commits

Author SHA1 Message Date
Nathaniel Nicandro
ea0d186007 Silence byte compiler 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
d49256d708 Handle edge case in jupyter-repl-previous-cell
When `point` is already at the beginning of the first cell in a REPL buffer,
`jupyter-repl-previous-cell` would say that a motion was performed when in
reality it hadn't.
2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
355e0763c0 Always consider point-max as the end of a cell 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
44ec23bbf2 Support accessing kernelspecs on remote hosts 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
61b8b1250d [WIP] Add more tests 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
0248c81f27 Refactor jupyter-repl-initialize-fontification for readability 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
e94db94851 Refactor jupyter-repl-eval-file for readability 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
83fb582270 Remove duplicated code in jupyter-repl-eval-string
* Remove duplicated `string-trim` calls

* Allow the silently argument to be any non-nil value
2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
2945660017 Fix use of other-window-scroll-buffer 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
e54ec95317 Refactor prompt insertion
* Replace `jupyter-repl--insert-prompt` with `jupyter-repl--make-prompt` which
  only makes the prompt overlay and adds text properties to the overlayed
  character. `jupyter-repl--insert-prompt` would also insert the newline
  character for the overlay as well as recenter the overlays. These tasks are
  now handled by `jupyter-repl-insert-prompt`.

* Add notes on why an invisible character is inserted along with the prompts.

* `jupyter-repl-cell-code` properly handles invisible characters introduced by
  line continuation prompts.

* Don't make the invisible character inserted by continuation prompts
  read-only.

* Use a marker to keep track of the end position of the cell when inserting
  continuation prompts.

* Guard against searching past boundary when inserting continuation prompts
2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
de9f85cc2e Update documentation, cleanup comments
* Remove implementation details in documentation strings

* Canonicalize documentation of functions which perform similar operations.
2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
7b3e4f9f84 Fix encoding/decoding time objects
* Handle the case of no time specification by defaulting to midnight when
  decoding time

* Properly handle fractions in `jupyter--decode-time`

* Implement `jupyter--encode-time`

* Consider a time object to be a length 4 list of integers and encode the
  object using `jupyter--encode-time` when encoding in `jupyter--encode`

* Add tests for time decoding/encoding
2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
417162c439 Only switch to the REPL buffer when necessary 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
26c39c3d55 jupyter-repl--inspect accepts the detail argument for inspect messages 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
55449c1d6a Introduce jupyter-org-client
- A `jupyter-org-client` is a subclass of a `jupyter-repl-client` and replaces
  the use of callbacks in `org-babel-execute:jupyter` to handle the insertion
  of code block results in an `org-mode` buffer. `ob-jupyter.el` now only
  contains the integration with `org-babel` and all integration with
  `emcacs-jupyter` is placed in `jupyter-org-client.el`

- Introduce `jupyter-org-request`, which inherits all of the field of a
  `jupyter-request` and adds the fields necessary for keeping track of the
  source code block information a request was generated from during the
  lifetime of the request.
2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
7bd130e059 Always return the client in run-jupyter-repl 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
c3681bdb8c Add methods to hook into request creation/deletion
- Add the method `jupyter-generate-request` to allow subclasses to initialize
  their own request objects with extra fields in addition to those of
  `jupyter-request`.

- Add the method `jupyter-drop-request` to allow subclasses to do any cleanup
  once a request is complete.
2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
ba17924b5d Take into account the initial value of the buffer slot for a jupyter-repl-client 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
4566fce2e3 Allow supplying a client class in run-jupyter-repl and connect-jupyter-repl 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
aab35e6eed Include missing status field in execute-reply handler 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
ed793fc183 Use string-match-p instead of string-match 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
bbb677c573 Pop up traceback buffer on errors when executing code blocks 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
892ab84148 Silence byte compiler warnings 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
23cecb9c0f [WIP] Widget support in ob-jupyter 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
10a56c2f54 Refactor widget implementation
* Use the `target-name` argument in `jupyter-handle-comm-open`

* Remove hard-coded URL format and use the new variable
  `jupyter-widgets-url-format` instead

* Add `jupyter-widgets-supported-targets` to explicitly state which widget
  targets are supported

* Rename `widget-proc` to `widget-sock` in a `jupyter-widget-client`

* Initialize the widget socket only when opening a valid comm

  * Previously it was initialized when the client was initialized, but a client
    may not even create any widgets so the widget socket would be unused.

* Use `pcase` in `jupyter-widgets-on-message`

* Update documentation and commentary of `jupyter-widget-client`
2018-08-30 18:12:18 -05:00
Nathaniel Nicandro
2552b4ff99 Add notes on how EmacsJupyter works 2018-08-30 18:12:18 -05:00
Nathaniel Nicandro
c207bea8d4 Fix indentation 2018-08-30 18:02:25 -05:00
Nathaniel Nicandro
c7c50f4908 Better error reporting when the kernel process dies in jupyter-start-kernel 2018-08-30 18:02:25 -05:00
Nathaniel Nicandro
22b1e809a0 Update documentation, cleanup comments 2018-08-30 18:02:13 -05:00
Nathaniel Nicandro
ce3d9a377c Refactor jupyter--sign-message 2018-05-30 12:54:55 -05:00
Nathaniel Nicandro
122748b25e Do not pass the signature when signing message parts 2018-05-30 12:54:55 -05:00
Nathaniel Nicandro
7c218b233c Ensure that parts of a message that need to be dictionaries are encoded as such 2018-05-30 12:54:55 -05:00
Nathaniel Nicandro
81e3ebb44c Use jupyter-repl-language 2018-05-30 12:54:55 -05:00
Nathaniel Nicandro
8976a1d59e Remove special behavior of jupyter-repl-cell-count 2018-05-30 12:54:37 -05:00
Nathaniel Nicandro
04ecedd320 Only inhibit handlers when necessary
This ensures that any bookkeeping done in the handlers is actually performed.
2018-05-30 12:50:59 -05:00
Nathaniel Nicandro
d875ce7116 Do not display colon in prompts 2018-05-30 12:50:59 -05:00
Nathaniel Nicandro
382aa9999c Absorb displaying widgets into jupyter-repl-insert-data 2018-05-30 12:50:57 -05:00
Nathaniel Nicandro
d7a064cae5 Fix read-only error when inserting into the *jupyter-repl-output* buffer 2018-05-30 12:49:29 -05:00
Nathaniel Nicandro
3c34c1f7ed Do not handle reply messages with an error status specially 2018-05-30 12:49:28 -05:00
Nathaniel Nicandro
ff54004129 Do not rely on message time when dropping requests 2018-05-30 12:49:28 -05:00
Nathaniel Nicandro
70be58129e Rename jupyter-message-parent-message-type -> jupyter-message-parent-type 2018-05-30 12:49:28 -05:00
Nathaniel Nicandro
3a95d2705b Prevent flickering when updating displayed data 2018-05-30 12:49:28 -05:00
Nathaniel Nicandro
e7f1f8307a Refactor for readability
- Be more obvious in `jupyter-repl-ret`

- Prefer shorter lines in `js/emacs-jupyter.js`

- Add `jupyter-repl-language`

- Refactor `jupyter-handle-error` for `jupyter-repl-client's

  - Include margin width when fixing traceback spacing for python kernels

  - Extract out special handling of python kernels in `jupyter-handle-error`
2018-05-30 12:49:28 -05:00
Nathaniel Nicandro
1d9f9d06ad Include customization types 2018-05-28 01:25:33 -05:00
Nathaniel Nicandro
00923a4bfd Do not rely on status messages to update REPL buffer state 2018-05-28 01:25:33 -05:00
Nathaniel Nicandro
6e68a622cd Handle edge cases when starting a kernel and killing a REPL buffer
- Kill the REPL buffer without asking when the channels are closed

- Only emit a message if the kernel does not respond to a startup message
2018-05-28 01:25:33 -05:00
Nathaniel Nicandro
7e8bdb6c7c Support display_id 2018-05-28 01:25:33 -05:00
Nathaniel Nicandro
aa509d6bee Pass the metadata to jupyter-repl-insert-data 2018-05-28 01:25:33 -05:00
Nathaniel Nicandro
5fd7ccf74f Enable syntax highlighting when using js2-mode with an IJavascript REPL 2018-05-28 01:25:33 -05:00
Nathaniel Nicandro
e654487b2a Allow the possibility of preempting the handler methods using message hooks 2018-05-28 01:25:33 -05:00