Subject: Re: bug#911: 23.0.60; custom-set-faces causes "New Frame" to fail (max-specpdl-size)

From: Ian Miller <[email-masked]>
Date: Tue, 16 Sep 2008 13:11:49 +0100

On Sun, Sep 14, 2008 at 03:50:05PM +0200, martin rudalics wrote:
> Ian,
>
> I can't reproduce this here.  Could your try to edebug the functions
> `face-spec-set-2' and `face-spec-recalc' to find out why (or better how)
> in the trace
>
> >  >   face-spec-set-2(default #<frame emacs@baso 0x10107a0> ((t :stipple
> > nil :background "#ffffff" :foreground "#000000" :inverse-video nil :box
> > nil :strike-through nil :overline nil :underline nil :slant normal
> > :weight normal :height 90 :width normal :foundry "unknown" :family
> > "DejaVu Sans Mono")))
> >  >   face-spec-recalc(default #<frame emacs@baso 0x10107a0>)
> [...]
> >  >   face-spec-set-2(default #<frame emacs@baso 0x10107a0> ((t (:stipple
> > nil :background "DarkSlateGray" :foreground "wheat" :inverse-video nil
> > :box nil :strike-through nil :overline nil :underline nil :slant normal
> > :weight normal :height 121 :width normal :foundry "unknown" :family
> > "DejaVu Sans Mono"))))
> >  >   face-spec-recalc(default #<frame emacs@baso 0x10107a0>)
>
> the function `face-spec-set-2' is called alternately with different
> backgrounds.  That is, edebug these two functions, call C-x 5 2 or
> whatever you have to make a new frame, and tell me whether

Martin,

When I tried to instrument those two functions, there was no problem
with face-spec-recalc, but face-spec-set-2 refused to instrument
with the following complaint:

edebug-syntax-error: Invalid read syntax: "Expected lambda expression"

(defun face-spec-set-2 (face frame spec)
  "Set the face attributes of FACE on FRAME according to SPEC."
  (let* ((attrs (face-spec-choose spec frame)))
    (while attrs
      (let ((attribute (car attrs))
          (value (car (cdr attrs))))
	  ;; Support some old-style attribute names and values.
	  (case attribute
	    (:bold (setq attribute :weight value (if value 'bold
  'normal)))
    (:italic (setq attribute :slant value (if value 'italic 'normal)))
      ((:foreground :background)
       ^
       this is the cursor marking the syntax error    

> (1) `face-spec-recalc' in one and the same call invokes
>     `face-spec-set-2' at least twice (where an invocation should cause
>     `face-spec-set-2' to really call `set-face-attributes'), or
>
> (2) `face-spec-recalc' is called at least twice when making a new frame.

When I edebug face-spec-recalc and attempt to create a new frame, each
time I press 'T' to Trace Fast the function appears to be re-entered,
and this appears to go on indefinitely?

Additionally a frame *is* created now, but it does not appear
automatically on the screen - however, it can be accessed via the
Buffers->Frames menu, and it does not use the colour scheme specified
in .emacs.

Also, when edebug reaches face-spec-recalc, I get the following
console message with each subsequent step of edebug (sorry, I don't
know if this is relevant, I am a complete novice when it comes to
emacs debugging!): 

(emacs:21944): Gtk-CRITICAL **: gtk_box_pack_start: assertion
`child->parent ==NULL' failed

cheers,
ian