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: Fri, 03 Jan 2025 12:25:05 -0500 Message-ID: <87ldvrajym.fsf@dancol.org> References: <874j2h3yzb.fsf@dancol.org> <8634i1jeai.fsf@gnu.org> <87ttah2hcd.fsf@dancol.org> <86v7uxhv9c.fsf@gnu.org> <87ikqx2dwh.fsf@dancol.org> <86h66hhr3a.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="30539"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.12.8; emacs 31.0.50 Cc: 75291@debbugs.gnu.org, mina86@mina86.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 03 18:26:24 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 1tTlRG-0007gP-4K for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 03 Jan 2025 18:26:22 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tTlR5-0001cr-EW; Fri, 03 Jan 2025 12:26:11 -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 1tTlQw-0001Yk-Lz for bug-gnu-emacs@gnu.org; Fri, 03 Jan 2025 12:26:03 -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 1tTlQw-00022M-DO for bug-gnu-emacs@gnu.org; Fri, 03 Jan 2025 12:26:02 -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=DSJhAYxvE9sFDAYqTHeNvLweqeKb7pUXOHqKzA8ymnQ=; b=rB+NsgAiWJuSGmKRX2bYlMNrVvKuzrPwwtblVFMU9JbHkjv4V/ZsIFejfQzkUKKqZEhYAZ6abvVY0zYp7HF3itVhSV0hcfTNQ2NNMfLVBW8ZMUsLLRRTaj58sZM8sx9o24UYqXL5K8kJJA4c3ER7RRrcguhn5CLdTnkDk/saB/n5LiEPCL3FriAABwD89GYHs5fdj8/LwE9NMJ1yHU4Nks1nh5baJdvDudhjKzlVdn3F5X6K7Srdx0bx6KEE5PbfKtWR/5EoPOI2jT2C9wpWujpVuT/HoyGKKm1kYYZjXvuR4nmVhj5PUmPfNDCYvM7bn9NZHWFOt4CT+Odq4wGp+Q==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tTlQw-0004I0-1w for bug-gnu-emacs@gnu.org; Fri, 03 Jan 2025 12:26:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Colascione Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 03 Jan 2025 17:26:02 +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.173592511416419 (code B ref 75291); Fri, 03 Jan 2025 17:26:02 +0000 Original-Received: (at 75291) by debbugs.gnu.org; 3 Jan 2025 17:25:14 +0000 Original-Received: from localhost ([127.0.0.1]:51909 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tTlQ9-0004Gj-On for submit@debbugs.gnu.org; Fri, 03 Jan 2025 12:25:14 -0500 Original-Received: from dancol.org ([2600:3c01:e000:3d8::1]:56822) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tTlQ4-0004DU-Uz for 75291@debbugs.gnu.org; Fri, 03 Jan 2025 12:25:11 -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=DSJhAYxvE9sFDAYqTHeNvLweqeKb7pUXOHqKzA8ymnQ=; b=goyzDseDh1jKKjdChjqjsbEPzp MTiijH2GRnDhTSVvt0SH/U5rFcoBAPbCCa0WdAhCAS12G0hgVt1jxqwjQEQr1aI9doHiZI9XxiIRy UbOxrJm/Qof950Bn6SYfoKhEU6tjXh4sSd/tRbAh2U52Nvl/OQYDIlriMj6QvarVFhC5xsmEchqqm CmKDS6eLGbFpUsHxaOlkHmk2pxiyxN2h8KYqrR7Hha2w4/AKO3Nizqlpe7fIDaQSE/0/ZXwWuDRLa iumJGylSFjP7KpL9/PTOno+HQK6cExw+HlZbsfCFVIixDC097Wx4+HnYuftH1xZeNXWtFYEc/j9EA EGgoCCUQ==; Original-Received: from [2600:1006:b1ae:67b6:fce2:e96c:5bed:428] (port=57718 helo=localhost) by dancol.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tTlQ1-0006z4-2Q; Fri, 03 Jan 2025 12:25:05 -0500 In-Reply-To: <86h66hhr3a.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 02 Jan 2025 22:56:57 +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:298293 Archived-At: Eli Zaretskii writes: >> From: Daniel Colascione >> Cc: 75291@debbugs.gnu.org, mina86@mina86.com >> Date: Thu, 02 Jan 2025 14:50:54 -0500 >> >> Eli Zaretskii writes: >> >> > Yes, redrawing everything will work, but will also cause flicker, and >> > is generally expensive, thus undesirable. >> >> FWIW, it doesn't seem to cause flicker in practice. I see flicker only >> when walking through messages in mu4e --- we do redisplay and draw only >> the background, and I haven't figured out why yet. But in general, on a >> modern window system, turning a given redisplay into a full redisplay >> shouldn't cause flicker, even if it's inefficient. > > I think it depends on whether you use double-buffering (some people > don't or cannot) and whether you have the mouse pointer over an Emacs > frame. Also, depending on the GUI toolkit, the decorations might > flicker. TTY windows don't have fringes, and the most commonly-used window systems all do atomic updates nowadays. >> I came across overlay_arrows_changed_p --- isn't this function trying to >> deal with exactly the case of something in the fringe changing outside >> the changed text region? > > So you want to add to display_line code that sets each glyph_row's > redraw_fringe_bitmaps_p flag when the fringe face changes? That could > probably work, provided that we disable redisplay optimizations which > might avoid calling display_line (you will see that we already disable > such optimizations when overlay_arrows_changed_p returns non-zero). > We might actually need to disable more of the optimizations, because > the overlay-arrow thing doesn't contradict the optimizations that > scroll the pixels, something that reaction to changes in the fringe > face cannot tolerate. That might work, but I don't think we even need anything that complicated or low-level. Not many are using :filtered now, and those that do big redraws anyway. How about this simpler code that gets us correctness, albeit more conservatively? diff --git a/src/window.c b/src/window.c index 5a10c381eaf..6d135a67a66 100644 --- a/src/window.c +++ b/src/window.c @@ -2396,11 +2396,29 @@ DEFUN ("set-window-parameter", Fset_window_parameter, Lisp_Object old_alist_elt; old_alist_elt = Fassq (parameter, w->window_parameters); + + /* If this window parameter has been used in a face remapping filter + expression and we changed its value, force a from-scratch redisplay + to make sure that everything that depends on the window parameter + value is up-to-date. FIXME: instead of taking a sledgehammer to + redisplay, we could be more precise in tracking what display bits + depend on which remapped faces. Skip redrawing TTY frames: they + don't have fringes or other graphical bits we might have to redraw + here. */ + if (SYMBOLP (parameter) && + WINDOW_LIVE_P (window) && + FRAME_WINDOW_P (WINDOW_XFRAME (w)) && + !NILP (Fget (parameter, Qface_filter)) && + !EQ (CDR_SAFE (old_alist_elt), value)) + redraw_frame (WINDOW_XFRAME (w)); + if (NILP (old_alist_elt)) wset_window_parameters (w, Fcons (Fcons (parameter, value), w->window_parameters)); else Fsetcdr (old_alist_elt, value); + + return value; } diff --git a/src/xfaces.c b/src/xfaces.c index d1ca2e0d5d4..1f58bdbf6ae 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -2512,6 +2512,9 @@ evaluate_face_filter (Lisp_Object filter, struct window *w, if (!NILP (filter)) goto err; + if (NILP (Fget (parameter, Qface_filter))) + Fput (parameter, Qface_filter, Qt); + bool match = false; if (w) { @@ -7623,6 +7626,8 @@ syms_of_xfaces (void) Vface_remapping_alist = Qnil; DEFSYM (Qface_remapping_alist,"face-remapping-alist"); + DEFSYM (Qface_filter, "face-filter"); + DEFVAR_LISP ("face-font-rescale-alist", Vface_font_rescale_alist, doc: /* Alist of fonts vs the rescaling factors. Each element is a cons (FONT-PATTERN . RESCALE-RATIO), where