fix: reset inhibit-* vars a mote more aggressively
There are still a few edge cases where inhibit-redisplay is never reset (usually involving errors at startup), leaving Emacs as a blank screen until the user performs an action that forces it to redraw (e.g. pressing M-x). This tries to address more of those.
This commit is contained in:
parent
e66a863e07
commit
dc035a652f
2 changed files with 20 additions and 26 deletions
|
@ -537,7 +537,6 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
|||
(nreverse new-specs)))
|
||||
(put face 'face-modified nil))
|
||||
('error
|
||||
(ignore-errors (doom--reset-inhibited-vars-h))
|
||||
(if (string-prefix-p "Font not available" (error-message-string e))
|
||||
(signal 'doom-font-error (list (font-get (cdr map) :family)))
|
||||
(signal (car e) (cdr e))))))
|
||||
|
|
45
lisp/doom.el
45
lisp/doom.el
|
@ -475,10 +475,9 @@ users).")
|
|||
;; garbled after startup (or in case of an startup error).
|
||||
(defun doom--reset-inhibited-vars-h ()
|
||||
(setq-default inhibit-redisplay nil
|
||||
;; Inhibiting `message' only prevents redraws and
|
||||
inhibit-message nil)
|
||||
(redraw-frame))
|
||||
(add-hook 'after-init-hook #'doom--reset-inhibited-vars-h)
|
||||
(remove-hook 'post-command-hook #'doom--reset-inhibited-vars-h))
|
||||
(add-hook 'post-command-hook #'doom--reset-inhibited-vars-h -100)
|
||||
|
||||
;; PERF: Doom disables the UI elements by default, so that there's less for
|
||||
;; the frame to initialize. However, `tool-bar-setup' is still called and
|
||||
|
@ -497,29 +496,25 @@ users).")
|
|||
(put 'site-run-file 'initial-value site-run-file)
|
||||
(setq site-run-file nil)
|
||||
|
||||
(define-advice startup--load-user-init-file (:around (fn &rest args) undo-hacks)
|
||||
(define-advice startup--load-user-init-file (:around (fn &rest args) undo-hacks 95)
|
||||
"Undo Doom's startup optimizations to prep for the user's session."
|
||||
(let (init)
|
||||
(unwind-protect
|
||||
(progn
|
||||
(when (setq site-run-file (get 'site-run-file 'initial-value))
|
||||
(let ((inhibit-startup-screen inhibit-startup-screen))
|
||||
(letf! ((defun load-file (file) (load file nil 'nomessage))
|
||||
(defun load (file &optional noerror _nomessage &rest args)
|
||||
(apply load file noerror t args)))
|
||||
(load site-run-file t t))))
|
||||
(apply fn args) ; start up as normal
|
||||
(setq init t))
|
||||
(when (or (not init) init-file-had-error)
|
||||
;; If we don't undo our inhibit-{message,redisplay} and there's an
|
||||
;; error, we'll see nothing but a blank Emacs frame.
|
||||
(doom--reset-inhibited-vars-h))
|
||||
;; COMPAT: Once startup is sufficiently complete, undo our earlier
|
||||
;; optimizations to reduce the scope of potential edge cases.
|
||||
(advice-remove #'tool-bar-setup #'ignore)
|
||||
(add-transient-hook! 'tool-bar-mode (tool-bar-setup))
|
||||
(unless (default-toplevel-value 'mode-line-format)
|
||||
(setq-default mode-line-format (get 'mode-line-format 'initial-value))))))
|
||||
(unwind-protect
|
||||
(progn
|
||||
(when (setq site-run-file (get 'site-run-file 'initial-value))
|
||||
(let ((inhibit-startup-screen inhibit-startup-screen))
|
||||
(letf! ((defun load-file (file) (load file nil 'nomessage))
|
||||
(defun load (file &optional noerror _nomessage &rest args)
|
||||
(apply load file noerror t args)))
|
||||
(load site-run-file t t))))
|
||||
(apply fn args))
|
||||
;; Now it's safe to be verbose.
|
||||
(setq-default inhibit-message nil)
|
||||
;; COMPAT: Once startup is sufficiently complete, undo our earlier
|
||||
;; optimizations to reduce the scope of potential edge cases.
|
||||
(advice-remove #'tool-bar-setup #'ignore)
|
||||
(add-transient-hook! 'tool-bar-mode (tool-bar-setup))
|
||||
(unless (default-toplevel-value 'mode-line-format)
|
||||
(setq-default mode-line-format (get 'mode-line-format 'initial-value)))))
|
||||
|
||||
;; PERF: Unset a non-trivial list of command line options that aren't
|
||||
;; relevant to this session, but `command-line-1' still processes.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue