From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michal Nazarewicz Newsgroups: gmane.emacs.devel Subject: Re: [RFC] Add :invisible face attribute Date: Wed, 18 Dec 2024 19:05:45 +0100 Message-ID: <78ygdhfoffedn7p69uwz1oy8@mina86.com> References: <20241218160813.31108-1-mina86@mina86.com> <867c7xlyqp.fsf@gnu.org> 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="20240"; 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 Wed Dec 18 19: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 1tNyRn-00058V-7v for ged-emacs-devel@m.gmane-mx.org; Wed, 18 Dec 2024 19: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 1tNyQv-0005Km-Ls; Wed, 18 Dec 2024 13:06: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 1tNyQk-0005Jg-Ne for emacs-devel@gnu.org; Wed, 18 Dec 2024 13:05:59 -0500 Original-Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tNyQi-00064H-K3; Wed, 18 Dec 2024 13:05:54 -0500 Original-Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-aa679ad4265so176969766b.0; Wed, 18 Dec 2024 10:05:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734545148; x=1735149948; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:face :references:in-reply-to:subject:cc:to:from:sender:from:to:cc:subject :date:message-id:reply-to; bh=7ShnmuW8jEi6Nmi3YTRw8V9Iu0MaS1RqshhZXDTe4Uc=; b=YK580s0Tfp9GaKL6eixjdLNE3X3SIRhKX9L6JIz9Uma2bhIjY62Y81xoIVFhu7mIgu g0qmvCr9/GchFp8vFrK7niHvXrpalXKHByfFbTdlTQIclR1X3MplLtkq1zG4dM2kKGE0 2cwUcTptBuYu4abyoy625GwW9YzkfI/zB+l6A73bytLJfbNvDlJeM8fj1faBz68OcwYF i/xSuC7CyPZw3DB63hZZe4oaHfm5YsMRedAgh1Wxp8EZqpT2UhCs+WoMrvNg78vS6naM keyDly//sJFEVHTOIepujg0FMOYKFtohfqOj2MicNtcE6UX8XmJKtGn1xnPg0wDwqpWM 8QLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734545148; x=1735149948; h=content-transfer-encoding:mime-version:message-id:date:face :references:in-reply-to:subject:cc:to:from:sender:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=7ShnmuW8jEi6Nmi3YTRw8V9Iu0MaS1RqshhZXDTe4Uc=; b=GKBA01CUsk2kn524K/dcIO9duX65SKWz96v+9f3PmD/5WBBJwoVqNitHijgczdFmkx jKo9lHanjBVVzNG1VubYXrFDxnx2r9c6AJYTPhdhQxVvotdjAIU6f6hcPtLCI2PqQ01U pBqterSnSApWjc0qO8Ucbp3N4vvuuD2fgw7HzW3oqOmkLnNKLPXAFw0OJqYe3PeQ4dOw m+YyyezAzIX9DCfaABN9VblXWS7RyUl1yglrdedc0TirzUSM+Z0mWPlMnOdn4S9WpNKr U6Bh5I63IKLVYpKAs9V9v4Iw7hpvR1GzqRSiYNe3sfng8e2GDV4xPUGh/M7MpmMqGvAk Nvog== X-Gm-Message-State: AOJu0Ywh49PdiZIQ8/7CS3ZLTnHi+CNlWwZuxI3nxzRB+L4MRAMdvfPa juvh+yStIfnErg+qCnoJ9BltjIxOAG3Ux9BHnM6hLwfnmfKTh8XGu/PAmQ== X-Gm-Gg: ASbGnct9fqUmXsPkUEl1ETHQqiI3gs7mWUADbR71e0kZqrMWoYFS5eJO7AaEUibOqmb J1cRzMPOpYOY442tukY+nZrp97WHbBvyF3K+CEdiett4zi5LeJfzLyisqudn2jhkcgFp2EK+4m/ PKFEtbG6xc2JzqSqETyVKCL5j9dc2d1yI2HD6T8pZ4DeNQPmH2IqOR9c4CQzeQKPo6TXIgagukt e8DTESLAlGDMjWtQxtfzcv2I8DXqdI6h+krz50mRZrgjmzaDhfg+y30ZBJRXJYEvyKT7XVUsNaO oje6hQ== X-Google-Smtp-Source: AGHT+IFHgaB6ovHJohw18CD/LxHyZFRllvkvTq005MU+MdvanoGqebKd1V6/fQv6mk4F+UfqA5i1Ag== X-Received: by 2002:a17:907:c0b:b0:aa6:9229:352a with SMTP id a640c23a62f3a-aac0826ecfbmr15315666b.26.1734545147593; Wed, 18 Dec 2024 10:05:47 -0800 (PST) Original-Received: from erwin (87-205-2-211.static.ip.netia.com.pl. [87.205.2.211]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5d652f25ae5sm5837273a12.57.2024.12.18.10.05.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 10:05:47 -0800 (PST) In-Reply-To: <867c7xlyqp.fsf@gnu.org> Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEWjgIPUupJ7V0jLrom4gmjPs42bY0MdFRLHgE5UPDCbfGm9mH6qmkAJAAACNUlEQVQ4y23SMW/aQBQHcKtb2Zx0abZeIxuTCSELJVmiinboRpGHJktloROQzUQcB2vUXFe35XBYUicRAiYUVSjfru/d+QwlnDz5p/97z+dnVcw5WVQ2zxpcdrQTTiIin3bB6lcaTnaBO5c8eoJG2yBl5El+Ob3fglMW3RUIkQ9xxQ8UBEFQafiVZ/5wZqWExM+LvwEegAY856xZO7MgQkq3jxpO56GXxO5VDQAjpVmWqPLYoSGvIahIuvAVHLeEEDd9DRYAkUcKzscAUgCQ0hwSKBOExuh7kvQQUskY4yjsHqeaCfFjLK6x1AzeeyiRD/C1JW5aGqw5IS5mZre+FVz0RVtoUGPJmBCP/4QPJGKUA1oEMJwAHIv+JljYZYCJi1FRQS2DaUw6sgsQTMfb0Fz9RvjyP3iR01x9RGj0N6HgcefS819CSjidDwIFPSFEDgRg1tUw2oBXAB33T2DV63XbM6AqhZzysm3ZcKZrKBAn5O7Q1rAqGoBKNGRsmUG1n0NKaJtd2RnscTWvnom6fGngDaNrCNl728A+c2gLQP8PFpkEjNWjlGqQfPEhWRqoInSyi2p+drsGDjhAeAeSQI8kfjSwbwCn8gblvIftInzT30HdQT2HlU4gwCbLSQ7VFqVEA0RCtjTwtnjdLlkasNjQwF7x02F2iQSL8XIGB8 VQ71WBKHHf5XCIgLUUtIcGSBPhdZIQorpEBrxsqT3GYgRpmicIqrsEgSZm3FG+iJbHYid0/wGj+iTGCXRsqQAAAABJRU5ErkJggg== Received-SPF: pass client-ip=2a00:1450:4864:20::62d; envelope-from=mnazarewicz@gmail.com; helo=mail-ej1-x62d.google.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, MSGID_RANDY=2.599, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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:326680 Archived-At: On Wed, Dec 18 2024, Eli Zaretskii wrote: > A new face attribute adds quite a bit of complexity, so we should > really believe this is a good idea. Given that this can already be > achieved without a new attribute, I'm not sure. Is this really a > frequent need/situation? Yes, agreed. org-hide is the only face I=E2=80=99m aware of and this only = came up as I was working on auto-dim-other-buffers. To quickly recap, auto-dim-other-buffers adds a face remap to default face which changes its background. The problem is that if default background is changed, text rendered with org-hide becomes visible. So now I also need to remap org-hide. This by itself I could live with, but it creates friction for users who need to not only customise auto-dim-other-buffers-face (which specifies the remap background) but also auto-dim-other-buffers-hide-face. There are actually two minor bugs in Org mode that this patch fixes. First is when default face is changed after org-mode is initialised: (setq org-hide-leading-stars t) (org-mode) (insert "\n*** Foo\n") ; the first two stars are invisible (set-face-background 'default "red") ; the starts become visible Second is when running with frames on multiple displays, e.g. starting org-mode on terminal frame with black background makes org-hide use black foreground. But that=E2=80=99s visible on X11 frame which uses white background. This is why I=E2=80=99ve not gone with Org=E2=80=99s way of initialising th= e hide face when the mode is first enabled. >> @@ -2911,6 +2925,13 @@ merge_face_ref (struct window *w, >> else >> err =3D true; >> } >> + else if (EQ (keyword, QCinvisible)) >> + { >> + if (EQ (value, Qt) || NILP (value)) >> + to[LFACE_INVISIBLE_INDEX] =3D value; >> + else >> + err =3D true; >> + } > Does this mean that the result of merging two faces with different > values for :invisible will depend on the order of the merge? That is, > does the nil value override the t value? Or am I missing something? The behaviour is the same as for other boolean attributes, e.g. extend or inverse-video, so yes, if the attribute is specified multiple times one overrides the other. There=E2=80=99s a related difference in how org-hide works now vs with this patch. Currently, selecting text which uses org-hide makes the text visible; with this patch it remains invisible unless region face is changed to include :invisible nil. > Btw, I think "invisible" is not the best name for this, because that's > not really what will happen on display. It's more like "illegible" or > something to that effect. Not sure I=E2=80=99m a fan of illegible but I=E2=80=99m happy to go with wh= atever name. By the way, two other ideas I had were: a) add another value for :inverse-video (e.g. =E2=80=98:inverse-video 'foreground=E2=80=99 makes foreground same as background) or b) add a pseudo colour so one could write =E2=80=98:foreground "background"= =E2=80=99. --=20 Best regards =E3=83=9F=E3=83=8F=E3=82=A6 =E2=80=9C=F0=9D=93=B6=F0=9D=93=B2=F0=9D=93=B7= =F0=9D=93=AA86=E2=80=9D =E3=83=8A=E3=82=B6=E3=83=AC=E3=83=B4=E3=82=A4=E3=83= =84 =C2=ABIf at first you don=E2=80=99t succeed, give up skydiving=C2=BB