Hi everyone,
​
My ipython console is getting super slow when the buffer is longer than \~10 000 lines (for example when I accidentally print a very long variable).
I know C-c M-o runs the command comint-clear-buffer (found in inferior-python-mode-map), which is an interactive compiled Lisp function. And running it manually solves my problem. Now, I would like to have it to run automatically when the \*Python\* buffer is longer than X lines, but can't find how to do it.
One related issue is that I shouldn't run into a long buffer limitation than quickly, i.e. I should prevent very long variables (e.g. long lists) from being entirely printed in the buffer. For instance, when print() is called, I would like to only print the first and last 10 entries of a variable if it is longer than e.g. 100 lines. However, here again, I can't find how to do it...
​
Any help would be much appreciated, thank you a lot in advance! :)