diff --git a/core/core-lib.el b/core/core-lib.el index 1cea6ce2f..61f5d082c 100644 --- a/core/core-lib.el +++ b/core/core-lib.el @@ -492,8 +492,9 @@ advised)." `(let ((fn (intern (format "%s-h" ,hook-var)))) (fset fn (lambda (&rest _) - (run-hook-wrapped ,hook-var #'doom-try-run-hook) - (set ,hook-var nil))) + (when after-init-time + (run-hook-wrapped ,hook-var #'doom-try-run-hook) + (set ,hook-var nil)))) (put ,hook-var 'permanent-local t) (dolist (on (list ,@targets)) (if (functionp on) diff --git a/core/core.el b/core/core.el index 94ed78b37..721af19b0 100644 --- a/core/core.el +++ b/core/core.el @@ -572,16 +572,17 @@ to least)." (with-eval-after-load 'package (require 'core-packages)) (with-eval-after-load 'straight (doom-initialize-packages)) + ;; Bootstrap our GC manager + (add-hook 'doom-first-input-hook #'gcmh-mode) + ;; Bootstrap the interactive session - (add-hook! 'window-setup-hook - (add-hook 'hack-local-variables-hook #'doom-run-local-var-hooks-h) - (add-hook 'after-change-major-mode-hook #'doom-run-local-var-hooks-maybe-h 'append) - (add-hook 'doom-first-input-hook #'gcmh-mode) - (add-hook-trigger! 'doom-first-input-hook 'pre-command-hook) - (add-hook-trigger! 'doom-first-file-hook 'after-find-file 'dired-initial-position-hook) - (add-hook-trigger! 'doom-first-buffer-hook 'after-find-file 'doom-switch-buffer-hook)) + (add-hook 'after-change-major-mode-hook #'doom-run-local-var-hooks-maybe-h) (add-hook 'emacs-startup-hook #'doom-load-packages-incrementally-h) - (add-hook 'window-setup-hook #'doom-display-benchmark-h 'append) + (add-hook 'hack-local-variables-hook #'doom-run-local-var-hooks-h) + (add-hook 'window-setup-hook #'doom-display-benchmark-h) + (add-hook-trigger! 'doom-first-buffer-hook 'after-find-file 'doom-switch-buffer-hook) + (add-hook-trigger! 'doom-first-file-hook 'after-find-file 'dired-initial-position-hook) + (add-hook-trigger! 'doom-first-input-hook 'pre-command-hook) (if doom-debug-p (doom-debug-mode +1)) ;; Load core/core-*.el, the user's private init.el, then their config.el diff --git a/modules/tools/lsp/config.el b/modules/tools/lsp/config.el index 8cccbc0c0..3c77ad1da 100644 --- a/modules/tools/lsp/config.el +++ b/modules/tools/lsp/config.el @@ -39,6 +39,8 @@ killing and opening many LSP/eglot-powered buffers.") ;; GC strategy, so we modify its variables rather than ;; `gc-cons-threshold' directly. (setq-default gcmh-high-cons-threshold (* 2 +lsp--default-gcmh-high-cons-threshold)) + (unless (bound-and-true-p gcmh-mode) + (gcmh-mode +1)) (gcmh-set-high-threshold) (setq +lsp--optimization-init-p t))))