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: Zajcev Evgeny
Subject: Re: intern-soft, find-face/get-face, and facep for determining faces' definedness
Date: Wed, 03 Nov 2004 18:01:19 +0300
User-agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Reasonable Discussion, berkeley-unix)

Stefan Monnier <address@hidden> writes:

>>     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 don't understand what you mean here.  As far as I know, if (facep
>> 'foo) returns nil, then (set-face-foreground 'foo "red") will signal
>> an error, "Invalid face".  Conversely, if you define foo as face, then
>> (facep 'foo) will return t.
>
> Yes, that's what happens under Emacs.  I was talking about XEmacs,
> tho.

The thing is that XEmacsen `facep' returns non-nil only on face
objects, not on their names or anything else, however `get-face' does
all tricks - it returns face object getting face object or face name
or anything else as input.  Here is:

   (eq (get-face (get-face 'blue)) (get-face 'blue))
   => t

i.e. `get-face' behavious as 'identity if input is face object and
does some job in finding face object by its name if input is symbol
that denotes face (face's name).

Most of functions that deal with faces should use `(facep (get-face
<face>))' sexp to check face validity.

As described above I believe that `set-face-foreground' just does
`get-face' before operating on face.

-- 
lg




reply via email to

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