all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Keith David Bershatsky <esq@lawlist.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Adding new variable for face-list in internal-make-lisp-face.
Date: Fri, 03 Nov 2017 23:56:53 -0700	[thread overview]
Message-ID: <m2mv42h6q2.wl%esq@lawlist.com> (raw)

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 <eliz@gnu.org>
> 
> > Date: Thu, 02 Nov 2017 20:50:47 -0700
> > From: Keith David Bershatsky <esq@lawlist.com>
> > 
> > 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	other threads:[~2017-11-04  6:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-04  6:56 Keith David Bershatsky [this message]
2017-11-04  8:13 ` Adding new variable for face-list in internal-make-lisp-face Eli Zaretskii
  -- 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

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

  git send-email \
    --in-reply-to=m2mv42h6q2.wl%esq@lawlist.com \
    --to=esq@lawlist.com \
    --cc=eliz@gnu.org \
    --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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.