From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: region-based face-remapping Date: Thu, 04 Jan 2024 09:05:48 +0200 Message-ID: <83bka1y3w3.fsf@gnu.org> References: <83y1d7zy8s.fsf@gnu.org> <3592E8C5-35FF-44FF-88ED-B458303BF15A@gmail.com> <83edeyzjgp.fsf@gnu.org> <83y1d6y1n4.fsf@gnu.org> <3ce1e4f9-7f94-4d55-a614-a4c2c3ad6c27@gutov.dev> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28902"; mail-complaints-to="usenet@ciao.gmane.io" Cc: jdtsmith@gmail.com, emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jan 04 08:06:59 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 1rLHoh-0007H8-HD for ged-emacs-devel@m.gmane-mx.org; Thu, 04 Jan 2024 08:06:59 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLHo1-0007MA-CJ; Thu, 04 Jan 2024 02:06:17 -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 1rLHns-0007Lr-4c for emacs-devel@gnu.org; Thu, 04 Jan 2024 02:06:08 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLHnr-0000Wg-Rb; Thu, 04 Jan 2024 02:06:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=9YlbzQPJu3Qg+wUCEcUlJhwfnx8GquD+20OPMHZ8ERw=; b=OdRQEA3c/9vg 6T89rWvJe/y2EAtvphaPHST7i+GUAI7fM0lLp8s3SbqQi4Skn64EOFVaeSMiYR1/wsBY19NheR2/Q 9XYECR7L98ZZtal7Vlx5fQpPiSEBXmGK7Rm54eGdpoeXaONNew49m+/RGyOwSJSV+oqSQY8b9rdsf dBXc9c5CICDsFccvdPjZyJqWs5HYQELIBWiTmSewEKKTFA2l7z/b8CVvO7EdDEyVmSc79ViaHTq7/ FLx81hj76kpSaZGaN5rheHOaLX6RbUSg6ly8ERPWEBhHDUfMZ94jO6q18FDI9I92of8hPbyqn6X6V loisydfgBPoZZFi07saWZQ==; In-Reply-To: <3ce1e4f9-7f94-4d55-a614-a4c2c3ad6c27@gutov.dev> (message from Dmitry Gutov on Thu, 4 Jan 2024 02:07:36 +0200) 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:314525 Archived-At: > Date: Thu, 4 Jan 2024 02:07:36 +0200 > Cc: jdtsmith@gmail.com, emacs-devel@gnu.org > From: Dmitry Gutov > > On 03/01/2024 15:42, Eli Zaretskii wrote: > >> Date: Wed, 3 Jan 2024 14:40:49 +0200 > >> Cc:emacs-devel@gnu.org > >> From: Dmitry Gutov > >> > >> On 03/01/2024 14:31, Eli Zaretskii wrote: > >>> The workhorse we use now for obtaining face information is the > >>> function face_at_buffer_position, which calls the various face-merging > >>> routines. Those merging routines and their subroutines consider > >>> face-remapping-alist as part of face merging process outlined above. > >>> I don't see how we can avoid passing the buffer position to them if > >>> face-remapping depends on buffer position. > >> Perhaps face_at_buffer_position would first look up the overlay/text > >> property 'face-remapping-alist, then merge its value with the variable > >> face-remapping-alist (using plain 'append', for example), and pass on > >> the resulting value to the face-merging routines? > > Then any code running while face_at_buffer_position does its job will > > see a tweaked value of face-remapping-alist, which is not necessarily > > TRT, since it is not guaranteed that the buffer position being > > examined by face_at_buffer_position is relevant to the rest of the > > code. > > I'm not sure I understand your response. > > IIUC the request is that one would be able to change the faces' > appearances at any position in the buffer using a mechanism like > additional text properties or overlay properties. > > It seems to reason that any code computing the 'face' for a buffer > position would need to account for the new property if it's set at that > position. AFAIU, you suggested to temporarily tweak the value of face-remapping-alist when face_at_buffer_position is called for a position where the new proposed property defines a "local" remapping. Is that right? If so, imagine the following scenario: . face_at_buffer_position is called and tweaks face-remapping-alist . one of the subroutines of face_at_buffer_position calls some Lisp hook . that Lisp hook calls code that calls face-font (or some other primitive which takes face-remapping-alist into account) In this scenario, primitives called in this way will see the tweaked value of face-remapping-alist, which is specific to the buffer position passed to face_at_buffer_position, whereas the code which calls those primitives doesn't expect to be affected by such position-local face remapping (for example, because it is interested in some face in some other position). Did I clarify my concern?