emacs-jupyter / jupyter

An interface to communicate with Jupyter kernels.
GNU General Public License v3.0
934 stars 92 forks source link

[BUG] Copying text from REPL buffer breaks kill ring #519

Open egr95 opened 9 months ago

egr95 commented 9 months ago

Here's a simple reproducer:

  1. Copy any text to the clipboard (i.e., select the text and run kill-ring-save)
  2. Open an emacs-jupyter REPL (e.g., jupyter-run-repl)
  3. Copy any text in the REPL buffer that is above the command prompt (i.e., the input or output of any previous cell, for example you can run print('hello world') and then select hello world and then run kill-ring-save)
  4. Run yank-from-kill-ring and press M-p to cycle backward through the kill ring. Pressing M-p a second time gives an error Text is read-only, meaning you can no longer access the text you copied in step 1

Is it possible to somehow disable the read-only mode in the REPL buffer whenever we copy text from it? I actually think the ability to easily navigate and copy text from the REPL is a really cool feature of emacs-jupyter, but it shouldn't break the kill ring. Moreover, I occasionally notice that copying text from the previous cells into the command prompt can cause strange glitches due to this read-only mode, whereby you lose the ability to add anymore text or even execute the last cell, essentially losing control of the REPL.

Thank you!

egr95 commented 7 months ago

I believe this is actually a bug with emacs itself, and I have filed a bug report with the maintainers.

However, it would still be nice to have the option to disable read-only mode in the REPL here. It still happens to me every so often that I inadvertently paste some read-only text into the prompt and am left with an unusable REPL as a result.

Thanks!