From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#64596: 30.0.50; On FIXME: in src/buffer.c:1481 (force-mode-line-update) Date: Thu, 13 Jul 2023 13:20:23 -0400 Message-ID: References: <877cr4nez9.fsf@localhost> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12181"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 64596@debbugs.gnu.org To: Ihor Radchenko Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jul 13 19:21:08 2023 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 1qK003-0002ut-NW for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 13 Jul 2023 19:21:07 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qJzzz-0001mP-Ri; Thu, 13 Jul 2023 13:21:03 -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 1qJzzz-0001mG-4Y for bug-gnu-emacs@gnu.org; Thu, 13 Jul 2023 13:21:03 -0400 Original-Received: from [2001:470:142:5::43] (helo=debbugs.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qJzzy-000186-T7 for bug-gnu-emacs@gnu.org; Thu, 13 Jul 2023 13:21:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qJzzy-0006Yt-Ix for bug-gnu-emacs@gnu.org; Thu, 13 Jul 2023 13:21:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 13 Jul 2023 17:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64596 X-GNU-PR-Package: emacs Original-Received: via spool by 64596-submit@debbugs.gnu.org id=B64596.168926883325165 (code B ref 64596); Thu, 13 Jul 2023 17:21:02 +0000 Original-Received: (at 64596) by debbugs.gnu.org; 13 Jul 2023 17:20:33 +0000 Original-Received: from localhost ([127.0.0.1]:40761 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qJzzU-0006Xp-Si for submit@debbugs.gnu.org; Thu, 13 Jul 2023 13:20:33 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:29042) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qJzzS-0006Xa-Bt for 64596@debbugs.gnu.org; Thu, 13 Jul 2023 13:20:31 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 9983A1000C3; Thu, 13 Jul 2023 13:20:24 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 8813510009E; Thu, 13 Jul 2023 13:20:23 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1689268823; bh=TB6qT68fXmFvxrFCCIIIAtLDR8zrnTs0URufBCoUZfY=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=MpW3VzjjFfviMpg7UWT+1nRVHfVNB8pO8pNdKC6yFUBeC3z07zzgVX/a2wr6BLx2G 8OZROnZ1ignTVMDv2yh8ErXGc1PW0uATMQpywmL2kDrYjF3Sl6wpqWF+4NQGbY/XYG +2cRnlzszelO2TEo4+RApr4gfiW1GmdDaEyFMu3s05pZEFWYpN6MBBpnNnBaqMA7C0 2kHpigZLKLuCwudBSI8b0moNQGfZDr1hvedxQsaitSpfGmOhjh9EVqdhhgv5YXBQfx T0gpogz3yu0egpBewaM5uC6mLvqPVo9CAxVNIMz2+ujgABKB+1b5HYXL8PNKeeo3Bk pBR96Q01t/rRw== Original-Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 7A9091201E1; Thu, 13 Jul 2023 13:20:23 -0400 (EDT) In-Reply-To: <877cr4nez9.fsf@localhost> (Ihor Radchenko's message of "Thu, 13 Jul 2023 13:00:26 +0000") 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:265034 Archived-At: > `force-mode-line-update' has the following FIXME: > > if (!NILP (all)) > { > update_mode_lines = 10; > /* FIXME: This can't be right. */ > current_buffer->prevent_redisplay_optimizations_p = true; > } > else if (buffer_window_count (current_buffer)) > { > bset_update_mode_line (current_buffer); > current_buffer->prevent_redisplay_optimizations_p = true; > } > > This FIXME has been introduced in 655ab9a3800, shortly after > ecda65d4f7e, which moved this code from `set-buffer-modified-p'. ecda65d4f7e changed `force-mode-line-update` from (if all (with-current-buffer (other-buffer))) (set-buffer-modified-p (buffer-modified-p))) to if (!NILP (all) || buffer_window_count (current_buffer)) { update_mode_lines = 10; current_buffer->prevent_redisplay_optimizations_p = 1; } That new code was (to the best of my knowledge) doing the same as what the old ELisp code did (I got to that code basically by taking the sum of the C code run by the original ELisp code and then simplifying it by eliminating those things which canceled each other). That code already had the same problem as the one I flagged with the FIXME: when we do (force-mode-line-update t) the effect should be global, so if `prevent_redisplay_optimizations_p` is needed in `current_buffer` it should be needed in other displayed buffers as well. > AFAIU, the purpose of disabling redisplay optimizations is avoiding the > situation when the modification flag is unset in the buffer, but the > buffer was actually modified, and has to be redrawn. > If my understanding is correct, > current_buffer->prevent_redisplay_optimizations_p = true does not belong > to `force-mode-line-update', but rather to `restore-buffer-modified-p'. I strongly suspect it doesn't belong in `force-mode-line-update`, indeed. > Stefan will tell, but I'm quite sure he wrote that FIXME because > removing that line caused regression in some situation. Nope. I put the FIXME simply because I realized that the code doesn't make sense: if that line is sometimes necessary, then I'm pretty sure it's not always sufficient. Stefan