Commit graph

1834 commits

Author SHA1 Message Date
Nathaniel Nicandro
eebeef1293 Don't attempt to byte-compile a symbol whose function value is a subr
`(byte-compile #'cons)` will return `t` which is not a function.
Passing in the `subr` to `byte-compile` will just return the `subr` so
everything works out OK.  This is an attempt at fixing issues like
nnicandro/emacs-zmq#32.
2023-02-13 20:15:56 -06:00
Nathaniel Nicandro
85f6ff84ed jupyter-org--coalesce-stream-results: Refactor 2023-02-13 20:15:56 -06:00
Ahmed Shariff
bc3b78be43 Fix available-kernelspecs failing from warning output 2023-02-04 20:24:55 -06:00
Jürgen Hötzel
4d62a88951 Use TRAMP handler for access-file
Fixes file-not-found error when using `dired`.
2023-02-04 20:18:06 -06:00
Nathaniel Nicandro
16cbda7916 Fix incorrect number of arguments 2023-02-04 16:58:12 -06:00
Nathaniel Nicandro
14899664b6 Don't use zmq-recv-decoded and zmq-send-encoded
These functions no longer exist in newer versions of `emacs-zmq`.
Closes #433.
2023-02-03 20:12:32 -06:00
Nathaniel Nicandro
3736ae753a Prevent leaking ANSI sequences when inserting text/plain results
* jupyter-mime.el (jupyter-insert): Do it.
2023-02-03 20:12:32 -06:00
Nathaniel Nicandro
2e8689227f Add a way to debug the message stream from a kernel
Previously it was hard to step through the code whenever messages were
coming in live from a kernel due to the asynchronous nature of
handling process output in Emacs.
2023-02-03 20:12:32 -06:00
Tomasz Mieszkowski
7d20c0aee2 Sort available kernelspecs; guess with ^; use guessing in jupyter-run-repl 2022-04-19 13:52:23 -05:00
Mikhail Rudenko
0a7055d7b1 Add optional image width limiting for REPL 2022-02-11 20:10:00 -06:00
Nathaniel Nicandro
42a9765897 Fix typo
Change `target-name` to `target_name`
2022-01-05 13:43:26 -06:00
Nathaniel Nicandro
df343af5e9 Remove .github/FUNDING.yml 2021-12-09 21:20:52 -06:00
Nathaniel Nicandro
c702f1e90f Add some helper functions for Org tests 2021-11-30 10:47:53 -06:00
Nathaniel Nicandro
03a4f688cc Remove superfluous and 2021-11-30 10:47:53 -06:00
Nathaniel Nicandro
113acb239d Use default-directory as :dir when executing a source block
`default-directory` is already set according to :dir when executing a
source block. This prevents `org-babel-expand-body:jupyter` from
attempting to re-expand the value of the :dir header argument.
See #302.
2021-11-30 10:47:53 -06:00
Nathaniel Nicandro
db450a9f44 Ignore ANSI escapes when testing some Org source blocks 2021-11-30 10:47:53 -06:00
Nathaniel Nicandro
a2cbebdfda Use a raw string in :dir handling code for Python source blocks 2021-11-30 10:47:53 -06:00
Nathaniel Nicandro
724d03ea20 Install pandoc during tests on Travis and Appveyor 2021-11-30 10:46:52 -06:00
Nathaniel Nicandro
4729e21184 Fix output order when using pandoc conversion
Fixes #351.
2021-11-30 10:46:52 -06:00
Tomasz Mieszkowski
57306bf385 Make scratch buffers easier to identify 2021-11-27 21:47:25 -06:00
Tomasz Mieszkowski
7b64e18144 Update dev, remove init target in Makefile (no --dev option) 2021-11-27 21:32:28 -06:00
Nathaniel Nicandro
0dec83f7e4 Remove a usage of thread-first and thread-last
This usage broke debugging of org-babel-execute:jupyter.
2021-11-20 20:32:35 -06:00
Nathaniel Nicandro
162d047e62 Add section on how to run tests in README
Closes #239
2021-11-20 10:53:09 -06:00
Nathaniel Nicandro
19aab43b9e Fix link in README 2021-11-20 10:14:58 -06:00
Nathaniel Nicandro
5b09d4d5ca Case insensitivity when checking drawer name
Fixes #328
2021-11-19 20:20:19 -06:00
Nathaniel Nicandro
bb53fdd864 Don't manually fontify ANSI escapes in error tracebacks
The fontification is handled by font-lock in the Org buffer.

