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: 240493ae92
Amend: 9753bfb775
This commit is contained in:
Henrik Lissner 2024-09-12 06:05:28 -04:00
parent be422c4516
commit 9359a81e81
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -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))))))))
;;