From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#36803: 27.0.50; Update mode-line of every window when compilation ends Date: Fri, 26 Jul 2019 09:59:39 -0400 Message-ID: References: <877e87i0vw.fsf@gmail.com> <87imrqcuws.fsf@mouse.gnus.org> <83ef2enosr.fsf@gnu.org> <83r26dmcx3.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="193855"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 36803@debbugs.gnu.org, larsi@gnus.org, kevin.legouguec@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jul 26 16:00:11 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hr0lW-000oFi-V7 for geb-bug-gnu-emacs@m.gmane.org; Fri, 26 Jul 2019 16:00:11 +0200 Original-Received: from localhost ([::1]:40188 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hr0lV-00065W-Jh for geb-bug-gnu-emacs@m.gmane.org; Fri, 26 Jul 2019 10:00:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43876) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hr0lS-00065Q-D9 for bug-gnu-emacs@gnu.org; Fri, 26 Jul 2019 10:00:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hr0lP-0006Ko-K9 for bug-gnu-emacs@gnu.org; Fri, 26 Jul 2019 10:00:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34241) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hr0lP-0006KQ-Ep for bug-gnu-emacs@gnu.org; Fri, 26 Jul 2019 10:00:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hr0lP-0001iM-9I for bug-gnu-emacs@gnu.org; Fri, 26 Jul 2019 10:00:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 26 Jul 2019 14:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36803 X-GNU-PR-Package: emacs Original-Received: via spool by 36803-submit@debbugs.gnu.org id=B36803.15641495946551 (code B ref 36803); Fri, 26 Jul 2019 14:00:02 +0000 Original-Received: (at 36803) by debbugs.gnu.org; 26 Jul 2019 13:59:54 +0000 Original-Received: from localhost ([127.0.0.1]:43062 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hr0lG-0001hb-GW for submit@debbugs.gnu.org; Fri, 26 Jul 2019 09:59:54 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:55505) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hr0lD-0001hL-8Z for 36803@debbugs.gnu.org; Fri, 26 Jul 2019 09:59:52 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 9D47885ACA; Fri, 26 Jul 2019 09:59:45 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id DE5FB8117A; Fri, 26 Jul 2019 09:59:43 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1564149583; bh=AgEDDuZjsWEWYh1/WyJ3CMP8T5hqleIMNbAxBzFxf3I=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=TJZCgvFDW3ASsghxCPkhXHGmtP626xie3nnZs6r61O5ueXuBmhac0FV8aQZmubJMP EodkpB/eA4FyUpGgyx8Qx5TevJQwh7B9nDPg0BQb78FYIFtbVT0e5w+DY75tNBrsly 4PRHbDcZ/zwEE+E493RrH5Z4JCT4QwAKRy/0tRF0tFSLzE9EBOXgvKhASHveSQWpEV R5U1np6RZSqUf9QLuDC6EB9P+plgDG5AnaOpyCu5MOt/Tav4hvwwBqwmT52+Z6Gwmj MMpmSFxzNYAZEPf8jGkFH9wPOS0E87uu5e4QL0hG6EAqqy5V/rJY5pHnDznGCyUSvY 07KiW98r2XRsw== Original-Received: from alfajor (modemcable157.163-203-24.mc.videotron.ca [24.203.163.157]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 3F6BD120F1F; Fri, 26 Jul 2019 09:59:43 -0400 (EDT) In-Reply-To: <83r26dmcx3.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 26 Jul 2019 11:13:12 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:163784 Archived-At: >> > If my bisection is correct, then this regression dates back from >> > >> > 645c8597e7f9fbc90ffe227d2be8ce383b0777ae >> > * src/process.c (status_notify): Avoid global redisplay (bug#11822) >> > http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=645c8597e7f9fbc90ffe227d2be8ce383b0777ae >> >> Makes sense, I will look into why this change was made. > > Stefan, I'm looking and looking, and don't understand why that change > made sense. The process-status indication in the mode line is shown > in all windows, so status_notify is exactly the place where we should > trigger update of all mode lines. Hmm... AFAIK the "process status" normally only indicates the status of the process running in the buffer to which this mode line belongs. Which is why I made the change to only bset_update_mode_line rather than set the global update_mode_lines. > Otherwise, we will have to sprinkle force-mode-line-update calls all > over the place (and it still won't work well in the cases where the > default sentinel is used, and this no Lisp is involved). AFAIK it's rather rare to use a global indicator such that all mode lines indicate whether that specific process might be running (and I personally find it a bad idea: why should my hundreds of mode-lines duplicate that information even though most of them are displaying buffers which have nothing to do whatsoever with that process?). So I think it's OK for this particular case to have to explicitly call force-mode-line-update. I don't think it will be needed "all over the place". Additionally, in this particular case, the need to update all mode-lines doesn't come from the fact that a sentinel was run, but from the fact that compilation-in-progress was modified, which can (and does) also happen when no sentinel is run. So I think TRT is something like the patch below. Stefan diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index a7575b5a1a..cbc60f5630 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -1806,8 +1806,10 @@ compilation-start ;; The process may have exited already. (error nil))) (run-hook-with-args 'compilation-start-hook proc) - (setq compilation-in-progress - (cons proc compilation-in-progress))) + ;; `compilation-in-progress' affects the mode-line of all + ;; buffers when it changes from nil to non-nil or vice-versa. + (unless compilation-in-progress (force-mode-line-update t)) + (push proc compilation-in-progress)) ;; No asynchronous processes available. (message "Executing `%s'..." command) ;; Fake mode line display as if `start-process' were run. @@ -2240,7 +2242,10 @@ compilation-sentinel ;; process is dead, we can delete it now. Otherwise it ;; will stay around until M-x list-processes. (delete-process proc))) - (setq compilation-in-progress (delq proc compilation-in-progress))))) + (setq compilation-in-progress (delq proc compilation-in-progress)) + ;; `compilation-in-progress' affects the mode-line of all buffers when + ;; it changes from nil to non-nil or vice-versa. + (unless compilation-in-progress (force-mode-line-update t))))) (defun compilation-filter (proc string) "Process filter for compilation buffers.