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: Stephen J. Turnbull
Subject: Re: intern-soft, find-face/get-face, and facep for determining faces' definedness
Date: Tue, 02 Nov 2004 21:06:56 +0900
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.5 (chayote, linux)

>>>>> "Miles" == Miles Bader <address@hidden> 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
idempotent:

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




reply via email to

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