summary refs log tree commit diff stats
path: root/user/emacs
diff options
context:
space:
mode:
authorAlan Pearce2020-03-02 15:39:51 +0100
committerAlan Pearce2020-03-02 15:39:51 +0100
commita6c3b48a7bac0b52778a39d95f04a5f6d3ac84ba (patch)
tree5b9d5c0e9a9ece06232a69015e11ca5224cbf964 /user/emacs
parent018c4cbf631cb86b765c6ef40dd33c94105d5e0a (diff)
downloadnixfiles-a6c3b48a7bac0b52778a39d95f04a5f6d3ac84ba.tar.lz
nixfiles-a6c3b48a7bac0b52778a39d95f04a5f6d3ac84ba.tar.zst
nixfiles-a6c3b48a7bac0b52778a39d95f04a5f6d3ac84ba.zip
Emacs: optimise GC during minibuffer usage
Diffstat (limited to 'user/emacs')
-rw-r--r--user/emacs/.emacs.d/init.el13
1 files changed, 8 insertions, 5 deletions
diff --git a/user/emacs/.emacs.d/init.el b/user/emacs/.emacs.d/init.el
index 7c9b6e2b..b511e907 100644
--- a/user/emacs/.emacs.d/init.el
+++ b/user/emacs/.emacs.d/init.el
@@ -7,11 +7,14 @@
       evil-want-keybinding nil
       frame-inhibit-implied-resize t)
 
-(setq gc-cons-threshold most-positive-fixnum
-      gc-cons-percentage 0.6)
-(add-hook 'after-init-hook (lambda ()
-                             (setq gc-cons-threshold (* 16 1024 1024)
-                                   gc-cons-percentage 0.1)))
+(let ((default-gc-cons-threshold (* 16 1024 1024)))
+  (setq gc-cons-threshold most-positive-fixnum
+        gc-cons-percentage 0.6)
+  (add-hook 'minibuffer-setup-hook (lambda () (setq gc-cons-threshold most-positive-fixnum)))
+  (add-hook 'minibuffer-exit-hook (lambda () (setq gc-cons-threshold default-gc-cons-threshold)))
+  (add-hook 'after-init-hook (lambda ()
+                               (setq gc-cons-threshold default-gc-cons-threshold
+                                     gc-cons-percentage 0.1))))
 
 (package-initialize)