From 83364e5b9720d28270760dbbe9e69a1a5b24077f Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Tue, 3 Sep 2019 12:28:47 -0400 Subject: [PATCH] emacs: improve init-related messages --- .emacs.d/init.el | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index bfc9d28..6068a1c 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -39,9 +39,13 @@ (defvar b/before-user-init-time (current-time) "Value of `current-time' when Emacs begins loading `user-init-file'.") -(message "Loading Emacs...done (%.3fs)" - (float-time (time-subtract b/before-user-init-time - before-init-time))) +(defvar b/emacs-initialized nil + "Whether Emacs has been initialized.") + +(when (not (bound-and-true-p b/emacs-initialized)) + (message "Loading Emacs...done (%.3fs)" + (float-time (time-subtract b/before-user-init-time + before-init-time)))) ;; temporarily increase `gc-cons-threshhold' and `gc-cons-percentage' ;; during startup to reduce garbage collection frequency. clearing @@ -57,8 +61,10 @@ ;; set them back to their defaults once we're done initializing (defun b/post-init () - (setq gc-cons-threshold b/gc-cons-threshold - gc-cons-percentage b/gc-cons-percentage + "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) @@ -152,9 +158,10 @@ (expand-file-name "~/.emacs.d/straight/build/"))) (defun b/reload-init () - "Reload init.el." + "Reload `user-init-file'." (interactive) - (setq b/file-name-handler-alist file-name-handler-alist) + (setq b/before-user-init-time (current-time) + b/file-name-handler-alist file-name-handler-alist) (load user-init-file nil 'nomessage) (b/post-init)) -- 2.20.1