From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: region-based face-remapping Date: Sun, 7 Jan 2024 05:41:15 +0200 Message-ID: <6ff6edea-5d4b-4eaa-ac0b-4c9e5fe3a4ff@gutov.dev> References: <83y1d7zy8s.fsf@gnu.org> <3592E8C5-35FF-44FF-88ED-B458303BF15A@gmail.com> <83edeyzjgp.fsf@gnu.org> <83cyuhy483.fsf@gnu.org> <837ckow5st.fsf@gnu.org> <8B06B532-A445-43AE-883D-C9E5CF5DB870@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="866"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: emacs-devel@gnu.org To: JD Smith , Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jan 07 04:42:19 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 1rMK3G-000AZf-Bi for ged-emacs-devel@m.gmane-mx.org; Sun, 07 Jan 2024 04:42:19 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rMK2O-0004N4-TT; Sat, 06 Jan 2024 22:41:24 -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 1rMK2M-0004Mh-SH for emacs-devel@gnu.org; Sat, 06 Jan 2024 22:41:22 -0500 Original-Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rMK2K-0004Ga-KY; Sat, 06 Jan 2024 22:41:22 -0500 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 989D35C00B2; Sat, 6 Jan 2024 22:41:17 -0500 (EST) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Sat, 06 Jan 2024 22:41:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1704598877; x=1704685277; bh=JOC3bW9p3KZ760YbXK07QX+kFJyz/MFuh1h2O7jB+XE=; b= i5i6O+6ce0yirPsPaZSmjZayzUzZwrde/r87V8C9lIyfdcfEFVHuqelvuc8fiebm P7xuyCkupSUJYyuBIcig0YfnhydTVq3DOgi2sdjgVXFOFn0iDr8CrmKMTkVNAM5M FeDLyvRDVHAPzTE1R/QPmVbMQSvY9wptbUN9ydrJShZ/5cpd6hJYM2yC6M9wRIb8 nc0I8vioDJxh6WyTJEFkeS+/7QYLVoJcFLIQUuQBY3JlfGshmqrRMrYauKpAIlN3 3Rkzr8eqdaawGxBxuF1NpMOkZUuU8ZBbKd2yaXiJXAJPm63NcS7x5mkUkA5NNgTk fG9IhJAp0DTthKloDxYfcQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1704598877; x= 1704685277; bh=JOC3bW9p3KZ760YbXK07QX+kFJyz/MFuh1h2O7jB+XE=; b=y j5al0syEmbwUNOYoHZ3oA+NEuOhPiKcCJtrIlw4euDkkU1muWU2rHP8EN7JOE2GF 2bwSv8V4QnM/EuXyS5isz06ph97w3iZdR8WxAUTCcTanLYAQFRLNKUbZVNo/dqYG Q6VtT29Gdob3R/Er8oByi4XLx/k3v5CNsewLh+tNqtvKMZEYgm2zo2eWKZ6ds91J cTF5RRn6yJWrCaILPc477rh2JZ71GQHMiLzwwtS5uW0ASqlOXGKTHtqkvtpmDKxr oDzIJEIY9CcV8TZmFZfH/+tMlyQAtHJWNJYcGmeB0n+PEw85NX/JWsjLSJF2qfsB E6eno9MWO1fcnexHJV7IA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdehvddgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtvdejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepgeelfeetkefghfdvhfdtgeevveevteetgeetveegtedthefhudekteehffeu keeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 6 Jan 2024 22:41:16 -0500 (EST) Content-Language: en-US In-Reply-To: <8B06B532-A445-43AE-883D-C9E5CF5DB870@gmail.com> Received-SPF: pass client-ip=66.111.4.27; envelope-from=dmitry@gutov.dev; helo=out3-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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:314660 Archived-At: On 06/01/2024 15:53, JD Smith wrote: > In the world of CSS, you’d do this quite simply by (say) updating the > class of the div which wraps your text of interest, and having special > styling for, e.g., "alternate bold" and "alternate italic”, which is > only activated when the “alternate” class is applied: > >
> > This is some italic text and some bold text.  This > is unrelated text. > >
> > > In CSS > > .alternate b {...} > .alternate i {…} > > (In JS later:) > >  myDiv.classList.add('alternate'); If we were to try to emulate CSS's nesting capability, perhaps we would add some new attributes which would alter the existing ones (using relative values). E.g. :background-relative and :foreground-relative, which could be used to lighten or darken the colors provided by the :background and :foreground attributes. The -relative ones could come from a separate face, but the question would be how to make sure to apply it - it would have to be the last rule in font-lock rules, to avoid forcing all other rules to use :override. Or, I don't know, if would need to be applied some other way at the end of font-lock. Main thing, it wouldn't work off an overlay. Or a different spin, for better theme-ability: some declarative forms which allow to specify resulting attributes (colors, etc) for combinations of faces. I.e. if two faces are present together, the foreground and background should be this and that. The limitation is also like the above. But to be able to set these faces through an overlay, or even a text property but without worrying about the application order vis-a-vis font-lock, it would probably need to be a new property. Not sure if we'd also need some new entities in its values, rather than regular faces. Maybe the new property would specify one or several new values which would correspond to new conditions in the DISPLAY form of face definitions. But that would make defface forms incompatible with older emacsen, I guess, and it's not certain whether it would be easy enough to use for a third-party package author anyway.