Is it possible to limit the number of lines that the Emacs compilation buffer stores? Our build system can produce some 10,000 lines of output on whole product builds, if no errors are encountered. Since my compilation buffer also parses ANSI colors, this can get very, very slow. I would like to have only e.g. 2,000 lines of output buffered.
Compilation mode turns each error message in the buffer into a hyperlink; you can move point to it and type RET, or click on it with the mouse (see Mouse References), to visit the locus of the error message in a separate window. The locus is the specific position in a file where that error occurred.
To display one of the buffers in a full screen, move the cursor into the buffer list's window; use C-n and C-p to move to the line for the buffer that you want, and press 1 (the number one). Emacs displays the buffer in a full-screen window.
To compile a program in Emacs, type Escape followed by x followed by compile, or use the pull down "tool" menu and select compile.
To execute a file of Emacs Lisp code, use M-x load-file . This command reads a file name using the minibuffer and then executes the contents of that file as Lisp code. It is not necessary to visit the file first; in any case, this command reads the file as found on disk, not text in an Emacs buffer.
It appears that comint-truncate-buffer
works just as well for compilation buffers as it does for shell buffers:
(add-hook 'compilation-filter-hook 'comint-truncate-buffer)
(setq comint-buffer-maximum-size 2000)
I tested this by running compile
with the command perl -le 'print for 1..10000'
. When it was done, the first line in the compilation buffer was 8001
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With