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 15:01:34 -0700	[thread overview]
Message-ID: <m21slfkon5.wl%esq@lawlist.com> (raw)

Thank you, Eli, for reading this particular thread.

I have a tab buffer-display-table entry that looks like:

[(187 . 120) (9 . 121)]

Your suggestion to use GLYPH_FACE would be more efficient than my using the C equivalent of:

(aref buffer-display-table ?\t)

... and then iterating over the vector elements looking for a cons cell containing the number 9.

I will work on incorporating GLYPH_FACE into my code, instead of using the above iteration.  Thank you for the suggestion.

Once the face id is obtained, I have been using C implementations of the following:

;;; Example assumes that 121 is a valid Lisp face id.
(let* ((tab-cons-cell (cons 9 121))
       (face (glyph-face tab-cons-cell))
       (bg-color (mc-face-attribute
                   face
                   :background
                   (selected-frame)
                   'default)))
  bg-color)

The function `glyph-face' calls the function `face-list' which is too slow.  I saw no improvement in speed when calling Fmapcar (Qcar, Vface_new_frame_defaults) from C, versus the same thing in Lisp.

In a nutshell, I am looking for that background color and trying to implement a faster way of getting the result for (mapcar #'car face-new-frame-defaults).  That need for speed is what inspired me to think about creating a new Vface_list variable and populating it inside of internal-make-lisp-face at the same time that Vface_new_frame_defaults gets populated.  [xfaces.c]  The Vface_list variable would be (when implemented correctly) identical to the result returned by the Lisp function `face-list'.

I am unaware of another way to quickly get the background color for the above-situation, but would be open to new ideas of how to achieve that goal.

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-03 22:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-03 22:01 Keith David Bershatsky [this message]
2017-11-04  8:05 ` 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-04  6:56 Keith David Bershatsky
2017-11-04  8:13 ` 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=m21slfkon5.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.