summary refs log tree commit diff stats
path: root/user
diff options
context:
space:
mode:
authorAlan Pearce2024-05-15 15:47:58 +0200
committerAlan Pearce2024-05-15 15:47:58 +0200
commit897916633e1ce006b20fc0af9f3b23fba27dbecb (patch)
tree1efd7912949d637e8dd0dc14b6e293d511ac4601 /user
parent87e822d1c473e9a373841bdcadbdc2c34d3cf6d9 (diff)
downloadnixfiles-897916633e1ce006b20fc0af9f3b23fba27dbecb.tar.lz
nixfiles-897916633e1ce006b20fc0af9f3b23fba27dbecb.tar.zst
nixfiles-897916633e1ce006b20fc0af9f3b23fba27dbecb.zip
emacs: re-add gc optimisation settings
Diffstat (limited to 'user')
-rw-r--r--user/emacs/init.el12
1 files changed, 11 insertions, 1 deletions
diff --git a/user/emacs/init.el b/user/emacs/init.el
index a0f77610..a17517ac 100644
--- a/user/emacs/init.el
+++ b/user/emacs/init.el
@@ -1,7 +1,17 @@
 ;;; init --- user init file  -*- lexical-binding: t; -*-
 (eval '(setq inhibit-startup-echo-area-message "alan"))
 (defvar default-file-name-handler-alist file-name-handler-alist)
-(setq file-name-handler-alist nil)
+(setq file-name-handler-alist nil
+      gc-cons-threshold most-positive-fixnum
+      gc-cons-percentage 0.6)
+(defun set-max-gc-cons ()
+  (setq gc-cons-threshold most-positive-fixnum))
+(defun set-default-gc-cons ()
+  (setq gc-cons-threshold (* 16 1024 1024)
+        gc-cons-percentage 0.1))
+(add-hook 'minibuffer-setup-hook #'set-max-gc-cons)
+(add-hook 'minibuffer-exit-hook #'set-default-gc-cons)
+(add-hook 'after-init-hook #'set-default-gc-cons)
 
 (defun restore-file-name-handler-alist ()
   (setq file-name-handler-alist default-file-name-handler-alist))