diff options
author | Case Duckworth | 2021-03-11 12:16:50 -0600 |
---|---|---|
committer | Case Duckworth | 2021-03-11 12:16:50 -0600 |
commit | 63555d73651a0fa90d14ea403af4a8ada48a2faa (patch) | |
tree | 006047e830d6555a268dc4365610810a2f2c0264 | |
parent | Configure emacs lisp (diff) | |
download | emacs-63555d73651a0fa90d14ea403af4a8ada48a2faa.tar.gz emacs-63555d73651a0fa90d14ea403af4a8ada48a2faa.zip |
Configure garbage collection
-rw-r--r-- | init.el | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/init.el b/init.el index 86eb548..c316588 100644 --- a/init.el +++ b/init.el | |||
@@ -371,6 +371,21 @@ | |||
371 | (acdw/set '((disabled-command-function nil) | 371 | (acdw/set '((disabled-command-function nil) |
372 | (load-prefer-newer t) | 372 | (load-prefer-newer t) |
373 | (comp-async-report-warnings-errors nil))) | 373 | (comp-async-report-warnings-errors nil))) |
374 | |||
374 | (fset 'yes-or-no-p #'y-or-n-p) | 375 | (fset 'yes-or-no-p #'y-or-n-p) |
375 | 376 | ||
377 | ;; Garbage collection | ||
378 | (defun hook--gc-cons-maximize () | ||
379 | (setq gc-cons-threshold most-positive-fixnum)) | ||
380 | (add-hook 'minibuffer-setup-hook #'hook--gc-cons-maximize) | ||
381 | |||
382 | (defun hook--gc-cons-baseline () | ||
383 | (setq gc-cons-threshold gc-cons-threshold-basis)) | ||
384 | (add-hook 'minibuffer-exit-hook #'hook--gc-cons-baseline) | ||
385 | |||
386 | (defun hook--gc-when-unfocused () | ||
387 | (acdw/when-unfocused #'garbage-collect)) | ||
388 | (add-function :after after-focus-change-function | ||
389 | #'hook--gc-when-unfocused) | ||
390 | |||
376 | ;;; init.el ends here | 391 | ;;; init.el ends here |