emacsansi-term

Emacs ansi-term maximum buffer size?


I like running shell programs using Emacs ansi-term mode, but I wonder how to set the maximum buffer size in ansi-term mode so I won't lose command history even when there are lot of lines? (Google doesn't seem to give a obvious answer.)


Solution

  • The variable term-buffer-maximum-size controls this value. Setting it to 0 should buffer everything (haven't used it but that is what the doc says). I'd be tempted to use a large value instead so a runaway program doesn't cause serious issues. It defaults to 2048 lines.

    (setq term-buffer-maximum-size 0) 
    

    in your term-mode-hook function should do it.