Commit graph

320 commits

Author SHA1 Message Date
Nathaniel Nicandro
260ba128eb jupyter-repl-ret: Don't send messages when the kernel is busy 2019-02-09 09:17:00 -06:00
Nathaniel Nicandro
ce6c92a2c4
jupyter-repl-interaction-mode: Remove missing functions from hooks
`jupyter-eldoc-documentation` and `jupyter--xref-backend` are WIPs that somehow
got into master.
2019-02-07 20:01:30 -06:00
Nathaniel Nicandro
0a34860707
Fix package-lint errors 2019-02-07 11:17:24 -06:00
Nathaniel Nicandro
771e267034
Fix checkdoc errors 2019-02-06 22:49:41 -06:00
Nathaniel Nicandro
ee62fafdf6
Fix #14: Undo rear-nonsticky property inserted by insert-for-yank 2019-01-25 23:59:51 -06:00
Nathaniel Nicandro
d7fb71df02
jupyter-repl-indent-line: Only attempt to indent on code cell lines 2019-01-24 10:13:20 -06:00
Nathaniel Nicandro
9ef7553b8a
Handle field property specially when yanking in the REPL 2019-01-23 19:45:41 -06:00
Nathaniel Nicandro
649c54c15f
Silence byte compiler 2019-01-23 19:41:20 -06:00
Nathaniel Nicandro
463245e4f9
jupyter-repl-initialize-fontification: Fix setting of fontify region function 2019-01-22 18:39:17 -06:00
Nathaniel Nicandro
4e2e8642ed
Update a few comments 2019-01-22 18:39:17 -06:00
Nathaniel Nicandro
d709b31a64
Add jupyter-message-lambda
This simplifies the writing of message callbacks.
2019-01-22 18:39:17 -06:00
Nathaniel Nicandro
e439d3a531
jupyter-read-expression (jupyter-repl-client): Remove sentinel value 2019-01-19 15:28:03 -06:00
Nathaniel Nicandro
39fba18b06
Update kernel restart process 2019-01-18 22:02:13 -06:00
Nathaniel Nicandro
e2381e600c
jupyter-repl-propagate-client: Simplify logic 2019-01-18 22:00:58 -06:00
Nathaniel Nicandro
123d847a3e
jupyter-repl-interaction-map -> jupyter-repl-interaction-mode-map 2019-01-17 20:45:45 -06:00
Nathaniel Nicandro
876c080f7f
Add jupyter-kernel-language-mode-properties and related functions 2019-01-17 19:53:04 -06:00
Nathaniel Nicandro
fa809e7801
Fix keybinding in documentation 2019-01-17 19:01:01 -06:00
Nathaniel Nicandro
6b7ecfcf08
Add execution-count slot to a jupyter-kernel-client
This allows the default `jupyter-kernel-client' implementation to do the work
of updating the execution count instead of having subclasses track it.
2019-01-13 22:19:25 -06:00
Nathaniel Nicandro
0c92afea26
Add the jupyter-handle-payload method
This replaces the `jupyter-repl--handle-payload` function and allows payloads
to be handled in other contexts than the REPL, for example inserting a new
source block when receiving a set_next_input payload for the `org-mode` client.
2019-01-13 22:19:25 -06:00
Nathaniel Nicandro
5a3b3bde3a
Use font-lock-fontify-region-function in a REPL buffer
Uses the new function `jupyter-repl-font-lock-fontify-region` to fontify a REPL
buffer. This function will only fontify regions corresponding to input cells
and excludes all other regions from fontification. Regions besides input cells
correspond mainly to output from the kernel and use font-lock-face to fontify
their contents.

This allows us to remove the functions and variables related to adding syntax
properties to the output of a cell since these were previously used to avoid
syntactic fontification of the output.
2018-12-28 12:59:03 -06:00
Nathaniel Nicandro
675bfb0a38
jupyter-repl-initialize-fontification: Use regexp-quote 2018-12-20 19:26:25 -06:00
Nathaniel Nicandro
109ee2cce5
jupyter-repl-initialize-fontification: Fix syntax propertize function
Adds `jupyter-repl--syntax-propertize` which generalizes the old
`syntax-propertize-function` to handle regions containing both cell code and
cell output.
2018-12-20 18:58:23 -06:00
Nathaniel Nicandro
169b5647e5
jupyter-rep-sync-execution-state: Only update the last cell count 2018-12-19 21:05:12 -06:00
Nathaniel Nicandro
df1d135433
jupyter-with-repl-cell: Don't move point after narrowing
Leave this up to the callers of this macro.
2018-12-16 14:56:14 -06:00
Nathaniel Nicandro
bcfdf170b5
jupyter-repl-update-cell-count: Don't assume the buffer has a cell
This avoids a beginning-of-buffer error during initialization of the REPL.
2018-12-16 14:52:36 -06:00
Nathaniel Nicandro
5db8ded2f0
jupyter-repl-cell-code-end-position: Fix what is considered the end position
In Emacs, the end position of a region is exclusive. So functions like
`delete-region` will delete the entire region specified excluding the end
position. Follow this convention with the cell code position.

This fixes issues when adding syntax properties to a cell's code. See
`jupyter-repl-initialize-fontification`.
2018-12-12 11:54:58 -06:00
Nathaniel Nicandro
460b94f17f
Add jupyter-repl-update-cell-count 2018-12-10 21:36:35 -06:00
Nathaniel Nicandro
3cd9078c0c
Ensure with-current-buffer is called on a live buffer 2018-12-10 21:36:35 -06:00
Nathaniel Nicandro
706a0ba6bc
Add jupyter-repl-traceback face 2018-12-10 21:36:35 -06:00
Nathaniel Nicandro
747e82fc22
Be clearer in REPL history functions 2018-12-10 21:36:35 -06:00
Nathaniel Nicandro
7f5c8d8a4b
Be more robust when determining if a call to a command was interactive
As per the `called-interactively-p` documentation.
2018-12-10 21:36:35 -06:00
Nathaniel Nicandro
b1a5e9a914
jupyter-repl-sync-execution-state: Remove stale code
The `execution-state` slot is now a `jupyter-kernel-client` slot and is updated
by that class.
2018-12-10 21:36:35 -06:00
Nathaniel Nicandro
e25cec237f
Remove unneeded function declaration
jupyter-base.el already requires subr-x
2018-12-10 18:31:39 -06:00
Nathaniel Nicandro
c5a03da4e0 jupyter-repl-finalize-cell: Fix setting of buffer-undo-list
Don't set `buffer-undo-list` to a boundary entry, set it to an entry which
indicates on undo information.
2018-11-26 12:37:37 -06:00
Nathaniel Nicandro
a7148927fe Add jupyter-repl-propertize-regex
Previously, when propertizing the output of the REPL, a regular expression was
generated every time to take into account the comment characters of the kernel
language. Adding this variable ensure that we only create the expression once.
2018-11-26 12:37:37 -06:00
Nathaniel Nicandro
4ad72e4781 Rename jupyter-output-buffer-* to jupyter-display-buffer-*
An output buffer implies output from the kernel, but they are used for more
general purposes other than displaying output form the kernel.
2018-11-26 12:37:37 -06:00
Nathaniel Nicandro
99c0bf0f55 Remove unused code 2018-11-21 12:35:34 -06:00
Nathaniel Nicandro
fca89359fd Rename jupyter-repl-display-traceback to jupyter-display-traceback
Also move the function to jupyter-client.el from jupyter-repl.el

* jupyter-repl.el (jupyter-repl-display-traceback): Do it.

* jupyter-client.el (jupyter-display-traceback): Do it.
2018-11-21 12:35:34 -06:00
Nathaniel Nicandro
6a1da44904 Move evaluation functions from jupyter-repl.el to jupyter-client.el
These functions are general and not only useful for REPLs.
2018-11-19 08:50:32 -06:00
Nathaniel Nicandro
c859d34faf Add jupyter-repl-cell-output
* jupyter-repl.el (jupyter-repl-cell-output): Do it.
2018-11-17 15:24:11 -06:00
Nathaniel Nicandro
6aed12011a jupyter-repl-append-output: Mark output as read only
This used to be done by `jupyter-repl-insert`, but this is no longer the case
as all insertion of results is handled by the functions in jupyter-mime.el
while `jupyter-repl-insert` is more specific to insertion in the REPL buffer.
2018-11-17 11:47:55 -06:00
Nathaniel Nicandro
78a0747ddb Call after change function only when change is due to cell code
* jupyter-repl.el (jupyter-repl-do-after-change): Do it.
(jupyter-repl-after-change): Remove check that is now done at a higher level.
2018-11-16 17:22:10 +00:00
Nathaniel Nicandro
081f329da1 v0.6.0 2018-11-16 00:27:47 -06:00
Nathaniel Nicandro
a9add47b6f jupyter-repl-kill-buffer-query-function: Stop the client's channels
Although the client's channels are cleaned up when it goes out of scope, there
may be some stray messages that come through before that occurs. If they
do, they will attempt to access a killed buffer. Prevent that.
2018-11-15 23:04:27 -06:00
Nathaniel Nicandro
823ea8adde Fix checkdoc warnings 2018-11-15 23:04:27 -06:00
Nathaniel Nicandro
134f84a59c Add object finalizer class
* jupyter-base.el (jupyter-finalized-object): New class.
(initialize-instance): New method addition.
(jupyter-add-finalizer): New method.

* jupyter-client.el (jupyter-kernel-client):
Inherit from jupyter-finalize-object.
(initialize-instance): Cleanup private buffer when client loses scope.
(jupyter-finalize): Remove.

* jupyter-kernel-manager.el (jupyter-kernel-manager):
Inherit from jupyter-finalized-instance.
(jupyter-kernl-manager--cleanup): New function.
(jupyter-finalize, jupyter-kill-kernel-managers): Remove. Update all callers.
(jupyter--kernel-sentinel): Remove MANAGER argument. Update all callers.
(jupyter--start-kernel): Remove MANAGER argument. Update all callers.
(jupyter-start-kernel): Add finalizer to kernel process to cleanup conn-file.

* jupyter-repl.el (jupyter-repl-kill-buffer-query-function):
Remove calls to jupyter-finalize.
2018-11-15 23:02:41 -06:00
Nathaniel Nicandro
8f0acca6df Move output buffer related functions to jupyter-base.el
* jupyter-repl.el (jupyter-output-buffer-marker, jupyter-output-buffer-request-id):
(jupyter--reset-output-buffer-p, jupyter-with-output-buffer): Do it.
(jupyter-repl-get-special-buffer): Do it and rename to jupyter-get-buffer-create.

* jupyter-client.el: See above.
2018-11-13 18:17:44 -06:00
Nathaniel Nicandro
ba13ef2419 Move inspection related functions to jupyter-client.el
* jupyter-repl.el (jupyter-inspect, jupyter-inspect-at-point): Do it.

* jupyter-client.el: See above.
2018-11-13 18:17:44 -06:00
Nathaniel Nicandro
af32a3352f Promote the execution-state to be a slot of jupyter-kernel-client
* jupyter-client.el (jupyter-kernel-client): Do it.
(jupyter-run-hook-with-args-until-success): Pass client as first argument to
hooks.
(jupyter-execution-state): New convenience function.
(jupyter--set-execution-state): New helper function. Add as global IOPUB
message hook to set the execution-state slot.

* jupyter-repl.el (jupyter-repl-client): Remove execution-state slot.
(jupyter-handle-status): Don't set the execution-state slot.
(jupyter-repl-ret, jupyter-repl-interaction-mode-line): Use
jupyter-execution-state.
(jupyter-repl-initialize-hooks): Take into account changes to message hooks.

* jupyter-kernel-manager (jupyter-start-new-kernel): Update callback.
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
bd5d4d3eea jupyter-repl-append-output: Revert usage of with-silent-modifications
Font locking is actually still needed when appending output. It's not enough to
temporarily disable it and insert since the text we inserted doesn't get font
locked properly. This is most notable when inserting markdown text.
2018-11-13 17:46:07 -06:00