Commit graph

1719 commits

Author SHA1 Message Date
Nathaniel Nicandro
e7d80cf399 Add test for #126 2019-06-12 21:10:26 -05:00
Nathaniel Nicandro
99986e5978 jupyter-org-client.el: More robustly handle async insertion
Make less assumptions about where `point` is at when inserting results and
about the insertion context by relying only on
`org-babel-where-is-src-block-result` to move `point`. Centralize handling of
`point` to `jupyter-org--do-insert-result`.

* jupyter-org-client.el
(jupyter-org--first-result-context-p): Handle more cases.
(jupyter-org--append-stream-result-p): New function.
(jupyter-org--prepare-append-result): New function, abstracted from
`jupyter-org--insert-result`.
(jupyter-org--normalized-insertion-context): New function.
(jupyter-org--do-insert-result): New function.
(jupyter-org--insert-result): Move the bulk of the work to
`jupyter-org--do-insert-result`.
(jupyter-org--add-result): Use it.
2019-06-12 14:24:59 -05:00
Nathaniel Nicandro
fda5f0b414 jupyter-org-font-lock-ansi-escapes: Fix regexp for fixed-width blocks 2019-06-11 22:12:58 -05:00
Nathaniel Nicandro
9f15db7133 jupyter-org--append-to-example-block: Fix edge case
Fix the case when appending to a line without inserting a newline and adding
indentation.

Also add tests for `jupyter-org--append-to-example-block`
2019-06-11 22:12:58 -05:00
Nathaniel Nicandro
66f806f478 Add test for jupyter-org-indent-inserted-region 2019-06-11 22:12:58 -05:00
Nathaniel Nicandro
945c60b7cd Revert "jupyter-org--append-to-example-block: Remove indentation handling"
This reverts commit a24e984b68.
2019-06-11 22:12:58 -05:00
Nathaniel Nicandro
eda7e6dcc6 jupyter-org--insert-result: Fix indentation to that of the #+RESULTS line 2019-06-11 22:12:58 -05:00
Nathaniel Nicandro
878b323594 jupyter-org--append-to-fixed-width: Fix edge case 2019-06-11 20:17:06 -05:00
Nathaniel Nicandro
047746eeae Fix checkdoc warning 2019-06-11 17:54:36 -05:00
Nathaniel Nicandro
6005177537 Add jupyter-org--first-result-context-p
Makes the code read better.
2019-06-11 15:23:49 -05:00
Nathaniel Nicandro
44e3823a93 jupyter-org--wrap-result-maybe: Use cond 2019-06-11 15:22:27 -05:00
Nathaniel Nicandro
87bd83c99b jupyter-org--clear-request-id: Check if clearing should be done first 2019-06-11 15:21:08 -05:00
Nathaniel Nicandro
74f83393ff jupyter-org-font-lock-ansi-escapes: Consider indentation 2019-06-10 23:08:14 -05:00
Nathaniel Nicandro
782b4a8a52 Remove jupyter-org--delete-unwrapped-result
Move its functionality directly into `jupyter-org--insert-result`.
2019-06-10 22:52:41 -05:00
Nathaniel Nicandro
a3c5494926 jupyter-org-request-async -> jupyter-org-request-async-p 2019-06-10 19:32:30 -05:00
Nathaniel Nicandro
a24e984b68 jupyter-org--append-to-example-block: Remove indentation handling
This is now handled by `jupyter-org--insert-result`.
2019-06-10 19:32:30 -05:00
Nathaniel Nicandro
9839a29c7c jupyter-org-client.el: Refactor async insertion
Also consider indentation when inserting results. This was fairly easy to do
and didn't seem to warrant a separate commit.

* jupyter-org-client.el
(jupyter-org--insert-element): Remove. Update all callers.
(jupyter-org-delete-blank-line): New function.
(jupyter-org--delete-element): Use it.
(jupyter-org--stream-context-p): Consider indentation.
(jupyter-org--fixed-width-append): Remove. Update all callers.
(jupyter-org--append-to-fixed-width): Move example block promotion to
`jupyter-org--append-stream-result`.
(jupyter-org--append-to-example-block): New function.
(jupyter-org--append-stream-result): Use it.
(jupyter-org-indent-inserted-region): New macro.
(jupyter-org--insert-result): New method that splits the bulk of the old
function `jupyter-org--append-result` into a more manageable structure. Uses
new macro.
(jupyter-org--append-result): Remove it. Update all callers.
(jupyter-org--add-result): Refactor to consider above changes.
2019-06-10 19:32:30 -05:00
Nathaniel Nicandro
f5499c614a Silence checkdoc warning 2019-06-10 16:11:11 -05:00
Nathaniel Nicandro
195576bdbf jupyter-org--ansi-color-apply-on-region: Use cond 2019-06-10 16:11:11 -05:00
Nathaniel Nicandro
d6393d8e51 jupyter-org-define-key: Only bind KEY once in the top-level map 2019-06-09 15:49:50 -05:00
Nathaniel Nicandro
e370769636 jupyter-completion-at-point: Use sit-for
The completion at point functions are called several times in the course of a
single completion attempt so we get multiple chances to receive a completion
result. This means there is no need to wait for it to be received once and for
all on the first time completions are requested.
2019-06-09 15:13:07 -05:00
Nathaniel Nicandro
f491936928 jupyter-browse-url-in-temp-file: Prevent browsing file multiple times quickly
See https://github.com/dzop/emacs-jupyter/pull/121#issuecomment-495472406
2019-06-08 13:47:13 -05:00
Nathaniel Nicandro
40ee1ac8b9 Add new customizable variable jupyter-repl-echo-eval-p
Closes #71
2019-06-08 13:47:13 -05:00
Nathaniel Nicandro
6289e23c61 Turn jupyter-eval-string into a method
So that client subclasses can provide specialized behavior if needed.

