From 9ef11d0e3129d7bce754b208726e2be25377ac72 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 26 Feb 2021 21:20:39 -0500 Subject: [PATCH] Auto-truncate compilation buffers To prevent memory issues in long lived processes. Allows #4261 to be merged Addresses (and mentioned in) asok/projectile-rails#148 --- core/core-ui.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/core-ui.el b/core/core-ui.el index 22c5f6d82..9e4b742c0 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -361,7 +361,8 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original (after! comint - (setq comint-prompt-read-only t)) + (setq comint-prompt-read-only t + comint-buffer-maximum-size 2048)) ; double the default (after! compile @@ -369,7 +370,11 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original compilation-ask-about-save nil ; save all buffers on `compile' compilation-scroll-output 'first-error) ;; Handle ansi codes in compilation buffer - (add-hook 'compilation-filter-hook #'doom-apply-ansi-color-to-compilation-buffer-h)) + (add-hook 'compilation-filter-hook #'doom-apply-ansi-color-to-compilation-buffer-h) + ;; Automatically truncate compilation buffers so they don't accumulate too + ;; much data and bog down the rest of Emacs. + (autoload 'comint-truncate-buffer "comint" nil t) + (add-hook 'compilation-filter-hook #'comint-truncate-buffer)) (after! ediff