emacs-devel
[Top][All Lists]
Advanced

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

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


From: Keith David Bershatsky
Subject: Adding new variable for face-list in internal-make-lisp-face.
Date: 2017年11月02日 20:50:47 -0700

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:
 Vface_list = Fcons (face, Vface_list);
and, it is done within the same section where we already have:
 Vface_new_frame_defaults = Fcons (Fcons (face, global_lface),
 Vface_new_frame_defaults);
Accessing the tab face in the face-list variable works just fine UNTIL I 
manually `eval-defun` on the `defface` for the tab face to change its 
background color. Thereafter, when I try to get information about that tab 
face in the face-list from within xdisp.c, I get:
Error during redisplay: (my-custom-face-attribute #<EMACS BUG: INVALID DATATYPE 
(MISC 0xc9ff) Save your buffers immediately and please report this bug> 
:background [frame information] default) signaled (error "Invalid face" #<EMACS 
BUG: INVALID DATATYPE (MISC 0xc9ff) Save your buffers immediately and please 
report this bug>)
Here is the gdb breakpoint information when I try to access that face (in the 
face-list variable) after manually changing the background color with 
eval-defun -- I get INVALID_LISP_OBJECT:
Breakpoint 3, Fmc_face_attribute (face=..., attribute=..., frame=..., 
 inherit=...) at xdisp.c:1119
1119 Lisp_Object value = Finternal_get_lisp_face_attribute (face, 
attribute, frame);
(gdb) pp face
#<INVALID_LISP_OBJECT 0x10013c199>
How can I properly implement a new face-list variable so that the lisp object 
will be valid after manually running `eval-defun` on a defface?
Thanks,
Keith

reply via email to

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

AltStyle によって変換されたページ (->オリジナル) /