From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Filippo Argiolas Newsgroups: gmane.emacs.devel Subject: Foreground color opacity Date: Mon, 11 Sep 2023 12:45:04 +0200 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35750"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Sep 11 12:46:35 2023 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 1qfeR8-00097L-TY for ged-emacs-devel@m.gmane-mx.org; Mon, 11 Sep 2023 12:46:34 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qfeQA-0001fB-Ap; Mon, 11 Sep 2023 06:45:34 -0400 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 1qfeQ2-0001Vh-0X for emacs-devel@gnu.org; Mon, 11 Sep 2023 06:45:26 -0400 Original-Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qfePw-0007Dj-3Z for emacs-devel@gnu.org; Mon, 11 Sep 2023 06:45:25 -0400 Original-Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-5657add1073so2806998a12.0 for ; Mon, 11 Sep 2023 03:45:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694429116; x=1695033916; darn=gnu.org; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=q5F6U5vVi5q/ExKw/qyGHPOrKH6QyUNu5Q+ixWqe1qk=; b=cyue6jKgVlbEIvSIibgkeIMCeadFYES73WEduwwoyetDwLYPb0Phx2jvv7QngkQnD4 +YeP/Ucd6GgL/GdSAot7Y3+xKVl2+xHf+xs9399bv8ComL9kWT89yzldM8x92cm61Wle Ca30mQH64Y42XA+Mug16FZ9tV1wZQOdBOll1EnJX3zlDulKocnFHBFm2MIb8pQaYZLZk eu9lm5vdb0QxpP2PmZlFdN6/4jl7yx37rt6e16HQe0T/vv+4Z3qyXU0pxD7dRPFtGytI P/CUd6pq0T/Vz3lp4pbSKkOqneX42W05ihkEfYdJ+xwhWZq5bkDgy9+7aArWOchNGNnZ qT+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694429116; x=1695033916; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=q5F6U5vVi5q/ExKw/qyGHPOrKH6QyUNu5Q+ixWqe1qk=; b=roLntDi2MRA5I9beLN7SnDhLNfqLp8mcoDD2WLMyxIWFd32f7Dvd6V2bu6Ls2dhNIq lZtxKF0DHPswlfrshKHMy1J3ZxmpAlyndchxZ/SjtUiCd+QlNyPelyN38Roh4Mgr8Hmi mLiW7cNCTKc1OKFxHQzXXcGtMe/XMdAoFZOW4cl3DJ5xO1MAnFZm6cMtQTp5sZQSGdka AoqYBf0L5Z5V6epjIcwWAzFRLWiV9Ubisk0kUujssCIZMyl6vwnju8rymG1VF/pRDhBG c2yzTepx3nNvZF9r6Vp3ABWkovYbOY1b9VODS+v490tEhQKjsSSAI5+WmGIlfJAHs2f3 UxHw== X-Gm-Message-State: AOJu0Yz/ECp9PZKljKLT+gy2kz+UwvmP5WbuClWhm8Tu4UezubMALrLe 9PH0n8wN2WBhqzMP8sluDUbsvgvJkNe2/T2DiFKmNhva2wM= X-Google-Smtp-Source: AGHT+IED0BPLDnBQNS5MbJvMnwLSZOG1/hDV7faOo8u+HgFsmryUlTuwCQYaWH09qCnskGLQJ1oBjts11wkb1aVOm6o= X-Received: by 2002:a17:90b:1c0f:b0:271:78a0:8ab2 with SMTP id oc15-20020a17090b1c0f00b0027178a08ab2mr14986626pjb.24.1694429115782; Mon, 11 Sep 2023 03:45:15 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::535; envelope-from=filippo.argiolas@gmail.com; helo=mail-pg1-x535.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, 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.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:310460 Archived-At: After the discussion in bug#65418 (Eglot: support clangd inactiveRegions extension) I wrote a little package starting from Jo=C3=A3o example code about extending Eglot. It's little more than an experiment at this point, you can find it at: https://github.com/fargiolas/clangd-inactive-regions Long story short clangd introduced a protocol extension in version 17 that signals inactive code (e.g. code under ifdefs) to the editor with a server notification. Eglot can be easily extended to listen to these notification and highlight inactive code. The initial idea was to just use `shadow' face to render inactive code. But in my opinion a much better solution is to render inactive code as semi-transparent so that it blends with the background but still gets syntax highlighting. See the screenshot in github for an example, other editors have similar UIs for inactive code regions. My approach so far has been something like this: - label inactive regions with a dedicated text property - add a function that runs after fontify-lock-fontify-region-function (after so we run when we have fortified text with font lock faces) - inside the fontify function detect face changes in the inactive region and for each different face encountered apply a new one with foreground color computed blending current foreground and background It seems to work so far and I like the result, but I keep thinking it's overly complicated for something so simple as setting text opacity. I'm pretty new to emacs lisp, am I missing a face attribute I can just set in an overlay and get the same result? Wouldn't it make sense to have something like this at backend level if it doesn't exist yet? Thanks, Filippo