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?
Yes, if you want to make shell buffers limited in length, add the function
comint-output-filter-functions. You should be able to add this to your
(add-hook 'comint-output-filter-functions #'comint-truncate-buffer)