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

From: martin rudalics <[email-masked]>
Date: Tue, 16 Sep 2008 14:50:55 +0200

> 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"

Sorry.  Please append the code below at the end of your .emacs and send
me the contents of the *face-spec-set-2* buffer after the bug occurred.

Thanks, martin.

;;;; Code starts here
(require 'cl)
(require 'faces)

(defun face-spec-set-2 (face frame spec)
   "Set the face attributes of FACE on FRAME according to SPEC."
   (with-current-buffer (get-buffer-create "*face-spec-set-2*")
     (insert
      (format "face %s frame %s spec %s" face frame spec))
     (insert "\n"))
   (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)
	   ;; Compatibility with 20.x.  Some bogus face specs seem to
	   ;; exist containing things like `:foreground nil'.
	   (if (null value) (setq value 'unspecified)))
	  (t (unless (assq attribute face-x-resources)
	       (setq attribute nil))))
	(when attribute
	  (set-face-attribute face frame attribute value)))
       (setq attrs (cdr (cdr attrs))))))
;;;; Code ends here