Defer garbage collection in the minibuffer

This can speed up things that run in or from the minibuffer, like
projectile/helm/ivy commands.
This commit is contained in:
Henrik Lissner 2018-09-02 17:06:12 +02:00
parent a581b7fc3f
commit daef19ba64
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -298,6 +298,14 @@ original value of `symbol-file'."
;; Truly silence startup message
(fset #'display-startup-echo-area-message #'ignore)
;; Don't garbage collect to speed up minibuffer commands
(defun doom|defer-garbage-collection ()
(setq gc-cons-threshold most-positive-fixnum))
(defun doom|restore-garbage-collection ()
(setq gc-cons-threshold doom-gc-cons-threshold))
(add-hook 'minibuffer-setup-hook #'doom|defer-garbage-collection)
(add-hook 'minibuffer-exit-hook #'doom|restore-garbage-collection)
;;
;; Bootstrap helpers