Commit graph

39 commits

Author SHA1 Message Date
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
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
7bd130e059 Always return the client in run-jupyter-repl 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
22b1e809a0 Update documentation, cleanup comments 2018-08-30 18:02:13 -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
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
Nathaniel Nicandro
f4c931d57d Avoid double encoding, document message functions, small fixes to message functions
This introduces a way of keeping track of both the encoded and decoded parts of
a message, only decoding the parts of a message when needed, and only encoding
the parts of a message when needed.

If the objects passed to `jupyter--encode` or `jupyter--decode` are lists with
the first element being the symbol `message-part`, then the second element of
the list is interpreted as being the encoded message and the third element
being the decoded part of the message. If either the encoded or the decoded
part are nil, then `jupyter--encode` or `jupyter--decode` will fill those
message parts in and on subsequent calls, passing in the same list, no work
will need to be performed.

This avoids double encoding messages when relaying messages between the channel
subprocess and the browser displaying widgets. This speeds up the communication
process. The cost is storing two representations of the same message, i.e.
speed vs memory.

Fixes:

- Use `eq` instead of `equal` in message status predicates
- Fix time string decoding
  - `parse-time-string` was returning all nil on Emacs 26
- Include validation for parent header in `jupyter--encode-message`
- Use `jupyter-message-header' to access the message header instead of `plist-get`
2018-05-28 01:25:33 -05:00
Nathaniel Nicandro
17596ee1c4 Be less ambiguous when encoding/decoding messages
- Do not handle nil as an empty dictionary when encoding.

- Use the default `json-array-type`
2018-05-28 01:25:09 -05:00
Nathaniel Nicandro
276e2a0668 Support widgets in the REPL 2018-05-28 01:25:09 -05:00
Nathaniel Nicandro
50088df2e0 Add widget support 2018-05-28 01:25:09 -05:00
Nathaniel Nicandro
49c1f29d15 Better completion support
- Strip extra prefix from completion matches if necessary

  - The python kernel returns matches like foo.bar.baz, but we just want to
    show the baz part as a completion.

- Prevent completion after '.' in floating point numbers

  - Note this may be undesirable since numbers are just objects in many
    languages and thus have methods associated with them.

- Remove unused no-cache and match cases in `company-jupyter-repl`
2018-05-28 00:50:23 -05:00
Nathaniel Nicandro
be6a6b5c4c Call destructor methods in jupyter-repl-kill-buffer-query-function 2018-05-28 00:35:58 -05:00
Nathaniel Nicandro
cbf8010116 Take into account invisible characters in jupyter-repl-code-context-at-point 2018-05-16 21:54:30 -05:00
Nathaniel Nicandro
0cbe7f2114 Rename jupyter-repl-client.el to jupyter-repl.el 2018-05-16 21:54:30 -05:00
Renamed from jupyter-repl-client.el (Browse further)