From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.bugs Subject: bug#75291: Redisplay not updating fringe when face filter changes Date: Thu, 02 Jan 2025 13:36:34 -0500 Message-ID: <87ttah2hcd.fsf@dancol.org> References: <874j2h3yzb.fsf@dancol.org> <8634i1jeai.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9474"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.12.8; emacs 31.0.50 Cc: 75291@debbugs.gnu.org, Michal Nazarewicz To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 02 19:37:35 2025 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1tTQ4a-0002Ey-Ti for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 02 Jan 2025 19:37:33 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tTQ4P-0004gT-LM; Thu, 02 Jan 2025 13:37:21 -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 1tTQ49-0004YU-SF for bug-gnu-emacs@gnu.org; Thu, 02 Jan 2025 13:37:10 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tTQ47-0001S8-Ax for bug-gnu-emacs@gnu.org; Thu, 02 Jan 2025 13:37:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=PCkIHZZpAl66jaDNkZWMHvEsMJXXuRqv55qyfAV8nHU=; b=TbXr6GImEMHfvlt5MIgUHxEI0o2kowA3QkNSvNfz82Rkr6dj0NEciZtCvYcacfe2mtPRvEUJ7yKTGMmIio2d77apuBNMkxp+GcIL4NJBJNejJrsr40G4UhSO3TXZatph87jc/KSWCOltq0xlLF/OofkkorOFVYIq4Rlcl+zQ5OUUF1zRAIMCWEg9xJBRz5gH4zXI69mYdL/7Hu5rJeN3xNCrCllibXadLHVg+fUEAGG8be58pL9ngsrFaK+Z7G/SQfUiC1/J1Q6b959YIHNbW+QmN4mxNOcwhbm96ed6kkH1bV2D9GLHZ4YukXeqxqj+stwkStGMaNnxhyOH89/Cpg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tTQ47-0008WS-5X for bug-gnu-emacs@gnu.org; Thu, 02 Jan 2025 13:37:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Colascione Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 02 Jan 2025 18:37:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75291 X-GNU-PR-Package: emacs Original-Received: via spool by 75291-submit@debbugs.gnu.org id=B75291.173584300332706 (code B ref 75291); Thu, 02 Jan 2025 18:37:03 +0000 Original-Received: (at 75291) by debbugs.gnu.org; 2 Jan 2025 18:36:43 +0000 Original-Received: from localhost ([127.0.0.1]:46619 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tTQ3m-0008VS-UA for submit@debbugs.gnu.org; Thu, 02 Jan 2025 13:36:43 -0500 Original-Received: from dancol.org ([2600:3c01:e000:3d8::1]:39780) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tTQ3k-0008VF-77 for 75291@debbugs.gnu.org; Thu, 02 Jan 2025 13:36:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=PCkIHZZpAl66jaDNkZWMHvEsMJXXuRqv55qyfAV8nHU=; b=FCXlAs02/NpOD4+roTT7q4E9IT OY+u9ASxxdzPIPFBMJBLaRbrTFTKjV/rdWtYYuH0raHY49pSYDu1RSMW0Oa/aQvA+StyQuMQpYY8i yX+KMQD91Pjg+klNBlWbcpFZ7a9x9LcwtYmxvWqYbaTA1pjMx/FUYzfsfN4FQPjqkY4CbD1AlmJo1 9QLM7aBykIv1FhM47ny69WRvLou9/k6eDxHDeYJ/pT2PcT6X64a4nMxsFPAy6hVBBuLfFVVZ44X5f 0UFUvc+lHcVhI45ePfW3j6EJX3RTLSDmVfiUanvTVgdVadw4c1Cotej2nmV2JMy7LMSXDOJbNApZN T27aQo8A==; Original-Received: from 2603-9001-4203-1ab2-bd9e-ad89-4d97-f163.inf6.spectrum.com ([2603:9001:4203:1ab2:bd9e:ad89:4d97:f163]:50962 helo=localhost) by dancol.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tTQ3g-0001Ef-1D; Thu, 02 Jan 2025 13:36:36 -0500 In-Reply-To: <8634i1jeai.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 02 Jan 2025 19:50:29 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:298215 Archived-At: Eli Zaretskii writes: >> From: Daniel Colascione >> Date: Thu, 02 Jan 2025 12:30:16 -0500 >> >> Sometimes we don't redraw when its effective face changes indirectly due >> to a face filter condition evaluating differently. >> >> An explicit redraw-display works around the problem, but it shouldn't be >> necessary and is an efficiency hit. >> >> See the code below: >> >> ;; -*- lexical-binding: t -*- >> >> ;; emacs -Q >> >> (setf my-window (selected-window)) >> >> (dolist (face '(default fringe)) >> (face-remap-add-relative >> face `(:filtered (:window foo t) (:background "green")))) >> >> (set-window-parameter my-window 'foo t) >> >> ;; During this sit-for, background and fringe should be green >> (sit-for 1) >> (set-window-parameter my-window 'foo nil) >> >> ;; Enable to work around bug >> (when nil >> (redraw-display)) >> >> ;; During this sit-for, background and fringe should be their original >> ;; color (probably white), but only the background changes. >> ;; Without redraw-display, the fringe remains green. >> (sit-for 1) > > I think this is bug#74876 again. I tried to explain there why the way > the fringe drawing is implemented doesn't work well with > face-remapping (or with changes in the fringe face in general). > > Maybe I'm missing something, but supporting what this and that bug > want would need a rewrite of update_window_fringes (and possibly also > the way we record fringes' attributes in the glyph row). That's amazing. Seven years ago, I implemented https://github.com/dcolascione/emacs-window-highlight/blob/master/window-highlight.el. I worked around the bug we're discussing using redraw-display. I see that Michal (++) implemented the same feature independently and reported the same bug just a few weeks before I got around to reporting the same bug from seven years ago! Pure serendipity. (BTW: my code uses pre-redisplay-function, not a command hook. I've tried it both ways and found the redisplay hook to be more reliable.) Anyway, given that the feature has been implemented twice now, maybe we can find some way to make it work efficiently? I haven't looked into how exactly we do fringe invalidation, but isn't there a way we can limit the blast radius of the redraw by providing a lisp-level function to invalidate extra GUI parts of specific windows rather than forcing a redraw-frame? It's not clear to me why we couldn't skip redrawing every row's content but redraw every row's fringe anyway. Ideally, a change to a face in which the change couldn't possibly affect layout (e.g. changing a background color) would be pretty efficient from a redisplay POV, since we wouldn't have to even try to reflow any text.