emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: intern-soft, find-face/get-face, and facep for determining faces' de


From: Stefan
Subject: Re: intern-soft, find-face/get-face, and facep for determining faces' definedness
Date: Tue, 02 Nov 2004 07:01:49 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (darwin)

Miles> What's a "face object" in Emacs?
> A symbol, I should think.  I was confused by the fact that `facep'
> returns a vector of length 17 whose first element is the symbol 'face.
> However, I would guess that that's a useless artifact of the
> implementation, since (facep (facep 'bold)) is nil.

I've never seen the vector used in Elisp for anything, so yes: it's just
a useless (and arguably ugly) artifact of the implementation.

Miles> [Indeed, what's a "face object" in Xemacs?]

> A C structure wrapped in Lisp housekeeping information that implements
> a face.  I'm not sure why they were exposed to Lisp in the first
> place; I suspect to avoid repeated lookups in code that compares faces
> to determine if they contrast and the like.  Probably a premature
> optimization.

I doubt the motivation was optimization.  I think it had more to do with
philosophical convictions.

> A face name is a symbol.  A face object is a data structure.

I still don't understand why (facep 'foo) returns nil, even though

   (put-text-property (point) (+ 10 (point)) 'face 'foo)
and
   (set-face-foreground 'foo "red")

work just fine.  I think `facep' should return non-nil iff the parameter can
be used at those places where faces are expected, so it should return
non-nil for symbols (assuming the symbol is indeed the name of an existing
face, of course).
Just like (progn (fset 'foobar (make-keymap)) (keymapp 'foobar)) return
t rather than nil.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]