Move delayed-warnings deferral to core.el

Possibly addresses #319
This commit is contained in:
Henrik Lissner 2018-01-03 12:51:09 -05:00
parent 8e7b822062
commit 9f884bf998
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 8 additions and 6 deletions

View file

@ -146,6 +146,10 @@ ability to invoke the debugger in debug mode."
;;; ;;;
;; Initialize ;; Initialize
(eval-and-compile (eval-and-compile
;; Defer warnings during the Doom startup process, giving other modules more
;; time to initialize and make mistakes.
(remove-hook 'delayed-warnings-hook #'display-delayed-warnings)
(defvar doom--file-name-handler-alist file-name-handler-alist) (defvar doom--file-name-handler-alist file-name-handler-alist)
(unless (or after-init-time noninteractive) (unless (or after-init-time noninteractive)
;; One of the contributors to long startup times is the garbage collector, ;; One of the contributors to long startup times is the garbage collector,
@ -184,6 +188,9 @@ ability to invoke the debugger in debug mode."
(dolist (hook '(doom-init-hook doom-post-init-hook)) (dolist (hook '(doom-init-hook doom-post-init-hook))
(run-hook-wrapped hook #'doom-try-run-hook hook))) (run-hook-wrapped hook #'doom-try-run-hook hook)))
;; We're ready to display warnings now.
(add-hook 'delayed-warnings-hook #'display-delayed-warnings t)
;; If you forget to reset this, you'll get stuttering and random freezes! ;; If you forget to reset this, you'll get stuttering and random freezes!
(setq gc-cons-threshold 16777216 (setq gc-cons-threshold 16777216
gc-cons-percentage 0.1 gc-cons-percentage 0.1

View file

@ -74,10 +74,6 @@ Ensures the scratch (or dashboard) buffers are CDed into the project's root."
(advice-remove #'doom-buffer-list #'+workspace-buffer-list))) (advice-remove #'doom-buffer-list #'+workspace-buffer-list)))
(add-hook 'persp-mode-hook #'+workspaces|on-persp-mode) (add-hook 'persp-mode-hook #'+workspaces|on-persp-mode)
;; Defer delayed warnings even further, so they appear after persp-mode is
;; started and the main workspace is ready to display them. Otherwise, warning
;; buffers will be hidden on startup.
(remove-hook 'delayed-warnings-hook #'display-delayed-warnings)
(defun +workspaces|init (&optional frame) (defun +workspaces|init (&optional frame)
(unless persp-mode (unless persp-mode
(persp-mode +1) (persp-mode +1)
@ -95,8 +91,7 @@ Ensures the scratch (or dashboard) buffers are CDed into the project's root."
;; Switch to it if we aren't auto-loading the last session ;; Switch to it if we aren't auto-loading the last session
(when (and (equal (safe-persp-name (get-current-persp)) persp-nil-name) (when (and (equal (safe-persp-name (get-current-persp)) persp-nil-name)
(= persp-auto-resume-time -1)) (= persp-auto-resume-time -1))
(persp-frame-switch +workspaces-main frame))) (persp-frame-switch +workspaces-main frame)))))
(add-hook 'delayed-warnings-hook #'display-delayed-warnings t)))
(defun +workspaces*auto-add-buffer (buffer &rest _) (defun +workspaces*auto-add-buffer (buffer &rest _)
"Auto-associate buffers with perspectives upon opening them. "Auto-associate buffers with perspectives upon opening them.