I run lots of test in shell-mode because I love being able to search through the history. However, some of these tests print lots of info to stdout and will cause my memory usage to go through the roof after a long period of time. I have to manually delete the history to keep the memory in check. Is there a way to tell shell-mode to discard old messages after so many lines?
1 Answer
Yes, if you want to make shell buffers limited in length, add the function comint-truncate-buffer
to comint-output-filter-functions
. You should be able to add this to your .emacs
:
(add-hook 'comint-output-filter-functions #'comint-truncate-buffer)