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: Eli Zaretskii
Subject: Re: Adding new variable for face-list in internal-make-lisp-face.
Date: Sat, 04 Nov 2017 20:16:52 +0200

> Date:  Sat, 04 Nov 2017 10:46:17 -0700
> From:  Keith David Bershatsky <address@hidden>
> Cc:  address@hidden
> 
> 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);

You only need to call lookup_basic_face if it.face_id is a basic face
AND face-remapping-alist is non-nil.  If it.face_id is not a basic
face, lookup_basic_face will abort, and you should call lookup_face
instead.  For a remapped non-basic face you will have to look up
face-remapping-alist manually and then use lookup_named_face.



reply via email to

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