From 63555d73651a0fa90d14ea403af4a8ada48a2faa Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Thu, 11 Mar 2021 12:16:50 -0600 Subject: Configure garbage collection --- init.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/init.el b/init.el index 86eb548..c316588 100644 --- a/init.el +++ b/init.el @@ -371,6 +371,21 @@ (acdw/set '((disabled-command-function nil) (load-prefer-newer t) (comp-async-report-warnings-errors nil))) + (fset 'yes-or-no-p #'y-or-n-p) +;; Garbage collection +(defun hook--gc-cons-maximize () + (setq gc-cons-threshold most-positive-fixnum)) +(add-hook 'minibuffer-setup-hook #'hook--gc-cons-maximize) + +(defun hook--gc-cons-baseline () + (setq gc-cons-threshold gc-cons-threshold-basis)) +(add-hook 'minibuffer-exit-hook #'hook--gc-cons-baseline) + +(defun hook--gc-when-unfocused () + (acdw/when-unfocused #'garbage-collect)) +(add-function :after after-focus-change-function + #'hook--gc-when-unfocused) + ;;; init.el ends here -- cgit 1.4.1-21-gabe81