summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.emacs.d/init.el27
1 files changed, 26 insertions, 1 deletions
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))