all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: intern-soft, find-face/get-face, and facep for determiningfaces' definedness
@ 2004-11-06  3:36 Ben Wing
  0 siblings, 0 replies; only message in thread
From: Ben Wing @ 2004-11-06  3:36 UTC (permalink / raw)
  Cc: 'Jamie Zawinski', emacs-devel

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
jwz's part.

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-11-06  3:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-06  3:36 intern-soft, find-face/get-face, and facep for determiningfaces' definedness Ben Wing

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.