all repos — nixfiles @ 897916633e1ce006b20fc0af9f3b23fba27dbecb

System and user configuration, managed by nix and home-manager

emacs: re-add gc optimisation settings
Alan Pearce alan@alanpearce.eu
Wed, 15 May 2024 15:47:58 +0200
commit

897916633e1ce006b20fc0af9f3b23fba27dbecb

parent

87e822d1c473e9a373841bdcadbdc2c34d3cf6d9

1 files changed, 11 insertions(+), 1 deletions(-)

jump to
M user/emacs/init.eluser/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))