Commit graph

111 commits

Author SHA1 Message Date
Nathaniel Nicandro
52e663b550 jupyter-inspect: Use the help buffer when called without a buffer
This allows us to use `help-setup-xref` so that we can
navigate backward and forward through help. This is
especially useful in the Julia kernel.
2018-10-25 23:17:26 -05:00
Nathaniel Nicandro
01c58f05eb jupyter-completion--company-doc-buffer: Fix call to jupyter-inspect 2018-10-25 23:17:26 -05:00
Nathaniel Nicandro
3763764394 Abstract out company idle completion timer from jupyter-completion-at-point 2018-10-25 23:17:26 -05:00
Nathaniel Nicandro
54810022a9 Consider operators during completion 2018-10-25 23:17:26 -05:00
Nathaniel Nicandro
1f812ddf7c Limit overlay calls to jupyter-repl--make-prompt 2018-10-25 23:17:26 -05:00
Nathaniel Nicandro
f8768b7f87 jupyter-markdown-follow-link: Call jupyter-inspect when not in the REPL buffer 2018-10-25 23:17:26 -05:00
Nathaniel Nicandro
768d640beb Use with-silent-modification in jupyter-repl-append-output 2018-10-25 23:17:26 -05:00
Nathaniel Nicandro
4abf2daafa Update completion prefetching
* Add `jupyter-completion-prefetch-p` which determines if a
  prefetch should be performed.

* Remove `jupyter-completion-last-prefix`. Store all of the
  necessary information in `jupyter-completion-cache`.
2018-10-25 23:17:26 -05:00
Nathaniel Nicandro
a4a4bfb4c8 Ask to start a new REPL if one isn't available in jupyter-repl-associate-buffer 2018-10-25 23:17:26 -05:00
Nathaniel Nicandro
4f73d1397e Ensure the buffer local value of syntax-propertize-function is set
This caused much headache. This variable really should be
automatically buffer local.
2018-10-25 23:17:26 -05:00
Nathaniel Nicandro
5caf82cf81 Fix continuation prompt insertion
* Remove the invisible character inserted along with the
  continuation prompt as it is really unneeded.

* Make the inserted space two characters wide. For some
  reason this is needed, otherwise the continuation prompt
  will be one character short when starting up a REPL from
  the byte compiled functions. Curiously when I evaluate
  `jupyter-repl-insert-prompt` in the current Emacs
  session, the prompt looks fine afterwards.
2018-10-25 23:17:26 -05:00
Nathaniel Nicandro
c651f16ae2 Check for both end of word and symbol in jupyter-completion-grab-symbol-cons 2018-10-25 23:17:26 -05:00
Nathaniel Nicandro
abdf63a517 Only fontify syntactically when the text is not considered fontified
Text may not have a `font-lock-face` property, but may be
marked fontified if it has a non-nil `font-lock-fontified` property.
2018-10-25 23:17:26 -05:00
Nathaniel Nicandro
52a44b7e30 Take into account syntax-propertize-function in jupyter-repl-initialize-fontification 2018-10-25 23:17:26 -05:00
Nathaniel Nicandro
33495f0281 Don't try to insert continuation prompts on self-insert-command 2018-10-25 23:17:26 -05:00
Nathaniel Nicandro
4c95c8c6d2 Add note about possibly using indirect buffers 2018-10-25 23:17:25 -05:00
Nathaniel Nicandro
ed094f93ea Use buffer ticks in jupyter-repl-indent-line
Previously a string comparison was done to check if the
cell code was indented, this is faster.
2018-10-25 23:17:25 -05:00
Nathaniel Nicandro
6671904cee Fix edge case in jupyter-repl-history--previous
If there is no history at all to go back to, return nil.
2018-10-25 23:17:25 -05:00
Nathaniel Nicandro
59eba9d3c4 Check for widget dependencies in jupyter-repl-insert-data 2018-10-25 23:17:25 -05:00
Nathaniel Nicandro
cadc26f32b Prioritize mimetypes that have dependencies in jupyter-repl-insert-data 2018-10-25 23:17:25 -05:00
Nathaniel Nicandro
3d6d90d6da Simplify jupyter-repl-insert-html
Insert the HTML directly into the REPL buffer and use
`shr-render-region`. This avoids copying the HTML to a
temporary buffer first and extracting the rendered HTML to
place in the REPL buffer.
2018-10-25 23:17:25 -05:00
Nathaniel Nicandro
f4d375a380 Add whitespace after inserting images 2018-10-25 23:17:25 -05:00
Nathaniel Nicandro
3145453d93 Fix svg image display 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
31d7cfe34f Do not supply new arguments for obtaining the completion prefix 2018-10-25 23:17:25 -05:00
Nathaniel Nicandro
a26655c66f Handle python kernels specially when constructing completion candidates
The python kernel includes every attribute up to the parent
object, we need to split on the dots to only have the last
attribute or method since that is what the bounds are in
the completion mechanism.
2018-10-25 23:17:25 -05:00
Nathaniel Nicandro
c9e8b952eb Consider packages like smartparens when expanding argument snippets 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
be06102c99 Explicitly make REPL variables buffer local 2018-10-25 23:17:25 -05:00
Nathaniel Nicandro
c48d5ca814 Fix jupyter-repl-fixup-font-lock-properties 2018-10-25 23:17:25 -05:00
Nathaniel Nicandro
21ca6ead04 Use filter-buffer-substring-function to extract cell code 2018-10-25 23:17:25 -05:00
Nathaniel Nicandro
b00b28490f Handle terminal control codes in REPL output 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
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
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
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