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

查看:80
本文介绍了我可以限制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)

我通过运行 compile 通过使用命令 perl -le'print for 1..10000'进行测试。完成后,编译缓冲区中的第一行为 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天全站免登陆