From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Cl=c3=a9ment_Pit-Claudel?= Newsgroups: gmane.emacs.devel Subject: Re: Question: add-face-text-property for 'font-lock-face? Date: Sun, 29 Aug 2021 12:15:58 -0400 Message-ID: <5cf80cca-828a-614c-9cb4-d478a04c05f5@gmail.com> References: <83a6l0n32e.fsf@gnu.org> <3272782D-2308-447C-B94B-A65E561C4D18@MIT.EDU> <835yvon11g.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1071"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Aug 29 18:16:43 2021 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 1mKNUB-000AcZ-BA for ged-emacs-devel@m.gmane-mx.org; Sun, 29 Aug 2021 18:16:43 +0200 Original-Received: from localhost ([::1]:54492 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mKNU9-0003E2-B7 for ged-emacs-devel@m.gmane-mx.org; Sun, 29 Aug 2021 12:16:41 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37740) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKNTW-0002XN-92 for emacs-devel@gnu.org; Sun, 29 Aug 2021 12:16:02 -0400 Original-Received: from mail-qk1-x732.google.com ([2607:f8b0:4864:20::732]:40703) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mKNTU-0007zx-U3 for emacs-devel@gnu.org; Sun, 29 Aug 2021 12:16:02 -0400 Original-Received: by mail-qk1-x732.google.com with SMTP id t190so12977571qke.7 for ; Sun, 29 Aug 2021 09:16:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=GNPgkJSFC5pB8MVv1m+23D8n+svqz6Xt915iRCbhCkk=; b=LcaCe3w0Xtr5uu9bJP4HQiwyh2iOb62jFEEvv9YkEWd57dX2TMb0ooUDxjeXiz1py8 nTWHRoIzO0pVpLPzY+5JmUfPciHqLYhfT2NPKn11j04qdn9xrf3KiJUIJq7GT0Ngn/P9 ctn9YEIEgYugMLpOEJ7F9NOBx6WhJ66yRUIcF2DVCWSL/A8gQE7MhbKWXWBoc6jjfZ7E XBuY+ltqNnZoAmJrpbt2+kL0DA2tgKXe94/Kc5/miX7hQxRrqMKuEoQWVHtRQKb6pVHo SPEQnB0LYBHbWu+15j7sxcGM9PhN2NP1pcZioH3Ck1aVFsmoL4wY9YlKHND1KerWcl6T RyuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=GNPgkJSFC5pB8MVv1m+23D8n+svqz6Xt915iRCbhCkk=; b=tD1smIgPbRCrm2yml5kJ0E/s64dGngx08DDNj+kpye4FeyGXPq4DXO28F52DPzDnu4 DsPttR6/p2r5tBpKlzbIrN9XklmFoBkgN/d3lOe2hjRIHZJ2aE9JwIpPAM3KiSyzTOx2 i4rqoa2CC02LJsYgOc9SKgo2iI1g/a1NRp68twr7uMFFuSNXLTLZFBIEfiypr3hxZV2b tX0noLzZ09nXqAxE3cYHzZxKILkLpyYRL1x/2BSWKXDPGjmAtSnNrAjlR4sSLFcotxod Xdo9JITDmIARLIJi5y/rSxiNfHpCccAthddAfM4HIDcd+s60EovFyuFZIKTxd4q46yZ/ tGNg== X-Gm-Message-State: AOAM530EcxUnVwdQ7b+ZCFNKKgXMxnddjod590p6d/cjBw2CvriomAuh t9YtEVBZHnmPbV1sprLRAks9YT7qozw= X-Google-Smtp-Source: ABdhPJym/it561CO88UERYJ0RRgqF+yhC+izFFCljFtTBagbtl6hsznWITPHPacac0YeC+v4zmff9g== X-Received: by 2002:a05:620a:159a:: with SMTP id d26mr18590210qkk.399.1630253759813; Sun, 29 Aug 2021 09:15:59 -0700 (PDT) Original-Received: from [192.168.1.15] (c-24-61-240-80.hsd1.ma.comcast.net. [24.61.240.80]) by smtp.googlemail.com with ESMTPSA id c2sm6999997qte.22.2021.08.29.09.15.59 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 29 Aug 2021 09:15:59 -0700 (PDT) In-Reply-To: <835yvon11g.fsf@gnu.org> Content-Language: en-GB Received-SPF: pass client-ip=2607:f8b0:4864:20::732; envelope-from=cpitclaudel@gmail.com; helo=mail-qk1-x732.google.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 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, NICE_REPLY_A=-0.58, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.io gmane.emacs.devel:273421 Archived-At: On 8/29/21 3:49 AM, Eli Zaretskii wrote: >> From: Qiantan Hong >> CC: "emacs-devel@gnu.org" >> Date: Sun, 29 Aug 2021 07:19:03 +0000 >> >> I need to add some face attribute to a range of text. >> And in case that font-lock-mode is active, the attribute needs to be >> added to ‘font-lock-face instead of ‘face text property. >> >>> I don't think I understand well enough what you want to do, but in >>> general, you change a face's attribute by using set-face-attribute. >> That doesn’t seem to work for anonymous faces. >> I don’t want to globally modify other modes’ faces, >> I want to add some attribute over some range of text. >> >> add-face-text-property seems to exactly do this, >> but it’s hardcoded for ‘face property in C code > A face property is just a list of keyword-value pairs, so adding an > attribute to the list should be trivial, no? Or what am I missing? You still need to iterate over regions of continuous text properties; it's not a complicated program, but it's not trivial either. (Qiantan is hoping to preserve existing font-lock faces and append the CRDT.el face to them, AFAIU; so, it's a bit more work than appending to one list: you need to iterate over the region of interest, and append to each list of faces). And if I understand correctly, then font-lock-append-text-property should fit the bill nicely.