I'm new to spacemacs -- I'm using it as a Python IDE.

I'd like to know if there is an easy way to copy lines from the history on a REPL back to the source-code window.

The idea is, I prototype in the REPL and I'd like to copy and clean the code out in the source code window.


1 Answer 1


In normal Emacs you can do that if you use Python REPL (command C-c C-l, see in menu) but there are somewhat mixed two commands on one line and not in order.

However, if you use iPython, there is possible to have it right. Use the command %magic in iPython and you will find out the %history magic keyword can do as in the picture below:

enter image description here

Note also that typing first in REPL and then moving to a file will be more time consuming and difficult than typing first in source code and then sending to REPL with C-c C-c.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.