diff --git a/early-init.el b/early-init.el index 9512b34..85cdb06 100644 --- a/early-init.el +++ b/early-init.el @@ -89,9 +89,10 @@ minimalistic appearance during startup.") (setq gc-cons-threshold most-positive-fixnum) -(add-hook 'emacs-startup-hook - (lambda () - (setq gc-cons-threshold minimal-emacs-gc-cons-threshold))) +(defun minimal-emacs--restore-gc-cons-threshold () + "Restore `minimal-emacs-gc-cons-threshold'." + (setq gc-cons-threshold minimal-emacs-gc-cons-threshold)) +(add-hook 'emacs-startup-hook #'minimal-emacs--restore-gc-cons-threshold 105) ;;; Misc @@ -127,15 +128,17 @@ minimalistic appearance during startup.") (let ((file-name-handler-alist (if args-left old-value file-name-handler-alist))) (funcall fn args-left))) - ;; Remember the old value to reset it as needed. - (add-hook 'emacs-startup-hook - (lambda () - (set-default-toplevel-value - 'file-name-handler-alist - ;; Merge instead of overwrite to preserve any changes made - ;; since startup. - (delete-dups (append file-name-handler-alist old-value)))) - 101)) + + ;; Restore the old value to reset it as needed. + (defun minimal-emacs--restore-file-name-handler-alist () + "Restore `file-name-handler-alist'." + (set-default-toplevel-value + 'file-name-handler-alist + ;; Merge instead of overwrite to preserve any changes made since startup. + (delete-dups (append file-name-handler-alist old-value)))) + + (add-hook + 'emacs-startup-hook #'minimal-emacs--restore-file-name-handler-alist 101)) (unless noninteractive (unless minimal-emacs-debug diff --git a/init.el b/init.el index b9c9f5f..cb5ea2f 100644 --- a/init.el +++ b/init.el @@ -208,15 +208,7 @@ ;; recently. (setq recentf-max-saved-items 300) ; default is 20 (setq recentf-max-menu-items 15) -(setq recentf-auto-cleanup (if (daemonp) 300 'never)) - -(defun minimal-emacs--cleanup-hook () - "Run `recentf-cleanup' if `recentf' is loaded and `recentf-mode' is enabled." - (when (and (featurep 'recentf) - recentf-mode - (fboundp 'recentf-cleanup)) - (recentf-cleanup))) -(add-hook 'kill-emacs-hook #'minimal-emacs--cleanup-hook) +(setq recentf-auto-cleanup (if (daemonp) 300 'mode)) ;; Update recentf-exclude (setq recentf-exclude (list "^/\\(?:ssh\\|su\\|sudo\\)?:"))