[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: max-specpdl-size and default font setting via Custom
From: |
Andrew Hyatt |
Subject: |
Re: max-specpdl-size and default font setting via Custom |
Date: |
22 Nov 2001 00:06:06 -0800 |
mikko.huhtala@abo.fi (Mikko Huhtala) wrote in message
news:<87e9cb21.0110300051.575377ce@posting.google.com>...
> Posted the following on gnu.emacs.help and the kind people who replied
> suspected that it may be a real bug.
>
>
> > I installed Emacs 21.1 on a Mandrake Linux 8.0 system (i586). I get
> > the "Variable binding depth exceeds max-specpdl-size" problem when I
> > set the default font to "monotype.com" using the interactive Custom
> > and evaluate the generated .emacs. The same of course happens at
> > startup. I can increase max-specpdl-size to 2000, and this will get
> > rid of the error in other lisp packages, such as vm, but the font
> > setting fails with "Lisp nesting exceeds max-lisp-eval-depth". If I
> > increase both max-specpdl-size and max-lisp-eval-depth to 9000, emacs
> > crashes trying to evaluate the font setting expression.
> >
> > The lisp in .emacs written by Custom is as follows
> >
> > (custom-set-faces
> > ;; custom-set-faces was added by Custom -- don't edit or cut/paste
> > it!
> > ;; Your init file should contain only one such instance.
> > '(default ((t (:stipple nil :background "white" :foreground "black"
> > :inverse-video nil :box nil :strike-through nil :overline nil
> > :underline nil :slant normal :weight normal :height 90 :width normal
> > :family "monotype.com")))))
> >
> > "monotype.com" is a TrueType font. It usually does get set as the
> > default font despite the error.
> >
> > Is there an infinite loop somewhere in Custom or the font handling
> > code?
>
> Mikko
I've also had the same problem on Linux. In fact, it also caused
tooltips to not work. I debugged into the problem, and it was caused
by an infinite recursion. You set the default face in face-spec-set,
which eventually sets it in internal-set-lisp-face-attribute, which
then calls face-set-after-frame-default on the current frame. That
function gets a list of all faces, and sets them all for the current
buffer. The faces include the default face, which brings us back to
face-spec-set. I believe this is a problem specifically with the
default font, and the problem probably lies in
internal-set-lisp-face-attribute. For now, I have a quick fix (an
alteration to the face-set-after-frame-default function) that I put in
my .emacs file. I just added a check so that it never processes the
default face. It fixes the problem, but probably not in the ideal
way...
(defun face-set-after-frame-default (frame)
"Set frame-local faces of FRAME from face specs and resources.
Initialize colors of certain faces from frame parameters."
(dolist (face (face-list))
(when (not (equal face 'default))
(face-spec-set face (face-user-default-spec face) frame)
(internal-merge-in-global-face face frame)
(when (and (memq window-system '(x w32 mac))
(or (not (boundp 'inhibit-default-face-x-resources))
(not (eq face 'default))))
(make-face-x-resource-internal face frame)))
;; Initialize attributes from frame parameters.
(let ((params '((foreground-color default :foreground)
(background-color default :background)
(border-color border :background)
(cursor-color cursor :background)
(scroll-bar-foreground scroll-bar :foreground)
(scroll-bar-background scroll-bar :background)
(mouse-color mouse :background))))
(dolist (param params)
(let ((frame-param (frame-parameter frame (nth 0 param)))
(face (nth 1 param))
(attr (nth 2 param)))
(when (and frame-param
;; Don't override face attributes explicitly
;; specified for new frames.
(eq (face-attribute face attr t) 'unspecified))
(set-face-attribute face frame attr frame-param)))))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: max-specpdl-size and default font setting via Custom,
Andrew Hyatt <=