Open non-Jedi opened 5 years ago
In the REPL you can also evaluate code using C-c C-c
. So you can select the region of code, press C-c C-c
, and a results buffer will be displayed. You can then rename the buffer so that it sticks around longer. Is this basically what you are trying to accomplish with this feature?
I think what is missing is the ability to force the display of the result in a new buffer since pressing C-c C-c
can potentially display the result in the minibuffer according to jupyter-eval-short-result-max-lines
.
So after messing around with C-c C-c
in the repl buffer, a couple notes on why it doesn't quite work for my workflow:
C-c C-c
, the command I evaluated is still there on an input line in the REPL buffer, so I have to manually delete it before I can do other things with the buffer.special-mode
as its major mode, I end up with q
bound as quit-window
which can be annoying. The buffers are also read-only when sometimes I want to do some post-processing. If the mode for jupyter output instead was a new major mode inherited from special mode, I could override this behavior. As it is, I just have to manually change the mode for that buffer.the command I evaluated is still there on an input line in the REPL buffer
There is also C-c M-:
(jupyter-eval-string-command
) which lets you enter code to evaluate in the minibuffer. Then you can C-c M-: M-p
to repeat the command in the future.
For longer expressions you can just copy and paste them from some other buffer into the minibuffer, but I am also thinking of adding a way to pop-up a buffer to enter longer form input and send it to a kernel similar to how magit
asks for a commit message. See https://github.com/dzop/emacs-jupyter/issues/35#issuecomment-497039866 for discussion.
If the mode for jupyter output instead was a new major mode inherited from special mode
👍
Maybe just get rid of the read only behavior and inherit from fundamental-mode
instead.
Another workflow that I use quite often is to open up the scratch buffer, e.g. using C-c C-s
in the REPL, and evaluate code there with C-c C-c
. If you want to be able to mess with the output of evaluated code, you can instead do C-u C-c C-c
which will insert the text/plain
representation of output underneath the code you evaluated.
Often I find myself wanting to do some formatting or just to have the results of a REPL command easily available to me for a longer time. It would be nice if there was a built-in facility to both evaluate the current REPL command and send results to a new buffer and pop the results of the last command to a new buffer.