Commit graph

270 commits

Author SHA1 Message Date
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
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
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
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
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
44731bbf9f Mention why jupyter-include-other-output is needed in jupyter-restart-kernel 2018-10-16 13:55:57 -05:00
Nathaniel Nicandro
be7e2b62ee Ensure the correct line is moved to when handling edit payload 2018-10-16 13:55:57 -05:00
Nathaniel Nicandro
e1d73b77e1 Handle edge case in jupyter-repl-cell-code
If we are getting the code of the last cell in the buffer, `forward-line` will
return 0 when attempting to move past the last line of the buffer and `point`
will be at `point-max`.
2018-10-16 13:55:57 -05:00
Nathaniel Nicandro
2b8be0c2cf Fix REPL history navigation
* Set the lazy highlight limit to only look at the current cell

* Simplify `jupyter-repl-history-next` and `jupyter-repl-history-previous`

* Properly restore isearch state when searching through history

* Add tests for REPL history navigation
2018-10-16 13:55:57 -05:00
Nathaniel Nicandro
a0a9ac2910 Update documentation, purge stale comments 2018-10-16 13:55:50 -05:00
Nathaniel Nicandro
ea0d186007 Silence byte compiler 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
d49256d708 Handle edge case in jupyter-repl-previous-cell
When `point` is already at the beginning of the first cell in a REPL buffer,
`jupyter-repl-previous-cell` would say that a motion was performed when in
reality it hadn't.
2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
355e0763c0 Always consider point-max as the end of a cell 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
0248c81f27 Refactor jupyter-repl-initialize-fontification for readability 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
e94db94851 Refactor jupyter-repl-eval-file for readability 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
83fb582270 Remove duplicated code in jupyter-repl-eval-string
* Remove duplicated `string-trim` calls

* Allow the silently argument to be any non-nil value
2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
2945660017 Fix use of other-window-scroll-buffer 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
e54ec95317 Refactor prompt insertion
* Replace `jupyter-repl--insert-prompt` with `jupyter-repl--make-prompt` which
  only makes the prompt overlay and adds text properties to the overlayed
  character. `jupyter-repl--insert-prompt` would also insert the newline
  character for the overlay as well as recenter the overlays. These tasks are
  now handled by `jupyter-repl-insert-prompt`.

* Add notes on why an invisible character is inserted along with the prompts.

* `jupyter-repl-cell-code` properly handles invisible characters introduced by
  line continuation prompts.

* Don't make the invisible character inserted by continuation prompts
  read-only.

* Use a marker to keep track of the end position of the cell when inserting
  continuation prompts.

* Guard against searching past boundary when inserting continuation prompts
2018-10-16 13:55:30 -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
417162c439 Only switch to the REPL buffer when necessary 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
26c39c3d55 jupyter-repl--inspect accepts the detail argument for inspect messages 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
7bd130e059 Always return the client in run-jupyter-repl 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
ba17924b5d Take into account the initial value of the buffer slot for a jupyter-repl-client 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
4566fce2e3 Allow supplying a client class in run-jupyter-repl and connect-jupyter-repl 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
ed793fc183 Use string-match-p instead of string-match 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
bbb677c573 Pop up traceback buffer on errors when executing code blocks 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
892ab84148 Silence byte compiler warnings 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
81e3ebb44c Use jupyter-repl-language 2018-05-30 12:54:55 -05:00
Nathaniel Nicandro
8976a1d59e Remove special behavior of jupyter-repl-cell-count 2018-05-30 12:54:37 -05:00
Nathaniel Nicandro
04ecedd320 Only inhibit handlers when necessary
This ensures that any bookkeeping done in the handlers is actually performed.
2018-05-30 12:50:59 -05:00
Nathaniel Nicandro
d875ce7116 Do not display colon in prompts 2018-05-30 12:50:59 -05:00