Also adds the function `jupyter-eval-add-callbacks` so that client methods can
more easily obtain the default behavior of `jupyter-eval-string'.
2019-06-08 13:47:13 -05:00
Nathaniel Nicandro
32ed09617c appveyor.yml: Install libxml2 and libjpeg for tests 2019-06-04 19:16:25 -05:00
Nathaniel Nicandro
932baad379 jupyter-org--set-current-src-block: Use org-babel-jupyter-language-p
So that we account for overriding the source block language.
2019-06-02 01:19:15 -05:00
Nathaniel Nicandro
4b04834712 Add jupyter-repl-clear-cells 2019-06-01 12:27:30 -05:00
Nathaniel Nicandro
5ea32a70f0 Change License to GPL3 2019-05-31 09:44:39 -05:00
Nathaniel Nicandro
a5e584e498 jupyter-handle-input-request: Suspend timeouts
See #35.
2019-05-30 23:02:40 -05:00
Nathaniel Nicandro
49275c37b8 jupyter-repl-mode: Be more consistent when getting REPL history 2019-05-30 23:02:40 -05:00
Nathaniel Nicandro
361cee8f4a jupyter-ioloop--function: Avoid harmless message when debugging 2019-05-30 23:02:40 -05:00
Nathaniel Nicandro
15dc560b14 jupyter-kernel-client: Remove pending-requests slot
There is no need for this slot and is a remnant of an older implementation. A
request is pending if it isn't idle, that is all that we need to know.
2019-05-30 23:02:40 -05:00
Nathaniel Nicandro
0b49588096 jupyter-disconnect-client: Don't close comm by default
But do so for `jupyter-channel-ioloop-comm` as only a single client is meant to
be connected anyways.
2019-05-30 23:02:40 -05:00
Nathaniel Nicandro
46ec412bfc .travis.yml: Fix core file generation on error 2019-05-23 18:57:31 -05:00
Nathaniel Nicandro
fdaf7719d8 Fix README badges 2019-05-23 17:12:15 -05:00
Nathaniel Nicandro
4960b81196 Add Appveyor badge 2019-05-23 17:07:36 -05:00
Nathaniel Nicandro
7e64dd9f9c jupyter-error-if-not-client-class-p: Allow a class to check against 2019-05-23 08:49:41 -05:00
Nathaniel Nicandro
f161c7dfac Add new method jupyter-bootstrap-repl 2019-05-23 08:39:38 -05:00
Nathaniel Nicandro
0b970e857d Add jupyter-eval-short-result-max-lines to README 2019-05-21 18:43:45 -05:00
Nathaniel Nicandro
4aff8ae975 jupyter-eval-defun: Don't error if no function exists at point 2019-05-21 18:31:14 -05:00
Nathaniel Nicandro
3a6aa0f840 .travis.yml: Fix core dump command 2019-05-20 23:44:21 -05:00
Nathaniel Nicandro
7429755f39 Add jupyter-display-current-buffer-guess-where 2019-05-20 23:14:18 -05:00
Nathaniel Nicandro
b5ea944d05 Update README and CHANGELOG 2019-05-20 22:46:46 -05:00
Nathaniel Nicandro
e05ef4f8d5 org-babel-jupyter-initiate-session-by-key: Support remote kernel starts 2019-05-20 22:46:46 -05:00
Nathaniel Nicandro
e9f7683d68 .travis.yml: Show core dump when it happens
From http://jsteemann.github.io/blog/2014/10/30/getting-core-dumps-of-failed-travisci-builds/
2019-05-20 22:03:56 -05:00
Nathaniel Nicandro
24b6dbadac Add test for `jupyter-locate-python' 2019-05-20 18:17:51 -05:00
Nathaniel Nicandro
7bb7e46e1f jupyter-start-kernel (jupyter-command-kernel): Change wording of comment 2019-05-20 17:34:32 -05:00
Nathaniel Nicandro
edf3097b04 org-babel-jupyter-override-src-block: Be more robust
Fixes #118
2019-05-20 14:52:26 -05:00
Nathaniel Nicandro
240dc7ab08 org-babel-expand-body:jupyter: Correct arguments to language specific expander
The language specific expander only expects (BODY PARAMS)
2019-05-19 23:16:46 -05:00
jackkamm
1befd70e98 Handle isolated metadata property for HTML results of the R kernel (#115) 2019-05-19 22:40:51 -05:00