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.

share|improve this question
up vote 7 down vote accepted

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.

share|improve this answer
    
Can you please update this answer so that it gets hooked up to python-shell-mode with C-l – Kaunteya Mar 11 '15 at 14:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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