[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: intern-soft, find-face/get-face, and facep for determiningfaces' def
Re: intern-soft, find-face/get-face, and facep for determiningfaces' definedness
Fri, 5 Nov 2004 21:36:48 -0600
You are right about the philosophical convictions.
At least that's why facep only works on face objects, because that's how
common lisp works.
The exposure of face objects goes back to lemacs, probably with temporary
(anonymous) faces in mind.
Same for font/color objects. This was clearly a philosophical choice on
Many other objects were since exposed by me by analogy, although it may be
questionable. Certainly exposing consoles was questionable [even their
existence is questionable -- when I first wrote things, they didn't exist,
but then I got berated from mly, and was not smart enough to ignore him].
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
I doubt the motivation was optimization. I think it had more to do with
> 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)
(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.
|[Prev in Thread]
||[Next in Thread]|
- Re: intern-soft, find-face/get-face, and facep for determiningfaces' definedness,
Ben Wing <=