From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Keith David Bershatsky Newsgroups: gmane.emacs.devel Subject: Re: Adding new variable for face-list in internal-make-lisp-face. Date: Fri, 03 Nov 2017 15:01:34 -0700 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Trace: blaine.gmane.org 1509746542 7173 195.159.176.226 (3 Nov 2017 22:02:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 3 Nov 2017 22:02:22 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 03 23:02:18 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eAk2Z-0001Np-Uc for ged-emacs-devel@m.gmane.org; Fri, 03 Nov 2017 23:02:16 +0100 Original-Received: from localhost ([::1]:38590 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eAk2h-0000AA-6c for ged-emacs-devel@m.gmane.org; Fri, 03 Nov 2017 18:02:23 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36931) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eAk23-0000A4-Om for emacs-devel@gnu.org; Fri, 03 Nov 2017 18:01:44 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eAk1y-0003oA-TA for emacs-devel@gnu.org; Fri, 03 Nov 2017 18:01:43 -0400 Original-Received: from gateway30.websitewelcome.com ([192.185.148.2]:21061) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eAk1y-0003mW-Ji for emacs-devel@gnu.org; Fri, 03 Nov 2017 18:01:38 -0400 Original-Received: from cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway30.websitewelcome.com (Postfix) with ESMTP id 528875C40 for ; Fri, 3 Nov 2017 17:01:37 -0500 (CDT) Original-Received: from gator3053.hostgator.com ([50.87.144.69]) by cmsmtp with SMTP id Ak1wecaQNDL8rAk1xeRgrq; Fri, 03 Nov 2017 17:01:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lawlist.com ; s=default; h=Content-Type:MIME-Version:Subject:Cc:To:From:Message-ID:Date: Sender:Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=aYNxOJaPLtwLetclN1BTdJf+F36SOonS6FLI+KEeDzA=; b=WYx1sHNvpl8DwNX4aNYUJjhlz0 TOynx6ApF7/KzVeWAPcVwu5OVgugWOa/DYAvt5SDoQJpya+AzIbmw9BJAICrS78D6gKx+lXBISseg HfMcmZ5U0odivp4wV1+mftpC5yuQ/n16FclnBn3FKvkoGukHe4xFVZyCpV9yXK3jPv6iikpACpBbM ZDvQupkXplDgIyc8djY+3Fv0Ep+yTlXP9kr34JZAL6KxqmLL8r/68ct0sP1VuFjm5C8A+7oh5xuBY yIchx4gMrrdb7Ul12KbxDQ/LQ8fxDX1sBehduye14EQEnY4pQRdhC4H1ViDymuuQgrsL7SC5Oy0pd gmtBNgzw==; Original-Received: from [107.72.98.72] (port=30888 helo=mb.local) by gator3053.hostgator.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.87) (envelope-from ) id 1eAk1w-001lpr-AO; Fri, 03 Nov 2017 17:01:36 -0500 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3053.hostgator.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lawlist.com X-BWhitelist: no X-Source-IP: 107.72.98.72 X-Source-L: No X-Exim-ID: 1eAk1w-001lpr-AO X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (mb.local) [107.72.98.72]:30888 X-Source-Auth: lawlist X-Email-Count: 1 X-Source-Cap: bGF3bGlzdDtsYXdsaXN0O2dhdG9yMzA1My5ob3N0Z2F0b3IuY29t X-Local-Domain: yes X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 192.185.148.2 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:219907 Archived-At: 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 > > > Date: Thu, 02 Nov 2017 20:50:47 -0700 > > From: Keith David Bershatsky > > > > 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?