From 293c1d450363105f714316a01d9462eda7a9f99f Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Sat, 30 Mar 2024 23:58:30 -0400 Subject: Add a few Emacs initialization customizations --- .emacs.d/init.el | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to '.emacs.d/init.el') diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 34b1bc9..6e038d4 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -34,6 +34,30 @@ ;;; Code: +;;; Emacs initialization + +;; Temporarily increase `gc-cons-threshhold' and `gc-cons-percentage' +;; during startup to reduce garbage collection frequency. Clearing +;; `file-name-handler-alist' seems to help reduce startup time too. +(defconst b/gc-cons-threshold gc-cons-threshold) +(defconst b/gc-cons-percentage gc-cons-percentage) +(defvar b/file-name-handler-alist file-name-handler-alist) +(setq gc-cons-threshold (* 30 1024 1024) ; 30 MiB + gc-cons-percentage 0.6 + file-name-handler-alist nil + ;; sidesteps a bug when profiling with esup + esup-child-profile-require-level 0) + +;; Set them back to their defaults once we're done initializing. +(defun b/post-init () + "My post-initialize function, run after loading `user-init-file'." + (setq + b/emacs-initialized t + gc-cons-threshold b/gc-cons-threshold + gc-cons-percentage b/gc-cons-percentage + file-name-handler-alist b/file-name-handler-alist)) +(add-hook 'after-init-hook #'b/post-init) + ;; whoami (setq user-full-name "Amin Bandali" user-mail-address "bandali@kelar.org") @@ -678,9 +702,10 @@ for all frames." (add-to-list 'savehist-additional-variables 'kill-ring)) ;; Automatically save place in files. +(setq save-place-file (b/var "save-place.el")) (run-with-idle-timer 0.2 nil #'require 'saveplace nil 'noerror) (with-eval-after-load 'saveplace - (setq save-place-file (b/var "save-place.el")) + ;; (setq save-place-file (b/var "save-place.el")) (save-place-mode)) (add-to-list 'auto-mode-alist '("\\.*rc$" . conf-mode)) -- cgit v1.2.3-60-g2f50