From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: JD Smith Newsgroups: gmane.emacs.devel Subject: Re: region-based face-remapping Date: Thu, 4 Jan 2024 19:51:46 -0500 Message-ID: References: <83y1d7zy8s.fsf@gnu.org> <3592E8C5-35FF-44FF-88ED-B458303BF15A@gmail.com> <83edeyzjgp.fsf@gnu.org> <83cyuhy483.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.300.61.1.2\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_3CB4373D-9ACD-4121-832B-73BAB3950321" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21666"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Jan 05 01:53:07 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rLYSO-0005MI-FP for ged-emacs-devel@m.gmane-mx.org; Fri, 05 Jan 2024 01:53:04 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLYRR-0003aK-Gs; Thu, 04 Jan 2024 19:52:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLYRO-0003a8-S5 for emacs-devel@gnu.org; Thu, 04 Jan 2024 19:52:03 -0500 Original-Received: from mail-qk1-x731.google.com ([2607:f8b0:4864:20::731]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLYRN-0000Z7-3J; Thu, 04 Jan 2024 19:52:02 -0500 Original-Received: by mail-qk1-x731.google.com with SMTP id af79cd13be357-781716c1291so69911585a.1; Thu, 04 Jan 2024 16:51:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704415918; x=1705020718; darn=gnu.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=KNr/HV5xIhO9g5ex3APM3pDbr+VdAVgf/P7hgzUAX9g=; b=KC6oaxOXfDhNhGi8OGk13I9dMtolNVcsnYULOCn3z8KppK9Nq6hDNsZRoqoZa2fFAb jx8LPUfUGEQ/Z17TBpWhmhuvzvijsR33yjl07L0VkVguy/MSjpk96HOSOWSPzkJ7Q1pI f+x0CP3CrR9Aaugy22iJw5CXYRwLr0YOBuZGk8+GEJCjzwT5ttgCWx2eOQP+cpxWApCt KJbZ+TBg3Ous/t4kmSbF50BivtzhT6wVGfU2gYRatv9lHrcqVqYouw25kexVnwU4q0JI yYU69O+jGbr2d6xsnP1glSce+FtBEFaRCyaYrhhMolQxD/cIDYv87CSgPK1+PLIDN3qL xy9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704415918; x=1705020718; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KNr/HV5xIhO9g5ex3APM3pDbr+VdAVgf/P7hgzUAX9g=; b=HO4vQn7TsxIQieGYKg4RZCzJHzghh3AAxopbr5612unsVtqaerEc6TzyI8wqgV5K0N 8abuLjocPjMLxLqbGqpFWkcR0fhHw5nKSP0Z4BqfYTMuT7gAnRMuHo9yfsa1NAHaaFZj 1Fj49z0pS+Iz2Xyov+UeyrsC84MGfu0R1psHrXFSLf39TY22IAEylhUdocBIDSlnByRZ VCvxzb6vPaXbGQ8HM8RFhnkBAreyJXN+eK6m0M+jF014S4t6E3ichlJw/+iUYGySzpOh qK5CDi/UO65MaxMCJOwg/5/ZOZUQINW3neByOsZOwva0Y00OusCNPaZskiFnXuIGVq3U 7NDw== X-Gm-Message-State: AOJu0YyfQ02E4T6K6m7oQcfnegl/fyJnB/nsLpctGd4TpsspDORJjIgj D9RjYmQQJJYZCBXWrk5QANXDAwLTz8fiwA== X-Google-Smtp-Source: AGHT+IEXM8HYF1iam0rYc7ilwrev03VENJMsXHWjxu53Crzjv4GHJKYVx9i9DLECO+vog9eDwSsAVw== X-Received: by 2002:a05:620a:1195:b0:781:3819:bba with SMTP id b21-20020a05620a119500b0078138190bbamr1497302qkk.43.1704415917772; Thu, 04 Jan 2024 16:51:57 -0800 (PST) Original-Received: from smtpclient.apple (cm-24-53-187-34.buckeyecom.net. [24.53.187.34]) by smtp.gmail.com with ESMTPSA id u2-20020a05620a022200b00781e18fd580sm197571qkm.89.2024.01.04.16.51.56 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Jan 2024 16:51:56 -0800 (PST) In-Reply-To: <83cyuhy483.fsf@gnu.org> X-Mailer: Apple Mail (2.3774.300.61.1.2) Received-SPF: pass client-ip=2607:f8b0:4864:20::731; envelope-from=jdtsmith@gmail.com; helo=mail-qk1-x731.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:314548 Archived-At: --Apple-Mail=_3CB4373D-9ACD-4121-832B-73BAB3950321 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jan 4, 2024, at 1:58=E2=80=AFAM, Eli Zaretskii = wrote: >=20 > It is called where the 'face' property changes. The display engine > finds the next position where that happens, and arranges for calling > face_at_buffer_position when it gets to process that position. The > results of face merging at that position are kept in a cache, to avoid > performing it more often than needed. This makes sense, thanks. In the =E2=80=98face-remap property scenario, = the number of such =E2=80=98face property-change positions doesn=E2=80=99t= actually change. But at each such position, the face-merging code = would have to check for an operative =E2=80=98face-remap property at = point and use it together with `face-remapping-alist' to compute the = final face merge. I would expect that performance would depend on = whether the face-merge cache could be (largely) preserved, even as = 'face-remap properties are added/removed/moved around (typically in = repetitive fashion). >> I do this very thing already in indent-bars[1], globally in the = buffer, using face-remapping-alist. The performance of that remapping = is incredibly good in my experience. So fast in fact that I=E2=80=99ve = had to introduce a timer to artificially slow it down since it leads to = rapid face flashing during smooth scrolling. >=20 > How many faces do you have defined on that frame? I'm guessing not > many, or maybe they are all almost identical (differ in only one or > two simple attributes). Right now it=E2=80=99s just a couple of faces (remove one face-remap, = add another). If I had access to a =E2=80=98face-remap property, I = could imagine maybe 10 faces at most being affected as point changes. = Each face would change by one or two attributes like foreground, = stipple, etc. =20 I=E2=80=99m sure there could be lots of uses of this type of = functionality, but =E2=80=9Cenhance the focus on one region of = importance=E2=80=9D seems like a very common one. For example, you = might imagine dim/gray version of all the font-lock faces outside the = =E2=80=9Ctreesitter region of interest=E2=80=9D and bright ones inside. = Whenever that TS-prescribed region changes, an overlay with a = =E2=80=98face-remap property gets moved. =20= --Apple-Mail=_3CB4373D-9ACD-4121-832B-73BAB3950321 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On Jan 4, 2024, at 1:58=E2=80=AFAM, Eli Zaretskii = <eliz@gnu.org> wrote:

It is called where the 'face' property changes.  The = display engine
finds the next position where that happens, and arranges for = calling
face_at_buffer_position when it gets to process that position. =  The
results of face merging at that position are kept in a cache, to = avoid
performing it more often than = needed.

This makes sense, = thanks.  In the =E2=80=98face-remap property scenario, the number = of such =E2=80=98face property-change positions doesn=E2=80=99t actually = change.  But at each such position, the face-merging code would = have to check for an operative =E2=80=98face-remap property at point and = use it together with `face-remapping-alist' to compute the final face = merge. I would expect that performance would depend on whether the = face-merge cache could be (largely) preserved, even as 'face-remap = properties are added/removed/moved around (typically in repetitive = fashion).

I do this very thing already in indent-bars[1], = globally in the buffer, using face-remapping-alist.  The = performance of that remapping is incredibly good in my experience. =  So fast in fact that I=E2=80=99ve had to introduce a timer to = artificially slow it down since it leads to rapid face flashing during = smooth scrolling.

How = many faces do you have defined on that frame?  I'm guessing = not
many, or maybe they are = all almost identical (differ in only one or
two simple = attributes).

Right now = it=E2=80=99s just a couple of faces (remove one face-remap, add = another).  If I had access to a =E2=80=98face-remap property, I = could imagine maybe 10 faces at most being affected as point changes. =  Each face would change by one or two attributes like foreground, = stipple, etc.  

I=E2=80=99m sure there = could be lots of uses of this type of functionality, but =E2=80=9Cenhance = the focus on one region of importance=E2=80=9D seems like a very common = one.  For example, you might imagine dim/gray version of all the = font-lock faces outside the =E2=80=9Ctreesitter region of interest=E2=80=9D= and bright ones inside.  Whenever that TS-prescribed region = changes, an overlay with a =E2=80=98face-remap property gets moved. =  
= --Apple-Mail=_3CB4373D-9ACD-4121-832B-73BAB3950321--