See https://github.com/nnicandro/emacs-jupyter/issues/328#issuecomment-968406494.
2021-11-19 20:12:58 -06:00
Nathaniel Nicandro
b87ecf0cd3 Scroll to bottom of window on new stream output
See #244
2021-11-17 19:36:46 -06:00
Nathaniel Nicandro
f178c1c7b8 Support Lisp expressions as session names 2021-11-15 19:50:54 -06:00
Nathaniel Nicandro
6de6ccd891 Fix argument position in a call to org-babel-get-src-block-info 2021-11-15 19:30:54 -06:00
Nathaniel Nicandro
20e68a6836 Revert "Remove .github/FUNDING.yml"
This reverts commit 64dda221c0.
2021-11-02 13:00:32 -05:00
Nathaniel Nicandro
1f0612eb93 Remove unused functions
* jupyter-kernelspec.el (jupyter-read-kernelspec)
(jupyter-kernelspecs-for-mode): Do it.
2021-04-22 09:51:36 -05:00
Nathaniel Nicandro
baa291a0e8 jupyter--connection-info: Validate connection info before returning it
* jupyter-client.el (jupyter--connection-info): Do it.
(jupyter-comm-initialize): Remove validation of connection info.
2021-04-22 09:51:36 -05:00
Nathaniel Nicandro
b4304ae473 Use cl-labels in one place
* jupyter-rest-api.el (jupyter-api-get-ordered-checkpoints): Do it.
2021-04-22 09:51:36 -05:00
Nathaniel Nicandro
a6c40a44fc Reduce length of some variable names
* ob-jupyter.el
(org-babel-jupyter-initiate-session-by-key): Get rid of unnecessary
variable.
(org-babel-jupyter-cleanup-file-links): result-pos -> pos, link-path
-> path,  link-dir -> dir. Add resource-dir variable to avoid
calculating the same thing in a loop.
(org-babel-execute:jupyter): kernel-lang -> lang
2021-04-22 09:51:36 -05:00
Nathaniel Nicandro
62b3de44a4 Mention why :file is being added to source block params
* jupyter-org-client.el (jupyter-org-result): Do it.
2021-04-22 09:51:36 -05:00
Nathaniel Nicandro
d99c9b2d2a Refactor org-babel-execute:jupyter for readability
* ob-jupyter.el (org-babel-jupyter--execute): New function.
(org-babel-execute:jupyter): Use it.
2021-04-22 09:51:36 -05:00
Nathaniel Nicandro
fca3671d4e jupyter-meta-kernel -> jupyter-kernel 2021-04-22 09:51:36 -05:00
Nathaniel Nicandro
2ff99918d2 Remove unnecessary function call
* jupyter-kernel-manager.el (initialize-instance): Remove
  `jupyter-kernel-alive-p` call.  This check is already done by
  `jupyter-kill-kernel`.
2021-04-22 09:51:36 -05:00
Nathaniel Nicandro
ebf67c475e Remove two methods of jupyter-kernel-process-manager
There was an implementation of `jupyter-start-channels` for a
`jupyter-kernel-process-manager` due to the manager being able to send messages
to the kernel via a kernel's control channel.  The channel currently serves as
an implementation detail of the manager class, don't allow its status to be
controlled outside of the manager class by removing the implementation.

In addition, remove the `jupyter-stop-channels` implementation since
it is no longer needed.

* jupyter-kernel-manager.el (jupyter-start-kernel): Remove call to
`jupyter-start-channels` on MANAGER.  This should not have been done in the
first place since only `jupyter-kernel-process-manager` implemented that
method, as explained.  Also remove the `jupyter-kernel-alive-p` call, this is
already done in an :around method of `jupyter-kernel-alive-p`, see
`jupyter-kernel-lifetime`.

* jupyter-kernel-process-manager.el
(jupyter-start-channels, jupyter-stop-channels)
[jupyter-kernel-process-manager]: Remove. For `jupyter-stop-channels`, expand
body at call site.
(jupyter-start-kernel) [jupyter-kernel-process-manager]:  Start the control
channel as a final step.
(jupyter-shutdown-kernel, jupyter-interrupt-kernel): Remove
`jupyter-start-channels` call.
2021-04-22 09:51:36 -05:00
Nathaniel Nicandro
1fa6ed4e5f Remove the jupyter-ioloop-handler method
Replace it with a handler function passed to `jupyter-ioloop-start`.

