unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Keith David Bershatsky <esq@lawlist.com>
Cc: emacs-devel@gnu.org
Subject: Re: Adding new variable for face-list in internal-make-lisp-face.
Date: Sat, 04 Nov 2017 10:13:33 +0200	[thread overview]
Message-ID: <834lqav4uq.fsf@gnu.org> (raw)
In-Reply-To: <m2mv42h6q2.wl%esq@lawlist.com> (message from Keith David Bershatsky on Fri, 03 Nov 2017 23:56:53 -0700)

> Date:  Fri, 03 Nov 2017 23:56:53 -0700
> From:  Keith David Bershatsky <esq@lawlist.com>
> Cc:  emacs-devel@gnu.org
> 
> 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.

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.

> 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.

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.



  reply	other threads:[~2017-11-04  8:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-04  6:56 Adding new variable for face-list in internal-make-lisp-face Keith David Bershatsky
2017-11-04  8:13 ` Eli Zaretskii [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-11-04 17:46 Keith David Bershatsky
2017-11-04 18:16 ` Eli Zaretskii
2017-11-03 22:01 Keith David Bershatsky
2017-11-04  8:05 ` Eli Zaretskii
2017-11-03  3:50 Keith David Bershatsky
2017-11-03 10:17 ` 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=834lqav4uq.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=esq@lawlist.com \
    /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).