jupyter icon indicating copy to clipboard operation
jupyter copied to clipboard

History from REPL inside a src block

Open fraricci opened this issue 5 years ago • 3 comments

Hello and thanks for this great package.

I use ipython and its ability of searching through command history. I see that this can be possible inside a REPL buffer. But, I was wondering if there's a way to have access to the history while I'm writing code in a src block in a org file. I tried to call 'jupyter-repl-history-next' inside a src block without success.

Thanks for any idea.

fraricci avatar Dec 17 '19 22:12 fraricci

Sorry for the late reply. No, nothing like that is possible yet. I like the idea though. As a stop gap, to make it easier to copy text from a REPL cell, you can bind the function below to an appropriate key in jupyter-repl-mode-map.

(defun jupyter-repl-kill-new ()
  (interactive)
  (kill-new (jupyter-repl-cell-code)))

nnicandro avatar Mar 13 '20 04:03 nnicandro

Thanks for your reply. It's cool that you like the idea. Naively, I was thinking possible to call the jupyter-repl-history-previous function in any python buffer, previously connected to a REPL. Since the REPL already provides different things to the buffer (i.e. completion and docs), I was wondering if it can also provide the commands in its history.

About your suggested function, should I call it when I'm in a REPL cell containing text ? EDIT: yes I tried and it works. Is there a way to also yank the content of a cell into a certain buffer?

Thanks

fraricci avatar Mar 16 '20 10:03 fraricci

Is there a way to also yank the content of a cell into a certain buffer?

How do you mean? Can't you, after copying the REPL cell text, go to a buffer and C-y (the default yank binding) to paste the text? Not ideal, but you can use C-x o (other-window) or similar to go from the REPL buffer to the window with the buffer you want to yank into. Its easier if you use something like ace-window to jump windows though.

nnicandro avatar Mar 17 '20 20:03 nnicandro