Subject: Re: bug#32736: bug#34715: bug#32736: 26; Bind `C-x 5 2' to `clone-frame' by default

From: Lars Ingebrigtsen <[email-masked]>
Date: Thu, 02 Sep 2021 09:44:24 +0200

Eli Zaretskii <[email-masked]> writes:

>> The following is the minimal case for reproduction here:
>> 
>> (let ((default-frame-alist
>>         '((background-color . "red"))))
>>   (make-frame))
>> 
>> This reliably makes all the faces go AWOL on the new frame.  (It doesn't
>> matter what the colour is.)
>
> Shouldn't we copy the parameters alist?  Maybe even deep-copy?

Do you mean in this particular test case or in `clone-frame'?  If it's
the latter, the list we get is fresh (but not very deep).

If it's this particular test case, then I don't understand what you mean.

> And faces are supposed to be frame-local, so maybe faces also need to
> be copied?  Otherwise, you are basically manipulating faces that don't
> "belong" to the frame, no?  And likewise with frame's parameters
> alist, I think.

Anyway, debugging further shows that the problem seems to be in
`frame-set-background-mode', but I've yet to isolate what exactly is
triggering the bug.

	    (dolist (face (face-list))
	      (and (not (get face 'face-override-spec))
[...]

                         (face-spec-match-p face
                                            (face-user-default-spec face)
                                            frame)))
		   (push face locally-modified-faces)))
	    ;; Now change to the new frame parameters
	    (modify-frame-parameters frame params)
	    ;; For all unmodified named faces, choose face specs
	    ;; matching the new frame parameters.
	    (dolist (face (face-list))
	      (unless (memq face locally-modified-faces)
		(face-spec-recalc face frame)))))))))

The face-spec-recalc messes up the face...  but so does the call to
face-spec-match-p, apparently?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no