Commit graph

338 commits

Author SHA1 Message Date
Nathaniel Nicandro
40ee1ac8b9 Add new customizable variable jupyter-repl-echo-eval-p
Closes #71
2019-06-08 13:47:13 -05:00
Nathaniel Nicandro
6289e23c61 Turn jupyter-eval-string into a method
So that client subclasses can provide specialized behavior if needed.

Also adds the function `jupyter-eval-add-callbacks` so that client methods can
more easily obtain the default behavior of `jupyter-eval-string'.
2019-06-08 13:47:13 -05:00
Nathaniel Nicandro
4b04834712 Add jupyter-repl-clear-cells 2019-06-01 12:27:30 -05:00
Nathaniel Nicandro
5ea32a70f0 Change License to GPL3 2019-05-31 09:44:39 -05:00
Nathaniel Nicandro
49275c37b8 jupyter-repl-mode: Be more consistent when getting REPL history 2019-05-30 23:02:40 -05:00
Nathaniel Nicandro
7e64dd9f9c jupyter-error-if-not-client-class-p: Allow a class to check against 2019-05-23 08:49:41 -05:00
Nathaniel Nicandro
f161c7dfac Add new method jupyter-bootstrap-repl 2019-05-23 08:39:38 -05:00
Nathaniel Nicandro
7554293d18 Add bindings for jupyter-repl-history-(previous|next)-matching
These are the same bindings as found in `comint-mode`
2019-05-19 19:39:11 -05:00
Nathaniel Nicandro
d7757d6de4 jupyter-repl-history--rotate: Handle an empty history 2019-05-19 19:34:07 -05:00
poppyschmo
b7b0162572 Add prev/next-matching REPL-input-history commands (#108) 2019-05-19 19:13:14 -05:00
Nathaniel Nicandro
107fa8042d Generalize jupyter-repl-history navigation functions 2019-05-18 20:35:28 -05:00
Nathaniel Nicandro
d7ce2b0c38 jupyter-repl-preserve-window-margins: Remove superfluous doc 2019-05-09 20:10:49 -05:00
Nathaniel Nicandro
b715ada492 Always name method arguments
If method arguments are not named it gives rise to errors like

    `Args out of range: "", 0`

that originate in `help-function-arglist` when calling `describe-function` on
those methods.
2019-05-09 13:32:45 -05:00
Nathaniel Nicandro
3628cab446 Refactor of jupyter-kernel-manager.el
This refactor implements a new class hierarchy to manage the lifetime of a
Jupyter kernel. The first node in this hierarchy is the
`jupyter-kernel-lifetime` class which defines a set of methods to manage the
lifetime of a kernel. An object that inherits from `jupyter-kernel-lifetime` is
stating that it has an association with a kernel and can be used to manage the
lifetime of the associated kernel.

The `jupyter-meta-kernel` class inherits from `jupyter-kernel-lifetime` and
mainly defines a `spec` slot used to hold the `kernelspec` from which a command
can be constructed to start a kernel and a `session` slot used to hold the
`jupyter-session` object that clients can use to establish communication with a
kernel once its live. Concrete classes that actually launch kernels are
intended to inherit from this class and use its slots.

`jupyter-kernel-process` manages the lifetime of a kernel started as a process
using the function `start-file-process`, `jupyter-command-kernel` calls the
`jupyter kernel` shell command to start a kernel, finally `jupyter-spec-kernel`
uses the `spec` slot to construct a shell command to start a kernel.

A `jupyter-kernel-manager` now consists of a `kernel` slot that holds a
`jupyter-meta-kernel` and a `control-channel` slot and inherits from
`jupyter-kernel-lifetime`. The `jupyter-kernel-lifetime` methods of the manager
just defer to those of `kernel` while also taking into account the
`control-channel`.

* jupyter-base.el (jupyter-write-connection-file): New function.

* jupyter-channel-ioloop.el
(jupyter-channel-ioloop-add-start-channel-event): Remove `sleep-for` call.
The startup message is not so important anymore.

* jupyter-client.el (jupyter-wait-until-startup: New function.

* jupyter-kernel-manager.el (jupyter-kernel-lifetime)
(jupyter-kernel, jupyter-kernel-process, jupyter-command-kernel)
(jupyter-spec-kernel): New classes.
(jupyter-kernel-manager): Inherit from jupyter-kernel-lifetime only and
implement its methods.
(jupyter-kernel-manager--cleanup, jupyter-kernel-managers)
(jupyter-delete-all-kernels, jupyter--kernel-sentinel)
(jupyter--start-kernel): Remove and remove related, their functionality has
been generalized in the new classes.
(jupyter-interrupt-kernel, jupyter-shutdown-kernel)
(jupyter-start-channels, jupyter-start-kernel, jupyter-kernel-alive-p)
(jupyter-kill-kernel): Refactor and implement to use the new class hierarchy.

* test/jupyter-test.el: Refactor tests to account for changes.
(jupyter-write-connect-file, jupyter-command-kernel): New tests.

* jupyter-kernelspec.el (jupyter-guess-kernelspec): New function.
2019-05-09 12:20:27 -05:00
Nathaniel Nicandro
112769e0c6
Bump version 2019-05-04 03:31:50 -05:00
Nathaniel Nicandro
9d685b0be4
jupyter-repl-mode-map: Don't override default point motion keys
Closes #100
2019-04-25 12:04:41 -05:00
Nathaniel Nicandro
9d39fbeaff
jupyter-connect-repl: Set kcomm slot of client before initializing connection
Fixes #92
2019-04-15 21:39:55 -05:00
Nathaniel Nicandro
8926e90f37
jupyter-handle-is-complete-reply (jupyter-repl-client): Handle unknown status 2019-04-12 17:06:14 -05:00
Nathaniel Nicandro
34a4833fdd
Add jupyter-repl-allow-RET-when-busy
Closes #82
2019-04-12 11:09:29 -05:00
jackkamm
e7de8b31af Integration for R (#89) 2019-04-12 08:56:20 -05:00
Nathaniel Nicandro
49571ecd8d
jupyter-repl-display-kernel-buffer: Ensure that the manager has a kernel process 2019-04-08 12:44:49 -05:00
Daniel Gomez
96c872fb7c Set show-trailing-whitespace to nil for jupyter buffers. (#83) 2019-04-06 12:39:00 -05:00
Nathaniel Nicandro
82ec2fb786 Handle all valid arguments in client propagating advise
Fixes #76.
2019-04-01 21:45:00 -05:00
Nathaniel Nicandro
25975b9fae
Use the right type predicates 2019-03-25 13:19:02 -05:00
Nathaniel Nicandro
2f18192ae7
Remove redundant :execute-input handlers
The `execution-count` slot of a `jupyter-kernel-client` is now updated higher
up in the message handling process which makes these handlers unnecessary.
2019-03-25 13:19:02 -05:00
Nathaniel Nicandro
569ae50214
jupyter-repl-ret: Avoid syncing execution state
There is really no reason for this sync since it happens after checking if the
kernel is busy and the execution-count is now updated whenever an execute_input
message is received in the `jupyter-handle-message` of a
`jupyter-kernel-client`.
2019-03-24 00:11:22 -05:00
Nathaniel Nicandro
0e8e10babb
jupyter-repl-initialize-fontification: Protect against nil font-lock-defaults 2019-03-20 21:05:46 -05:00
Nathaniel Nicandro
c010d83696
jupyter-repl-initialize-fontification: Don't fail if functions aren't present 2019-03-17 20:31:25 -05:00
Nathaniel Nicandro
83af335166
Bump version 2019-03-14 09:29:11 -05:00
Nathaniel Nicandro
662e983612
Don't require subr-x at runtime 2019-03-14 09:16:44 -05:00
Nathaniel Nicandro
4f8e5da4ba
Ensure the REPL buffer is current when inserting banner 2019-03-10 04:39:43 -05:00
Nathaniel Nicandro
49d43b690e
jupyter-repl.el: Update commentary 2019-03-10 03:06:16 -05:00
Nathaniel Nicandro
6894a73d57
Cleanup stale comments 2019-03-07 22:51:25 -06:00
Nathaniel Nicandro
dd0feef022
jupyter-repl-mode: Prevent a major-mode change
Changing `major-mode`s would kill the local `jupyter-current-client` variable
which we don't want to happen. There is no reason (that I can think of) to
change the `major-mode' in a REPL buffer anyways.
2019-03-07 22:51:25 -06:00
Nathaniel Nicandro
581aab10b6
jupyter-kernel-language: Change return value to be a symbol
This avoids interning a string for every method dispatch using the
jupyter-lang method specializer.
2019-03-07 22:51:25 -06:00
Nathaniel Nicandro
764bf6f717
jupyter-repl-restart-kernel: Inhibit handlers except :shutdown-reply
See https://github.com/dzop/emacs-jupyter/pull/45#discussion_r262015539.
2019-03-04 17:47:02 -06:00
Nathaniel Nicandro
99f1099d68
jupyter-repl-available-repl-buffers: Use provided-mode-derived-p
So that a mode derived from `jupyter-repl-lang-mode` is still considered a
match.
2019-03-02 18:24:48 -06:00
Nathaniel Nicandro
9114397f2c
jupyter-repl-syntax-propertize-function: Move Julia specific setup to jupyter-julia.el 2019-03-02 18:14:49 -06:00
Nathaniel Nicandro
e127e1d45b
Add jupyter-repl-cell-cond 2019-03-02 18:14:49 -06:00
Nathaniel Nicandro
2c5cde166f
jupyter-repl-interaction-mode-line: Check heartbeat first 2019-03-02 18:14:49 -06:00
Nathaniel Nicandro
1f5c7743d5
Working towards a cleaner REPL restart
See #50.
2019-03-02 18:14:49 -06:00
Nathaniel Nicandro
2a3b175f26
jupyter-repl-after-change: Maintain field membership at cell beginning
This handles an edge case where `field-end` would return the position at the
beginning of a cell even though there was text that was part of the cell code
after that position. The issue had to do with the interaction between the
sticky text properties at field boundaries. See #38.
2019-02-27 14:44:23 -06:00
Nathaniel Nicandro
4e93839004
Narrow to REPL cell when calling language mode font-lock functions 2019-02-27 14:44:23 -06:00
Nathaniel Nicandro
a76e8d5151
jupyter-repl-do-after-change: Widen the buffer before doing any work
See #38.
2019-02-25 20:59:12 -06:00
Nathaniel Nicandro
75fa0eea29
Add REPL prompt string constants 2019-02-22 21:05:45 -06:00
Nathaniel Nicandro
ae5ed507fb
Handle prompt margin overflow in the REPL
Whenever a prompt string exceeds `jupyter-repl-prompt-margin-width`, increase
`jupyter-repl-prompt-margin-width` so that is can accommodate the string and
redisplay all prompts.
2019-02-22 20:57:42 -06:00
Nathaniel Nicandro
9484735c06
Fix undo in the REPL
When inserting continuation prompts, extra text deletion entries where being
added in `buffer-undo-list` which caused yanked text to not be undone fully
since it would add in those entries before undoing the yank.
2019-02-21 23:21:22 -06:00
Nathaniel Nicandro
19e18f36f8
jupyter-repl-syntax-propertize-function: Fix bounds used 2019-02-19 02:58:55 -06:00
Nathaniel Nicandro
6d59862b4d
Remove redundant with-syntax-table 2019-02-18 11:31:57 -06:00
Nathaniel Nicandro
183547403d
jupyter-repl-ret: Use cond 2019-02-18 11:31:57 -06:00