GNU bug report logs -
#69431
30.0.50; Strange fontificaion behavior
Previous Next
Full log
View this message in rfc822 format
Ihor Radchenko <yantar92 <at> posteo.net> writes:
> Andrea Corallo <acorallo <at> gnu.org> 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 #<buffer test.org>)
>> ...
>> 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(#<buffer test.org> "~/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
This bug report was last modified 1 year and 103 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.