我可以限制 Emacs 中编译缓冲区的长度吗? [英] Can I limit the length of the compilation buffer in Emacs?

查看:21
本文介绍了我可以限制 Emacs 中编译缓冲区的长度吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以限制 Emacs 编译缓冲区存储的行数?如果没有遇到错误,我们的构建系统可以在整个产品构建中生成大约 10,000 行输出.由于我的编译缓冲区也解析 ANSI 颜色,所以这会变得非常非常慢.我只想拥有例如2,000 行输出缓冲.

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.

推荐答案

看来 comint-truncate-buffer 对于编译缓冲区和对于 shell 缓冲区的效果一样好:

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)

我通过使用命令 perl -le 'print for 1..10000' 运行 compile 来测试这个.完成后,编译缓冲区的第一行是8001.

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.

这篇关于我可以限制 Emacs 中编译缓冲区的长度吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