I am running and interactive ipython shell in an emacs buffer using ipython.el
. I wonder if there is a way to clear the screen? Since it is not running on a terminal, the import os; os.system('CLS')
trick will not work. Thanks.
It looks like ipython is based on comint, which means the following code should work for you (called with M-x my-clear
or your favourite key binding):
(defun my-clear ()
(interactive)
(let ((comint-buffer-maximum-size 0))
(comint-truncate-buffer)))
I posted some other options in response to this question.
C-c M-o runs the command comint-clear-buffer (found in inferior-python-mode-map), which is an interactive compiled Lisp function.
It is bound to C-c M-o.
(comint-clear-buffer)
Clear the comint buffer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With