Created
January 8, 2020 06:48
-
-
Save aaronjensen/7aa99e109a2890be031ba52488e896c5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defvar aj--eager-features nil) | |
(setq aj--initial-feature-count (length features)) | |
(setq aj--eager-features-path (no-littering-expand-var-file-name "eager-features")) | |
(defun aj/load-eager-features () | |
(while (and aj--eager-features | |
(not (input-pending-p))) | |
(unwind-protect | |
(require (pop aj--eager-features) nil t))) | |
(when aj--eager-features | |
(aj/load-eager-features-idle))) | |
(defun aj/load-eager-features-idle () | |
(run-with-idle-timer 0.05 nil #'aj/load-eager-features)) | |
(defun aj/load-eager-features-start () | |
(and (file-exists-p aj--eager-features-path) | |
(load aj--eager-features-path) | |
(aj/load-eager-features-idle))) | |
(defun aj/save-libs () | |
(with-temp-file aj--eager-features-path | |
(insert "(setq aj--eager-features '") | |
(insert (format "%S" (reverse (butlast features aj--initial-feature-count)))) | |
(insert ")\n"))) | |
(add-hook 'after-init-hook #'aj/load-eager-features-start) | |
(add-hook 'kill-emacs-hook #'aj/save-libs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment