From 9359a81e8103aa19dba40eff4be802ec55a38e97 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 12 Sep 2024 06:05:28 -0400 Subject: [PATCH] fix: gui frames fail to open from emacsclient This was a tricky regression to track down. 9753bfb tries to fix an issue where the `default` face's :foreground changes to `#000000` in any new frames created after the initial one (by calling `make-frame`), because those frames' `background-color` and `foreground-color` parameters default to "#000000" (possibly a bug with `disable-theme` too eagerly defaulting them to black). 240493a replaces that with new, seemingly cleaner approach: setting `frame-inherited-parameters`, which instructs `make-frame` to copy those parameters from the last open frame, however, those parameters in the initial daemon frame will be set to "unspecified-bg" or "unspecified-fg" (see the docstring for `face-{back,fore}ground`), which are invalid color strings. `make-frame` crashes tries to create a frame with those color values, causing #8059. Fix: #8059 Amend: 240493ae9235 Amend: 9753bfb775d0 --- lisp/doom-ui.el | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/lisp/doom-ui.el b/lisp/doom-ui.el index e321d6137..dbfa2064e 100644 --- a/lisp/doom-ui.el +++ b/lisp/doom-ui.el @@ -284,14 +284,6 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original (setq split-width-threshold 160 split-height-threshold nil) -;; Fix incorrect fg/bg in new frames created after the initial frame -;; (which are reroneously displayed as black). -(setq frame-inherited-parameters '(background-color - foreground-color - cursor-color - border-color - mouse-color)) - ;; ;;; Minibuffer @@ -597,7 +589,19 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original (setq doom-theme theme) (put 'doom-theme 'previous-themes (or last-themes 'none)) ;; DEPRECATED Hook into `enable-theme-functions' when we target 29 - (doom-run-hooks 'doom-load-theme-hook)))))) + (doom-run-hooks 'doom-load-theme-hook) + ;; Fix incorrect fg/bg in new frames created after the initial frame + ;; (which are reroneously displayed as black). + (pcase-dolist (`(,param ,fn ,face) + '((foreground-color face-foreground default) + (background-color face-background default) + (cursor-color face-background cursor) + (border-color face-background border) + (mouse-color face-background mouse))) + (when-let* ((color (funcall fn face nil t)) + ((stringp color)) + ((not (string-prefix-p "unspecified-" color)))) + (setf (alist-get param default-frame-alist) color)))))))) ;;