emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding new variable for face-list in internal-make-lisp-face.


From: Keith David Bershatsky
Subject: Re: Adding new variable for face-list in internal-make-lisp-face.
Date: Sat, 04 Nov 2017 10:46:17 -0700

What a wonderful treat it was to check my emails this morning and find the 
ingredients to properly calculating faces and its components!  :)

I ran into one little `emacs_abort` snag this morning while trying the 
following two test snippets, which came about when I changed the face 
background with `face-remap-add-relative` on a face that had been previously 
defined with `defface`.

Should I run a pre-test for all 15 cases in lookup_basic_face to see if it 
would throw an `emacs_abort`, and then *only* call lookup_basic_face if success 
is guaranteed?

Alternatively, perhaps using it.face_id obviates the need to use 
lookup_basic_face?

TEST SNIPPETS:

  struct face *tab_face = FACE_FROM_ID (f, lookup_basic_face (f, it.face_id));
  Lisp_Object tab_bg = tab_face->lface[LFACE_BACKGROUND_INDEX];
  AUTO_STRING (my_string_one, "IT background:  %s");
  CALLN (Fmessage, my_string_one, tab_bg);

#ifdef GLYPH_DEBUG
  debug_method_add (w, "face_id: %d", it.face_id);
#endif


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

DATE:  [11-04-2017 01:13:33] <04 Nov 2017 10:13:33 +0200>
FROM:  Eli Zaretskii <address@hidden>
> 
> * * *
> 
> Face IDs are ephemeral, because Emacs frees all faces and realizes
> them anew from time to time, when it thinks the previous definitions
> might be invalid.  E.g., when the attributes of the default face
> change, all the faces need to be recomputed, because many of them
> inherit from the default face.
> 
> So if you use the face ID, you need to recompute it each time you need
> it.  You cannot compute it once and then reuse the same value, because
> sooner or later it will become invalid.
> 
> * * *
> 
> See next_element_from_display_vector for how the faces of glyphs from
> a display table are used to display those glyphs.  And because of what
> I said above, once you have the face ID, you need to use lookup_*_face
> functions to get the face corresponding to that ID.

> * * *
> 
> I believe I already explained how to get the fore- and back-ground
> colors of a face given its ID in my message Re: Can we use FRAME_RIF
> to return a Lisp_Object result?  I think you should use the same
> technique here.



reply via email to

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