Commit graph

49 commits

Author SHA1 Message Date
Nathaniel Nicandro
24a79e29f2
Fix checkdoc error 2019-02-07 13:44:14 -06:00
Nathaniel Nicandro
c138d35b83
Remove stale comments 2019-01-17 20:45:45 -06:00
Nathaniel Nicandro
5c004a43a5
Remove stale comments; fix documentation 2019-01-13 22:05:35 -06:00
Nathaniel Nicandro
f5fe8df750
Cleanup of function documentation 2018-12-28 12:59:03 -06:00
Nathaniel Nicandro
8fdde6c756
Update some documentation 2018-12-10 21:36:35 -06:00
Nathaniel Nicandro
3d3dc6420d
jupyter-with-timeout: Update documentation 2018-12-10 18:31:39 -06:00
Nathaniel Nicandro
0c0547dd95
Add jupyter-normalize-data 2018-12-01 15:06:07 -06:00
Nathaniel Nicandro
32ce9d33bc Fix jupyter-instance-tracker initialization
A property of the tracking symbol was being checked instead of the symbol's
value.
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
1b8032f5ef jupyter-get-buffer-create: Remove unnecessary keybindings
`special-mode' already provides they keybindings.
2018-11-17 11:53:05 -06:00
Nathaniel Nicandro
081f329da1 v0.6.0 2018-11-16 00:27:47 -06:00
Nathaniel Nicandro
42cc3d3853 Do not use the make- prefix for struct constructors 2018-11-16 00:27:47 -06:00
Nathaniel Nicandro
823ea8adde Fix checkdoc warnings 2018-11-15 23:04:27 -06:00
Nathaniel Nicandro
c0e47165a9 Add instance tracker class
This is needed as opposed to eieio-instance-tracker so that we can create weak
references to objects. We don't want to have to manually delete an instance.

* jupyter-base.el (jupyter-instance-tracker): Do it.
(jupyter-all-objects): New function.

* jupyter-client.el (jupyter--clients): New variable.
(jupyter-kernel-client): Inherit from new class.
(jupyter-clients): Use jupyter-all-objects.

* jupyter-kernel-manager.el (jupyter-kernel-managers): New function.
2018-11-15 23:04:25 -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
a82ae13438 Add jupyter-with-timeout macro
* jupyter-base.el (jupyter-default-timeout)
(jupyter-long-timeout): Moved from jupyter-client.el
(jupyter-with-timeout): Do it.

* jupyter-client.el (jupyter-wait-until): Use it.

* jupyter-kernel-manager.el (jupyter-shutdown-kernel)
(jupyter-interrupt-kernel, jupyter-start-new-kernel):
(jupyter-start-kernel): Use it.

use timeout
2018-11-13 17:46:19 -06:00
Nathaniel Nicandro
0c504856d0 Add jupyter-loop-over-mime
* jupyter-base.el (jupyter-loop-over-mime): Do it.
(jupyter-insert): (PLIST ...) Use it.

* jupyter-tests.el (jupyter-loop-over-mime): Add test.
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
75a08c26d0 Implement jupyter-insert method
The goal of this method is to act as a single entry point for insertion of
kernel results in any context. One would simply add another method to handle a
specific context.

* jupyter-base.el (jupyter-mime-types):
(jupyter-nongraphic-mime-types): New variables that give mime-types that can be
handled.
(jupyter-insert): New method for dispatching to code that inserts mimetype
representations in the current buffer.

* jupyter-mime.el: New file.
(jupyter-display-ids):
(jupyter-handle-control-codes):
(jupyter-fontify-buffers):
(jupyter-get-fontify-buffer):
(jupyter-fixup-font-lock-properties):
(jupyter-add-font-lock-properties):
(jupyter-fontify-according-to-mode):
(jupyter-insert-html):
(jupyter-markdown-mouse-map):
(juputer-markdown-follow-link-at-point):
(jupyter-insert-markdown):
(jupyter-insert-latex):
(jupyter-insert-ansi-coded-text): Moved from jupyter-repl.el, replaced
`jupyter-repl-` prefix with `jupyter-`.
(jupyter--shr-put-image): Ditto. Also add `shr-` prefix.
(jupyter--delete-javascript-tags): Ditto. Also mark as private functions.
(jupyter-insert-image): Ditto. Also mark as a public function.
(jupyter-insert): (DISPLAY-ID ...) Moved from jupyter-repl.el. Was
`jupyter-repl-insert-data-with-id`.
(jupyter-with-control-code-handling):
(jupyter-markdown-follow-link): Moved from jupyter-repl.el
(jupyter-insert): Implement methods to do the work previously done by
`jupyter-repl-insert-data`.

* jupyter-repl.el (jupyter-repl-graphic-mimetypes): Moved to jupyter-base.el,
 inverted and renamed to `jupyter-nongraphic-mime-types`.
(jupyter-repl-graphic-data-p): Remove unused function.
(jupyter-repl-insert-data): Remove, replace calls with `jupyter-insert`.
(jupyter-repl-add-font-lock-properties):
(jupyter-repl-fixup-font-lock-properties):
(jupyter-repl-get-fontify-buffer):
(jupyter-repl-fontify-according-to-mode):
(jupyter-repl-delete-javascript-tags):
(jupyter-repl-put-image):
(jupyter-repl-insert-html):
(jupyter-repl-markdown-mouse-map):
(jupyter-repl-markdown-follow-link-at-point):
(jupyter-repl-insert-markdown):
(jupyter-repl-insert-latex):
(jupyter-repl--insert-image): Moved to jupyter-mime.el, which see.
(jupyter-repl-insert-data-with-id): Ditto. Changed to a `jupyter-insert` method
dispatched on a string argument.
(jupyter-repl-insert-ansi-coded-text): Ditto. Replace calls with
`jupyter-insert-ansi-coded-text`.
(jupyter-with-control-code-handling):
(jupyter-markdown-follow-link): Moved to jupyter-mime.el.

* jupyter-org-client.el (jupyter-handle-error): Replace
  `jupyter-repl-insert-ansi-coded-text` with `jupyter-insert-ansi-coded-text`.

* jupyter-tests.el (jupyter-insert): Add tests for `jupyter-insert`
2018-11-13 17:46:07 -06:00
Nathaniel Nicandro
dcd6e0fd25 Add jupyter-with-insertion-bounds
This function will prove useful in the future for applying text properties to
inserted text once the new `jupyter-insert` method is introduced.

* jupyter-base.el (jupyter-with-insertion-bounds): Add the new macro.

* jupyter-repl.el (jupyter-with-control-code-handling): Use it.
2018-11-10 08:41:13 -06:00
Nathaniel Nicandro
5b65eb4f24 Move jupyter--debug to jupyter-base.el from jupyter-client.el
This is so that other parts of Jupyter can use it to emit debug statements.
2018-11-08 21:21:23 -06:00
Nathaniel Nicandro
890f5ab3cb Silence byte compiler
* Declare undeclared external functions

* Add ext: prefix to filename of external packages that may not be present on
  every system

* Remove `company-grab-symbol-cons` function declaration since this function is
  no longer used.
2018-10-27 22:16:54 -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
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
22b1e809a0 Update documentation, cleanup comments 2018-08-30 18:02:13 -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
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
50088df2e0 Add widget support 2018-05-28 01:25:09 -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
211a6a377b Do not unbind when collecting ports 2018-05-15 23:43:32 -05:00
Nathaniel Nicandro
fc665655f8 Remove jupyter-connection
To make up for this:
- Move the functions defined in `jupyter-connection.el` to `jupyter-base.el`
- Add a `session` field to the `jupyter-kernel-manager` and `jupyter-channel`
  classes
- Add a `kernel-info` field to the `jupyter-repl-client`
- Add a `conn-info` field to a `jupyter-session`
- Add a `session` field to `jupyter-kernel-client`
2018-05-15 16:45:24 -05:00
Nathaniel Nicandro
24eb475443 Cleanup comments 2018-02-12 10:25:13 -06:00
Nathaniel Nicandro
b5f958ac99 More granular way of inhibiting handlers
`jupyter-inhibit-handlers` can now be a list of message types. If a message is
received and has one of these message types, then the client handler
corresponding to that message type is prevented from running.
2018-02-08 13:39:55 -06:00
Nathaniel Nicandro
265b6b874b Document jupyter-session and jupyter-request 2018-02-03 19:25:50 -06:00
Nathaniel Nicandro
0504bf36e0 Update documentation and comments 2018-02-03 19:06:10 -06:00
Nathaniel Nicandro
fa2658f168 Move custom variables to jupyter-base from jupyter-client 2018-01-22 18:49:19 -06:00
Nathaniel Nicandro
de635fdc3a Add customizable jupyter-runtime-directory variable
- Also fix the handling of `resource_dir` in a kernelspec argument vector
2018-01-18 22:45:17 -06:00
Nathaniel Nicandro
f445e6d951 Optimize jupyter-request-id 2018-01-18 16:33:54 -06:00
Nathaniel Nicandro
e4c3088749 Add jupyter-inhibit-handlers
This removes the need for `jupyter-request-inhibit-handlers`
2018-01-17 20:34:32 -06:00
Nathaniel Nicandro
8f774120c9 Better handling of when to remove requests from a client's request table
For each message received in response to a request, record the
`last-message-time` of any received messages for a request. When a request's
`idle-received-p` field is non-nil and the `last-message-time` is larger than
some number of seconds, remove the request from the request table.
2018-01-11 12:06:26 -06:00
Nathaniel Nicandro
b9f83a60d6 Allow passing an id to the jupyter-session constructor 2018-01-11 12:03:32 -06:00
Nathaniel Nicandro
326ff15d92 Add standard header comments 2018-01-09 00:44:33 -06:00
Nathaniel Nicandro
ebd616998e Add/update lots of documentation 2018-01-09 00:44:33 -06:00
Nathaniel Nicandro
ada66074f5 Fix some checkdoc warnings 2018-01-07 13:35:05 -06:00
Nathaniel Nicandro
4944a5d75a Update callback interface
- Rename `jupyter-received-message-types` to `jupyter-message-types` and add
  message types for requests as well. Also change the keys to keywords instead
  of symbols. Using plists with keywords is in line with `jupyter-messages` and
  the arguments of the jupyter request functions.

- Rename `jupyter-request-run-callbacks` to `jupyter--run-callbacks`. This is
  more of an internal function so mark it as such.

- Change the order of the first two arguments in `jupyter-add-callback` and
  `jupyter-wait-until`. In both cases you are adding a callback to a request or
  waiting for some condition to be satisfied on the request not on the message
  type. This is also the reason why `jupyter-wait-until-received` keeps the
  message type as the first argument. We are waiting until a message of a
  certain type is received for a request, but the more important object in this
  case is the message type.

- Update other files to take into account these changes.
2018-01-06 19:55:46 -06:00
Nathaniel Nicandro
b3b1066624 Re-organization of code base
- `jupyter-client.el` only contains client related code

- `jupyter-kernel-manager` related code is placed in `jupyter-kernel-manager.el`

- Socket creating functions and generating connection info plist function are
  placed in `jupyter-connection.el`. This also contains the
  `jupyter-connection` class.

- Kernelspec related functions are placed in `jupyter-kernelspec.el`

- Move general utility functions and variables requires necessary for `jupyter`
  into `jupyter-base.el`. This also contains the `jupyter-session` and
  `jupyter-request` struct definitions.
2018-01-06 19:55:45 -06:00