unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Keith David Bershatsky <esq@lawlist.com>
To: Emacs Devel <emacs-devel@gnu.org>
Subject: Adding new variable for face-list in internal-make-lisp-face.
Date: Thu, 02 Nov 2017 20:50:47 -0700	[thread overview]
Message-ID: <m2h8ucm354.wl%esq@lawlist.com> (raw)

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	other threads:[~2017-11-03  3:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-03  3:50 Keith David Bershatsky [this message]
2017-11-03 10:17 ` Adding new variable for face-list in internal-make-lisp-face Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2017-11-03 22:01 Keith David Bershatsky
2017-11-04  8:05 ` Eli Zaretskii
2017-11-04  6:56 Keith David Bershatsky
2017-11-04  8:13 ` Eli Zaretskii
2017-11-04 17:46 Keith David Bershatsky
2017-11-04 18:16 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2h8ucm354.wl%esq@lawlist.com \
    --to=esq@lawlist.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).