intern-soft, find-face/get-face, and facep for determining faces' definedness
Stephen J. Turnbull
stephen at xemacs.org
Tue Nov 2 07:06:56 EST 2004
>>>>> "Miles" == Miles Bader <miles at lsi.nec.co.jp> writes:
Miles> To be reasonably compatible with Xemacs, it would be
Miles> necessary to know what exactly a face-object (such as
Miles> returned by `find-face') is useful for, and I don't.
As an optimization. You can avoid a table lookup if you have the
object. We also have truly anonymous temporary faces, which get
garbage collected simply by dropping them on the floor, as they never
get entered into any tables. Another optimization; I guess you could
use gensyms and key-weak hash tables to get the same effect nowadays.
Offhand I'd guess the other APIs (ie, except for `facep) all accept
either a face name or a face object.
The only tricky thing about find-face is that it needs to be
(Assert (null (find-face (find-face [nope])))) ; not a symbol
(Assert (null (find-face (find-face nil)))) ; a special non-face symbol
(Assert (null (find-face (find-face (gensym))))) ; a non-face symbol
(Assert (eq (find-face 'default) (find-face (find-face 'default))))
I think that gives full coverage. Your definition of find-face should
be fine, except possibly for XEmacs APIs Emacs doesn't have.
Institute of Policy and Planning Sciences http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
Ask not how you can "do" free software business;
ask what your business can "do for" free software.
More information about the XEmacs-Beta