* jupyter-ioloop-comm.el: Do it.

* jupyter-channel-ioloop-comm.el: Do it.

* jupyter-channel-ioloop-comm.el: Do it.

* jupyter-ioloop.el: Do it. Update comments and doc.
(jupyter-ioloop--delete-process): Remove. It was used to perform
cleanup when the object used for dispatching to a handler method was
garbage collected. Since we no longer rely on having an object for
dispatching, preferring just a function to call, its not needed.

(jupyter-ioloop--make-filter): Fall back to calling handler function
instead of `jupyter-ioloop-handler`. Only handle ioloop start/stop
events internally. This means we can remove the check for those in
`jupyter-ioloop-comm`.

* test/jupyter-test.el: Update tests to take into account above
  changes.
2021-04-22 09:51:36 -05:00
Nathaniel Nicandro
786f61fb99 Remove jupyter-session based jupyter-ioloop-start implementation
This in preparation for removing the `jupyter-ioloop-handler` method
altogether.

* jupyter-ioloop-comm.el
(jupyter-channel-ioloop--set-session): Promote to public function.
(jupyter-ioloop-start): Remove `jupyter-session` based
implementation. Preferring sub-classes to call
`jupyter-channel-ioloop-set-session`.

* jupyter-channel-ioloop-comm.el
(jupyter-comm-initialize): Use the newly public function.
2021-04-22 09:51:36 -05:00
Nathaniel Nicandro
5d2007d5f2 Fix ordering of system-type check
We would still like a message indicating that a kernel process starts on
Windows.

* jupyter-kernel-process-manager.el
(jupyter-start-kernel) [jupyter-spec-kernel]: Do it.
2021-04-22 09:51:36 -05:00
Nathaniel Nicandro
6be4f79ab3 Add jupyter-read-connection
* jupyter-base.el (jupyter-read-connection): New function.

* jupyter-kernel-process-manager.el
(jupyter-start-kernel) [jupyter-command-kernel]: Use it.
2021-04-22 09:51:36 -05:00
Nathaniel Nicandro
c36f6fd63a Query for a kernel with point at the last place a user left it
`jupyter-org-closest-jupyter-language` falls back to asking a user for a
kernel, when it does so `point` is at the beginning of the buffer. Make sure
`point` is at the location where the user last left it.

* jupyter-org-extensions.el (jupyter-org-closest-jupyter-language): Do it.
2021-04-22 09:51:36 -05:00
Nathaniel Nicandro
026c3fac61 Use :extra methods for org-babel-jupyter-parse-session
* ob-jupyter.el
(org-babel-jupyter-server-session)
(org-babel-jupyter-parse-session): Convert to method and re-implement
with :extra methods.

* test/jupyter-server-test.el
(org-babel-jupyter-server-session): New test.

* test/jupyter-test.el
(org-babel-jupyter-parse-session): Move test of server based sessions
to the new test.
2021-04-22 09:51:36 -05:00
Nathaniel Nicandro
7735d2b8fb Fix typo 2021-04-06 21:12:45 -05:00
Nathaniel Nicandro
303a8f2e81 Don't narrow to REPL cell when fontifying syntactically
There is no need to do so since
`jupyter-repl-font-lock-fontify-region` already takes care of
narrowing to cell bounds and `font-lock-syntactic-face-function` is
called during the fontification process of the narrowed cell.
2021-04-04 12:45:11 -05:00
Nathaniel Nicandro
477dcfd71c Don't add the font-lock-multiline property to finalized cell text
The boundaries of cell text are already considered by
`jupyter-repl-map-cells` (called during fontification) so there is no
need to, in addition, have the `font-lock-multiline` property (see the
documentation of `font-lock-extend-region-functions` for what that
property is meant to do).

With regards to the comment, since the buffer is narrowed to the cell
text during fontification, syntactic fontification is contained within
the cell.
2021-04-04 12:45:11 -05:00
Nathaniel Nicandro
d1c6f74ead Remove jupyter-(send|recv) methods of a jupyter-session object
There is no need to have an extra function call and they were not used
anywhere else.

* jupyter-zmq-channel.el
(jupyter-send, jupyter-recv) [jupyter-session]: Remove. Update all
callers.
2021-04-03 12:22:58 -05:00
Nathaniel Nicandro
04330c4dd3 Move declaration
* jupyter-base.el: Do it.
2021-04-03 12:22:58 -05:00