From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrea Corallo Newsgroups: gmane.emacs.bugs Subject: bug#69431: 30.0.50; Strange fontificaion behavior Date: Sun, 07 Apr 2024 03:47:46 -0400 Message-ID: References: <871q8x6e06.fsf@mail.parknet.co.jp> <86msrlu87i.fsf@gnu.org> <87v869oklj.fsf@localhost> <86il29u4hy.fsf@gnu.org> <87sf1dogi8.fsf@localhost> <87h6hi8d87.fsf@mail.parknet.co.jp> <86il1g2dfd.fsf@gnu.org> <87cyr2pc9t.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14560"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: =?UTF-8?Q?Bj=C3=B6rn?= Bidar , 69431@debbugs.gnu.org, Eli Zaretskii , Stefan Monnier , hirofumi@mail.parknet.co.jp To: Ihor Radchenko Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 07 09:49:18 2024 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 1rtNHB-0003Ws-TR for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 Apr 2024 09:49:18 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rtNGs-0006dO-1C; Sun, 07 Apr 2024 03:48:58 -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 1rtNGp-0006dG-Ej for bug-gnu-emacs@gnu.org; Sun, 07 Apr 2024 03:48:55 -0400 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 1rtNGp-0005K2-6b for bug-gnu-emacs@gnu.org; Sun, 07 Apr 2024 03:48:55 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rtNGv-0002Gd-Ki for bug-gnu-emacs@gnu.org; Sun, 07 Apr 2024 03:49:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andrea Corallo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 Apr 2024 07:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69431 X-GNU-PR-Package: emacs Original-Received: via spool by 69431-submit@debbugs.gnu.org id=B69431.17124760888217 (code B ref 69431); Sun, 07 Apr 2024 07:49:01 +0000 Original-Received: (at 69431) by debbugs.gnu.org; 7 Apr 2024 07:48:08 +0000 Original-Received: from localhost ([127.0.0.1]:41487 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rtNG3-00028R-B1 for submit@debbugs.gnu.org; Sun, 07 Apr 2024 03:48:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40588) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rtNFy-000276-Qu for 69431@debbugs.gnu.org; Sun, 07 Apr 2024 03:48:05 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rtNFk-0005HF-GR; Sun, 07 Apr 2024 03:47:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=qpeExDbBv2Yu00F6t3jD4E3PJrFuItGMLC8BOrGBF9g=; b=XpGTBIdXUXywwkMZsb5v ioOYHz8TpuZrJaUCE7Vc1SVVxgKo+jbkKSNG4m9WSoLe8HxNZO4yZa6k6x5ps4371UHdyH7FpCyKW 3bXH5iEFkylCDt7jg26U1+dCh2VRxAG9Tywg6trTS7my72IjxHNQCnmOEkqw6iWH/lMFDlEpJw771 jkVaPU9WUBjTum3VSFzJqT0ol2RSXrIKTo8Rtev7RhCdgaQKLYzyLfnfcSWknhRV+1OtNw/eagh7N vsfP/D+xFRr9r42Cg99FbOfYecH6vXiTC0sz3bdbVVrxUo395k9wfWKwtbO/oS84zbQjggbODcP5z 3/TsO+PBudrf2g==; Original-Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1rtNFi-0004Au-IY; Sun, 07 Apr 2024 03:47:46 -0400 In-Reply-To: <87cyr2pc9t.fsf@localhost> (Ihor Radchenko's message of "Sat, 06 Apr 2024 18:38:22 +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:282848 Archived-At: Ihor Radchenko writes: > Andrea Corallo writes: > >> If I remove the invocations of 'emacs-lisp-compilation-mode' from >> 'comp-run-async-workers' my org file gets fontified correctly. >> ... >> k-variable-watcher(font-lock-keywords ... set #) >> ... >> global-font-lock-mode-enable-in-buffers() >> run-hooks(after-change-major-mode-hook) >> run-mode-hooks(emacs-lisp-compilation-mode-hook) >> emacs-lisp-compilation-mode() >> comp-run-async-workers() >> native--compile-async("/home/andcor03/emacs2/lisp/net/dbus.el" nil late) >> ... >> require(dbus) >> ... >> org-load-modules-maybe() >> org-mode() >> ... >> find-file-noselect-1(# "~/test.org" nil nil "~/test.org" (14180533 64513)) > > IMHO, it looks like bug#58888 - global font-lock-mode is enabled in the > middle of major mode initialization and messes things up. Finally we start to see the light :) What I see is that 'global-font-lock-mode-enable-in-buffers' when executed iterates over 'global-font-lock-mode-buffers' to do things. AFAIS when two major modes are being activated at the same time on the stack it mess things up. With the following patch installed on my reproducer both the org buffer and both '*Async-native-compile-log*' are fontified correctly. diff --git a/lisp/emacs-lisp/comp-run.el b/lisp/emacs-lisp/comp-run.el index 5cc61579030..d83ea1f514e 100644 --- a/lisp/emacs-lisp/comp-run.el +++ b/lisp/emacs-lisp/comp-run.el @@ -297,7 +297,8 @@ comp-run-async-workers (get-buffer-create comp-async-buffer-name) (unless (derived-mode-p 'compilation-mode) - (emacs-lisp-compilation-mode)) + (let (global-font-lock-mode-buffers) + (emacs-lisp-compilation-mode))) (current-buffer)) :command (list (expand-file-name invocation-name @@ -332,7 +333,8 @@ comp-run-async-workers (with-current-buffer (get-buffer-create comp-async-buffer-name) (save-excursion (unless (derived-mode-p 'compilation-mode) - (emacs-lisp-compilation-mode)) + (let (global-font-lock-mode-buffers) + (emacs-lisp-compilation-mode))) (let ((inhibit-read-only t)) (goto-char (point-max)) (insert "Compilation finished.\n")))) I'd like to have Stefan opinion if this is okay or we have a better way to fix this. If this approach is okay I'll install it with some commenting. Andrea