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: Fri, 03 Nov 2017 23:56:53 -0700

It has been a long day, but I wanted to give you an update on my findings thus 
far this evening before turning off the computer.

There is no good reason (that I can see) why the Lisp function glyph-face 
should be using face-list.  Instead, the Lisp function glyph-face should be 
mapping through face-new-frame-defaults and comparing the car of each element 
to the face-id.  Using that new method of just checking the car of 
face-new-frame-defaults works sufficiently quickly in C (as far as I can tell). 
 So the need for speed appears to be resolved in my early tests tonight.

The problem with an invalid lisp object happens after manually calling 
eval-defun on a defface when the background has been changed by the user.  In 
that situation, the face-id changes.  However, the buffer-display-table does 
NOT update to reflect the new face id.  In my situation, the original face had 
an id of 121.  After changing the background color (with eval-defun on a 
defface), the face id changed from 121 to 1196.

So we cannot rely on the buffer-display-table cons cell with the glyph code for 
a tab face after calling eval-defun, because it still has the number 121.

So, the question is how to get the correct new face id number, which in this 
case changed from 121 to 1196 after calling eval-defun.  I have only just begun 
to experiment with GLYPH_FACE to try and extract the face-id for a tab that is 
assigned a face in the buffer-display-table.  The first attempt ended up 
returning a face-id of 0 which is wrong, so I need to see why I got the default 
face instead of 121 or 1196.  I will work on this again over the weekend.

Keith

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

DATE:  [11-03-2017 03:17:05] <03 Nov 2017 12:17:05 +0200>
FROM:  Eli Zaretskii <address@hidden>
> 
> > Date: Thu, 02 Nov 2017 20:50:47 -0700
> > From: Keith David Bershatsky <address@hidden>
> > 
> > In implementing feature requests crosshairs (17684) and multiple fake 
> > cursors (22873), I thought it would be nifty to identify the background 
> > color (if applicable) associated with a tab ('\t') glyph code in the 
> > buffer-display-table.  In doing so, I discovered that the Lisp function 
> > face-list is way too slow.  Even after I ported the face-list function over 
> > to C, it was still way too slow.  So, I tried my luck at adding a new 
> > variable in xfaces.c for the face-list and am setting it from within the 
> > function internal-make-lisp-face, like so:
> 
> I don't understand why you need face-list for this.  For each glyph in
> the display table, you get its face ID by using the GLYPH_FACE macro.
> Why isn't that sufficient for your needs?



reply via email to

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