Commit graph

239 commits

Author SHA1 Message Date
Nathaniel Nicandro
288fb17ece Update comments 2018-10-25 23:17:27 -05:00
Nathaniel Nicandro
673747dc03 Add kill-emacs-hook functions for cleaning up clients and managers
If `kill-emacs` is called while the kernel process or client channel processes
are still alive, the process sentinels do not run and thus the cleanup of the
clients and managers does not happen. Thus we need to explicitly do this
cleanup when `kill-emacs` is called.
2018-10-25 23:17:27 -05:00
Nathaniel Nicandro
c3690eb2ea Use accept-process-output 2018-10-25 23:17:27 -05:00
Nathaniel Nicandro
a7023078cc jupyter-code-context: Update documentation 2018-10-25 23:17:27 -05:00
Nathaniel Nicandro
7d824f4915 Add new :input-request message type
This replaces the behavior of the `:input-reply` message
type. A kernel sends an `:input-request` to the frontend
and the client sends an `:input-reply`.
2018-10-25 23:17:26 -05:00
Nathaniel Nicandro
84fce2cd08 Silence byte compiler about undefined variables 2018-10-25 23:17:26 -05:00
Nathaniel Nicandro
2841753bad Consider the active region when obtaining the jupyter-code-context 2018-10-25 23:17:26 -05:00
Nathaniel Nicandro
6ab44867d1 Fix code position in jupyter-line-context
The cursor position is 1 relative, I think. At least this
gives the right results using the Julia kernel.
2018-10-25 23:17:26 -05:00
Nathaniel Nicandro
5f091d972a Remove unused dependency 2018-10-25 23:17:26 -05:00
Nathaniel Nicandro
39382227e7 Take into account newer versions of zmq 2018-10-25 23:17:25 -05:00
Nathaniel Nicandro
a9246fcecb Rename with-jupyter-* to jupyter-with
Ensure that all functions and macros have the same
pseudo-namespace
2018-10-25 23:17:25 -05:00
Nathaniel Nicandro
34e52de1d4 Simplify inspect requests
* Rename `jupyter-repl-inspect-at-point` -> `jupyter-inspect-at-point`

* Refactor inspection
2018-10-25 23:17:25 -05:00
Nathaniel Nicandro
1198965d57 Documentation changes 2018-10-25 23:17:25 -05:00
Nathaniel Nicandro
ac812a8599 Add a custom method generalizer for a kernel language 2018-10-25 23:17:25 -05:00
Nathaniel Nicandro
14ef40acd4 Reduce priority of jupyter-land method context 2018-10-25 23:17:25 -05:00
Nathaniel Nicandro
19abd9a5c6 Define and use the jupyter-lang method context specializer
* Define the `jupyter-lang` method context specializer that
  specializes against the kernel language of
  `jupyter-current-client`

* Remove the kernel support API

* Replace the kernel support API with methods that can be
  specialized using the `jupyter-lang` context specializer.
2018-10-25 23:17:09 -05:00
Nathaniel Nicandro
2492ce3143 Use buffer-substring-no-properties to avoid copying properties 2018-10-25 23:07:46 -05:00
Nathaniel Nicandro
a8231db79b Rename jupyter-repl-current-client to jupyter-current-client
Also move `jupyter-current-client` to `jupyter-client.el`
2018-10-25 23:07:46 -05:00
Nathaniel Nicandro
8bb43e6c68 Rename jupyter-repl-language to jupyter-kernel-language
Also move `jupyter-kernel-language` to `jupyter-client.el`
2018-10-25 23:07:46 -05:00
Nathaniel Nicandro
34aaaf2a66 Update documentation of jupyter-start-channels 2018-10-25 22:57:33 -05:00
Nathaniel Nicandro
44d1af31bb Generalize retrieving the code context
* Rename `jupyter-code-context-at-point` to `jupyter-code-context`

* Use `cl-defmethod` and specializers to handle the
  different kinds of contexts

* Move the newly defined code context methods to their
  appropriate locations
2018-10-25 22:57:33 -05:00
Nathaniel Nicandro
883197074e Move the kernel-info slot of jupyter-repl-client' to jupyter-kernel-client'
* Define new method `jupyter-kernel-info` which takes care
  of caching the result of a kernel info request. All
  access of the kernel info plist should happen through
  this method.

