Commit graph

1895 commits

Author SHA1 Message Date
Nathaniel Nicandro
0735198579 Update channel tests 2018-10-25 23:17:25 -05:00
Nathaniel Nicandro
35433ea68d Update jupyter-hb-channel test 2018-10-25 23:17:25 -05:00
Nathaniel Nicandro
58078c4e69 Document behavior of jupyter-repl-associate-buffer 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
6ca612168a Handle edge case when obtaining completion prefix 2018-10-25 23:17:25 -05:00
Nathaniel Nicandro
9cd52d25c3 Cleanup CAPF when jupyter-repl-interaction-mode is disabled 2018-10-25 23:17:25 -05:00
Nathaniel Nicandro
cccc680a6c Always finalize the previous cell on kernel restart 2018-10-25 23:17:25 -05:00
Nathaniel Nicandro
327bbede75 Only attempt to complete at point if jupyter-current-client is non-nil 2018-10-25 23:17:25 -05:00
Nathaniel Nicandro
3cd573f5c3 Fix jupyter-repl-fixup-font-lock-properties
This function is only used to update the face property,
have it reflect this.
2018-10-25 23:17:25 -05:00
Nathaniel Nicandro
90f2878617 Fix code beginning position of completion context for org-mode source blocks 2018-10-25 23:17:24 -05:00
Nathaniel Nicandro
e7719163e4 Fix jupyter-repl-after-init
* Add a context rewriter `jupyter-repl-mode` which checks
  that the variable `jupyter-repl-lang-mode` is of the
  right mode.

* Remove the check for `jupyter-repl-mode` since major
  modes do not have a mode variable.

* Add `jupyter-repl-after-init` to `jupyter-repl-mode-hook`

* Move the special case of syntax highlighting for javascript kernels that
  use `js2-mode` to its own `jupyter-repl-after-init`
  specialized method.
2018-10-25 23:17:24 -05:00
Nathaniel Nicandro
3c6b45e53f Fix jupyter-repl-cell-finalized-p
`point-max` is now considered the end of a cell but if the
end of a cell is `point-max`, then it is by definition
un-finalized. Also return t if the current line is not a
cell line since those parts of the buffer that are not
cells are finalized.
2018-10-25 23:17:24 -05:00
Nathaniel Nicandro
bc6d067d26 Use org-preview-latex-image-directory when inserting LaTeX fragments 2018-10-25 23:17:24 -05:00
Nathaniel Nicandro
0c4dc0fa42 Don't scan for font lock properties twice 2018-10-25 23:17:24 -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
c0c9d8dd70 Ensure the return value of jupyter-org-prepare-result has a non-nil car and cdr 2018-10-25 23:07:46 -05:00
Nathaniel Nicandro
276c02cfce Add more documentation 2018-10-25 23:07:46 -05:00
Nathaniel Nicandro
f13f18b12b Rename jupyter-completion-floating-point-p to jupyter-completion-number-p
* Add tests for `jupyter-completion-number-p`

* Simplify functions that use `jupyter-completion-number-p`
2018-10-25 23:07:46 -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
d1588b2fd9 Define jupyter-completion-prefix as a method to use it in different contexts 2018-10-25 23:07:04 -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
d03270c7ed Update commentary 2018-10-25 22:57:33 -05:00
Nathaniel Nicandro
2d5a854e2f Fix typo 2018-10-25 22:57:33 -05:00
Nathaniel Nicandro
beef9471f0 Use with-jupyter-repl-doc-buffer where appropriate 2018-10-25 22:57:31 -05:00
Nathaniel Nicandro
94358e9ef2 Rename jupyter-repl-do-at-request to jupyter-repl-append-output 2018-10-25 22:57:23 -05:00
Nathaniel Nicandro
b06a586831 Handle the invisible characters in the REPL buffer when extracting code context 2018-10-25 22:57:23 -05:00
Nathaniel Nicandro
65dc7796ed Require yasnippet automatically when a snippet can be expanded 2018-10-25 22:57:23 -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
26b9f90feb Simplify heartbeat channel logic 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
3195813a74 Use the field property for cell code to inhibit motions past cell bounds
* Remove field properties when inserting prompts and all other read only
  inserts.

* Abstract out the bulk of `jupyter-repl-after-buffer-change` into the new
  function `jupyter-repl-insert-continuation-prompts`.

* Add `jupyter-repl-mark-as-cell-code` which sets the `field` property of text
  to `cell-code` only if inserted text is part of a code cell. Do this in
  `jupyter-repl-after-buffer-change` after inserting continuation prompts.
2018-10-25 22:57:23 -05:00
Nathaniel Nicandro
ed6ac50e50 Remove code duplication 2018-10-25 22:57:23 -05:00
Nathaniel Nicandro
ac91a88895 Make jupyter-repl-use-builtin-is-complete automatically buffer local 2018-10-25 22:57:23 -05:00
Nathaniel Nicandro
543269d081 Transition from company completion to completion-at-point 2018-10-25 22:57:17 -05:00
Nathaniel Nicandro
a8cd41aa9d Use the right marker insertion type in jupyter-repl-after-bufer-change 2018-10-25 22:10:16 -05:00
Nathaniel Nicandro
deda7edea1 Silence byte compiler 2018-10-25 22:10:16 -05:00
Nathaniel Nicandro
414d124886 Rename jupyter-org--handle-data to jupyter-org-prepare-and-add-result 2018-10-25 22:10:16 -05:00
Nathaniel Nicandro
9fcfcdd32c Rename no-execute to delay-eval in org-babel-prep-session:jupyter 2018-10-25 22:10:16 -05:00
Nathaniel Nicandro
51131cde63 Pass the request object to org-babel-jupyter-clear-file-param 2018-10-25 22:10:16 -05:00
Nathaniel Nicandro
7d30fe0615 Pass the right arguments to jupyter-send-execute-request 2018-10-25 22:10:16 -05:00
Nathaniel Nicandro
9c99e5f2f9 Add jupyter-org-file-header-arg-p 2018-10-25 22:10:16 -05:00
Nathaniel Nicandro
23acb30759 Refactor jupyter-org-clear-request-id to use the jupyter-org-request fields 2018-10-25 22:10:16 -05:00
Nathaniel Nicandro
30db9a8b2b Handle kernel differences in message sequence during execution 2018-10-16 13:55:57 -05:00