* Do not return the kernel info plist in
  `jupyter-start-new-kernel`, callers should access the
  kernel info through `jupyter-kernel-info`
2018-10-25 22:57:33 -05:00
Nathaniel Nicandro
c070f2d04d Update documentation and comments 2018-10-25 22:57:23 -05:00
Nathaniel Nicandro
b706e63d97 Minimize use of cl functions 2018-10-25 22:57:23 -05:00
Nathaniel Nicandro
6a60250940 Add lock file mechanism to cleanup channel subprocess on Emacs crash
If Emacs crashes while a channel subprocess is still alive, the subprocess is
not cleaned up properly. Fix this by creating a file lock in the parent Emacs
process, then ensure that the file lock exists in the channel subprocess. If it
doesn't exist anymore, the channel subprocess will exit.
2018-10-25 22:57:23 -05:00
Nathaniel Nicandro
9c664b4c36 Abstract out the operations in jupyter--ioloop 2018-10-25 22:57:23 -05:00
Nathaniel Nicandro
250af96ea2 Remove jupyter-request--id, replace with jupyter-request-id
Since IDs of requests are generated in the parent Emacs process, there is no
need to pass back the ID of a request from the child process that send
messages.
2018-10-25 22:57:23 -05:00
Nathaniel Nicandro
a0a9ac2910 Update documentation, purge stale comments 2018-10-16 13:55:50 -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
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
aab35e6eed Include missing status field in execute-reply handler 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
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
e654487b2a Allow the possibility of preempting the handler methods using message hooks 2018-05-28 01:25:33 -05:00
Nathaniel Nicandro
436089d08b Prefer defun over defsubst and other miscellaneous changes
- Add missing namespace to sha256 function

  - Any function defined should have a `jupyter-` prefix

- Remove `cl-lib` dependency in `jupyter-messages.el`

- Include `subr-x` in `jupyter-base.el`

- Use `tramp-file-name-user` instead of `tramp-file-name-real-user` since the
  latter is missing in Emacs 26
2018-05-28 01:25:33 -05:00
Nathaniel Nicandro
f315a4bab0 Store open comm state in a jupyter-kernel-client 2018-05-28 01:25:33 -05:00
Nathaniel Nicandro
554e519bf0 Avoid delays during message processing
- Allow specifying a msg-id before a call to `jupyter-send`

  - This avoid sending a message to the browser displaying the widgets on every
    message send to the kernel. The previous implementation generated a new ID
    without allowing the caller to pass one in.

- Simplify message polling by sending received messages from the kernel to the
  parent Emacs process at the moment of arrival.
2018-05-28 01:25:09 -05:00
Nathaniel Nicandro
50088df2e0 Add widget support 2018-05-28 01:25:09 -05:00
Nathaniel Nicandro
704e6d53ce Update documentation 2018-05-20 10:58:13 -05:00
Nathaniel Nicandro
39c985d65d Validate jupyter-inhibit-handlers before sending a message 2018-05-16 21:54:30 -05:00
Nathaniel Nicandro
94171eba4a Update documentation 2018-05-16 21:54:29 -05:00
Nathaniel Nicandro
1841e49b5d Be consistent with message types
Only use the message symbol's as defined in `jupyter-message-types` and switch
to the string representation only when sending a message.
2018-05-16 20:46:10 -05:00
Nathaniel Nicandro
3b3fe9c43f jupyter-<type> -> jupyter-send-<type> where appropriate 2018-05-16 12:25:57 -05:00
Nathaniel Nicandro
07ee759f90 Introduce jupyter-tunnel-connection 2018-05-15 23:43:33 -05:00
Nathaniel Nicandro
d93b7d7099 Add jupyter-read-plist 2018-05-15 23:43:32 -05:00
Nathaniel Nicandro
62e63412de Tiny changes 2018-05-15 16:45:26 -05:00
Nathaniel Nicandro
c0e4383c49 Add more debug statements 2018-05-15 16:45:25 -05:00
Nathaniel Nicandro
b49d138fdb Check that the process is live in jupyter-stop-channels 2018-05-15 16:45:25 -05:00
Nathaniel Nicandro
29ccac12d0 Add hearbeat channel convenience methods 2018-05-15 16:45:25 -05:00