GNU bug report logs - #69431
30.0.50; Strange fontificaion behavior

Previous Next

Package: emacs;

Reported by: OGAWA Hirofumi <hirofumi <at> mail.parknet.co.jp>

Date: Tue, 27 Feb 2024 17:16:02 UTC

Severity: normal

Found in version 30.0.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #128 received at 69431 <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <acorallo <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Björn Bidar <bjorn.bidar <at> thaodan.de>,
 69431 <at> debbugs.gnu.org, yantar92 <at> posteo.net, Eli Zaretskii <eliz <at> gnu.org>,
 hirofumi <at> mail.parknet.co.jp
Subject: Re: bug#69431: 30.0.50; Strange fontificaion behavior
Date: Sat, 06 Apr 2024 13:01:18 -0400
Okay after "some" debugging my theory is that it is problematic to setup
the fontification while the setup of another fontification is active on
the stack.

This is what is happening here because while we are setting up
fontification for 'test.org' native compilation activated
'emacs-lisp-compilation-mode' on the '*Async-native-compile-log*'
buffer.

If I remove the invocations of 'emacs-lisp-compilation-mode' from
'comp-run-async-workers' my org file gets fontified correctly.

Applying:

==============
modified   lisp/files.el
@@ -2828,6 +2828,13 @@ after-find-file

 (define-obsolete-function-alias 'report-errors 'with-demoted-errors "25.1")

+(defun k-variable-watcher (_symbol newval op _buffer)
+  (when (string= (buffer-name) "test.org")
+    (message "XXX %s" op)
+    (backtrace)))
+
+(add-variable-watcher 'font-lock-keywords #'k-variable-watcher)
+
 (defun normal-mode (&optional find-file)
   "Choose the major mode for this buffer automatically.
 Also sets up any specified local variables of the file or its directory.
==============

The backtrace I see in *Messages* looks like this in the non working
case (cold eln-cache):

==============
XXX set
  backtrace()
  k-variable-watcher(font-lock-keywords ((eval list (or outline-search-function (concat "^\\(?:" outline-regexp "\\).*" outline-heading-end-regexp)) 0 '(if outline-minor-mode (if outline-minor-mode-highlight (list 'face (outline-font-lock-face))) (outline-font-lock-face)) (when outline-minor-mode (pcase outline-minor-mode-highlight ('override t) ('append 'append))) t)) set #<buffer test.org>)
  font-lock-set-defaults()
  font-lock-mode-internal(t)
  font-lock-default-function(t)
  font-lock-mode()
  turn-on-font-lock()
  turn-on-font-lock-if-desired()
  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)
  apply(native--compile-async ("/home/andcor03/emacs2/lisp/net/dbus.el" nil late))
  read-event(nil nil 0.001)
  dbus-call-method(:system "org.freedesktop.DBus" "/org/freedesktop/DBus" "org.freedesktop.DBus" "AddMatch" "type='signal',interface='org.freedesktop.DBus.Local',member='Disconnected',path='/org/freedesktop/DBus/Local'")
  dbus-register-signal(:system nil "/org/freedesktop/DBus/Local" "org.freedesktop.DBus.Local" "Disconnected" dbus-handle-bus-disconnect)
  dbus-init-bus(:system)
  dbus--init()
  byte-code("\300\301\302\"\210\302 \210\303\304!\207" [add-hook after-pdump-load-hook dbus--init provide dbus] 3)
  require(dbus)
  byte-code("\300\301!\210\300\302!\210\303\304\305\306\307DD\310\311\312\313\314&\7\207" [require gnus dbus custom-declare-variable gnus-dbus-close-on-sleep funcall function #f(compiled-function () #<bytecode -0x1df07492cba9682>) ("/home/andcor03/emacs2/lisp/gnus/gnus-dbus.elc" . 86) :group gnus-dbus :type boolean] 8)
  require(gnus-dbus)
  byte-code("\300\301!\210\300\302!\210\300\303!\210\300\304!\210\300\305!\210\300\306!\210\300\307!\210\300\310!\210\311\312\313\"\210\311\314\315\"\210\311\316\315\"\210\311\317\315\"\210\320\321\322\323\324DD\325\326\327\330\331&\7\210\320\332\322\323\333DD\334\335\336\326\327\330\337&\11\210\320\340\322\323\341DD\342\335\336\326\327\330\343&\11\210\320\344\322\323\345DD\346\326\327\330\331&\7\210\320\347\322\323\350DD\351\326\327\330\352&\7\210\320\353\322\323\354DD\355\326\356\330\357&\7\210\320\360\322\323\361DD\362\326\356\330\363&\7\210\320\364\322\323\365DD\366\326\327\330\367&\7\210\320\370\322\323\371DD\372\326\373\330\357&\7\210\320\374\322\323\375DD\376\326\373\330\377&\7\207" [require gnus gnus-win gnus-int gnus-spec gnus-range gnus-util gnus-cloud gnus-dbus autoload message-make-date "message" gnus-agent-read-servers-validate "gnus-agent" gnus-agent-save-local gnus-agent-possibly-alter-active custom-declare-variable gnus-startup-file funcall function #f(compiled-function () #<bytecode -0x16373a68b89bcc3e>) ("/home/andcor03/emacs2/lisp/gnus/gnus-start.elc" . 86) :group gnus-start :type file gnus-backup-startup-file #f(compiled-function () #<bytecode 0xd353236499f29a>) ("/home/andcor03/emacs2/lisp/gnus/gnus-start.elc" . 172) :version "22.1" (choice (const :tag "Never" never) (const :tag "If existing" nil) (other :tag "Always" t)) gnus-save-startup-file-via-temp-buffer #f(compiled-function () #<bytecode 0xb738b6fba16d1a>) ("/home/andcor03/emacs2/lisp/gnus/gnus-start.elc" . 316) (choice (const :tag "Write via buffer" t) (const :tag "Write directly to file" nil)) gnus-init-file #f(compiled-function () #<bytecode 0xb3022756901fc2>) ("/home/andcor03/emacs2/lisp/gnus/gnus-start.elc" . 549) gnus-site-init-file #f(compiled-function () #<bytecode 0x1e4de8aa016bec56>) ("/home/andcor03/emacs2/lisp/gnus/gnus-start.elc" . 672) (choice file (const nil)) gnus-use-dribble-file #f(compiled-function () #<bytecode 0xb738b6fba16d1a>) ("/home/andcor03/emacs2/lisp/gnus/gnus-start.elc" . 820) gnus-dribble-file boolean gnus-dribble-directory #f(compiled-function () #<bytecode 0xb738b6fba17c1a>) ...] 10)
  require(gnus-start)
  byte-code("\300\301!\210\300\302!\210\300\303!\210\300\304!\210\300\305!\210\300\306!\210\300\307!\210\300\310!\210\300\311!\210\300\312!\210\300\313!\210\300\314!\210\315\316\317\"\210\315\320\321\"\210\315\322\323\"\210\315\324\323\"\210\315\325\326\"\210\327\330\331\332\333DD\334\335\303\336\337&\7\210\327\340\331\332\341DD\342\335\343\336\344&\7\210\327\345\331\332\346DD\347\350\351\335\352\336\353&\11\210\327\354\331\332\355DD\356\350\357\335\352\336\353&\11\210\327\360\331\332\361DD\362\335\363\336\364&\7\210\327\365\331\332\366DD\367\370\371\335\352\336\372&\11\210\327\373\331\332\374DD\375\335\363\336\353&\7\210\327\376\331\332\377DD\201@\0\335\363\336\201A\0&\7\210\327\201B\0\331\332\201C\0DD\201D\0\335\363\335\343\336\353&\11\210\327\201E\0\331\332\201F\0DD\201G\0\335\363\350\201H\0\336\201I\0&\11\210\327\201J\0\331\332\201K\0DD\201L\0\350\201M\0\335\201N\0\336\337&\11\210\327\201O\0\331\332\201P\0DD\201Q\0\335\201N\0\336\337&\7\210\327\201R\0\331\332\201S\0DD\201T\0\335\352\336\201U\0&\7\210\327\201V\0\331\332\201W\0DD\201X\0\335\352\350\201Y\0\336\201U\0&\11\210\327\201Z\0\331\332\201[\0DD\201\\\0\335\201N\0\336\201U\0&\7\210\327\201]\0\331\332\201^\0DD\201_\0\335\363\336\332&\7\207" [require cl-lib gnus gnus-start nnmail gnus-spec gnus-int gnus-range gnus-win gnus-undo gmm-utils time-date range autoload gnus-agent-total-fetched-for "gnus-agent" gnus-cache-total-fetched-for "gnus-cache" gnus-cloud-upload-all-data "gnus-cloud" gnus-cloud-download-all-data gnus-topic-find-groups "gnus-topic" custom-declare-variable gnus-no-groups-message funcall function #f(compiled-function () #<bytecode -0x156b006a3fe4da40>) ("/home/andcor03/emacs2/lisp/gnus/gnus-group.elc" . 86) :group :type string gnus-keep-same-level #f(compiled-function () #<bytecode 0x22638b6ab444452>) ("/home/andcor03/emacs2/lisp/gnus/gnus-group.elc" . 153) gnus-group-levels (choice (const nil) (const best) (sexp :tag "other" t)) gnus-group-goto-unread #f(compiled-function () #<bytecode 0x22638b6ab445552>) ("/home/andcor03/emacs2/lisp/gnus/gnus-group.elc" . 752) :link (custom-manual "(gnus)Group Maneuvering") gnus-group-various boolean gnus-goto-next-group-when-activating #f(compiled-function () #<bytecode 0x22638b6ab445552>) ("/home/andcor03/emacs2/lisp/gnus/gnus-group.elc" . 837) (custom-manual "(gnus)Scanning New Messages") gnus-permanently-visible-groups #f(compiled-function () #<bytecode 0x22638b6ab444452>) ...] 10)
  require(gnus-group)
  byte-code("\300\301!\210\300\302!\210\300\303!\210\300\304!\210\300\305!\210\300\306!\210\300\307!\210\300\310!\210\300\311!\210\300\312!\210\300\313!\210\300\314!\210\300\315!\210\316\317\320\321\322$\210\316\323\320\"\210\316\324\325\321\326$\210\316\327\330\321\211$\210\316\331\330\321\211$\210\316\332\330\321\211$\210\316\333\334\321\211$\210\316\335\334\321\211$\210\336\337\340\341\342DD\343\344\345\346\347&\7\210\336\350\340\341\351DD\352\353\354\344\345\355\356\346\347&\13\210\336\357\340\341\360DD\361\353\362\344\363\355\364\346\347&\13\210\336\365\340\341\366DD\367\344\370\346\371&\7\210\336\372\340\341\373DD\374\344\370\346\375&\7\210\376\377\201@\0\321#\210\201A\0\211\203\355\0\211@\377\1N\203\350\0\201@\0\1N\204\350\0\201B\0\201@\0\2\377\4N#\210\210A\202\310\0\210\201C\0\377\201@\0\201D\0#\210\336\201@\0\340\341\201E\0DD\201F\0\355\201D\0\344\370\346\201G\0&\11\210\336\201H\0\340\341\201I\0DD\201J\0\355\201K\0\344\370\346\347&\11\210\336\201L\0\340\341\201M\0DD\201N\0\344\370\346\201O\0&\7\210\336\201P\0\340\341\201Q\0DD\201R\0\355\201S\0\344\370\346\347&\11\210\336\201T\0\340\341\201U\0DD\201V\0\344\370\346\201W\0&\7\207" [require cl-lib gnus gnus-group gnus-spec gnus-range gnus-int gnus-undo gnus-util gmm-utils mm-decode shr url nnoo autoload gnus-summary-limit-include-cached "gnus-cache" nil (gnus-summary-mode) gnus-cache-write-active gnus-pick-line-number "gnus-salt" t nnselect-article-rsv "nnselect" nnselect-article-group gnus-nnselect-group-p gnus-search-thread "gnus-search" gnus-search-server-to-engine custom-declare-variable gnus-kill-summary-on-exit funcall function #f(compiled-function () #<bytecode 0x1f738b5a7440a24>) ("/home/andcor03/emacs2/lisp/gnus/gnus-sum.elc" . 87) :group gnus-summary-exit :type boolean gnus-summary-next-group-on-exit #f(compiled-function () #<bytecode 0x1f738b5a7440a24>) ("/home/andcor03/emacs2/lisp/gnus/gnus-sum.elc" . 253) :link (custom-manual "(gnus)Group Maneuvering") :version "23.1" gnus-summary-stop-at-end-of-message #f(compiled-function () #<bytecode 0x1f738b5a7441124>) ("/home/andcor03/emacs2/lisp/gnus/gnus-sum.elc" . 349) ...] 12)
  require(gnus-sum)
  byte-code("\300\301!\210\300\302!\210\300\303!\210\300\304!\210\300\305\306\307#\204\36\0\300\310\306\307#\210\300\311!\210\312\313\314\315\316DD\317\320\321\322\323&\7\210\312\324\314\315\325DD\326\320\327\330\331\332\333\322\323&\13\210\334\335\336\337\340\341%\207" [require org-macs gnus-sum gnus-util nnheader nnselect nil t nnir ol custom-declare-variable org-gnus-prefer-web-links funcall function #f(compiled-function () #<bytecode -0x14706cb1bbcafd06>) ("/home/andcor03/emacs2/lisp/org/ol-gnus.elc" . 87) :group org-link-store :type boolean org-gnus-no-server #f(compiled-function () #<bytecode -0x14706cb1bbcafd06>) ("/home/andcor03/emacs2/lisp/org/ol-gnus.elc" . 353) org-link-follow :version "24.4" :package-version (Org . "8.0") org-link-set-parameters "gnus" :follow org-gnus-open :store org-gnus-store-link] 12)
  require(ol-gnus)
  org-load-modules-maybe()
  org-mode()
  set-auto-mode-0(org-mode nil)
  set-auto-mode--apply-alist((("\\.gpg\\(~\\|\\.~[0-9]+~\\)?\\'" nil epa-file) ("\\.elc\\'" . elisp-byte-code-mode) ("\\.zst\\'" nil jka-compr) ("\\.dz\\'" nil jka-compr) ("\\.xz\\'" nil jka-compr) ("\\.lzma\\'" nil jka-compr) ("\\.lz\\'" nil jka-compr) ("\\.g?z\\'" nil jka-compr) ("\\.bz2\\'" nil jka-compr) ("\\.Z\\'" nil jka-compr) ("\\.vr[hi]?\\'" . vera-mode) ("\\(?:\\.\\(?:rbw?\\|ru\\|rake\\|thor\\|axlsx\\|jbuilder\\|rabl\\|gemspec\\|podspec\\)\\|/\\(?:Gem\\|Rake\\|Cap\\|Thor\\|Puppet\\|Berks\\|Brew\\|Fast\\|Vagrant\\|Guard\\|Pod\\)file\\)\\'" . ruby-mode) ("\\.re?st\\'" . rst-mode) ("/\\(?:Pipfile\\|\\.?flake8\\)\\'" . conf-mode) ("\\.py[iw]?\\'" . python-mode) ("\\.m\\'" . octave-maybe-mode) ("\\.less\\'" . less-css-mode) ("\\.scss\\'" . scss-mode) ("\\.cs\\'" . csharp-mode) ("\\.awk\\'" . awk-mode) ("\\.\\(u?lpc\\|pike\\|pmod\\(\\.in\\)?\\)\\'" . pike-mode) ("\\.idl\\'" . idl-mode) ("\\.java\\'" . java-mode) ("\\.m\\'" . objc-mode) ("\\.ii\\'" . c++-mode) ("\\.i\\'" . c-mode) ("\\.lex\\'" . c-mode) ("\\.y\\(acc\\)?\\'" . c-mode) ("\\.h\\'" . c-or-c++-mode) ("\\.c\\'" . c-mode) ("\\.\\(CC?\\|HH?\\)\\'" . c++-mode) ("\\.[ch]\\(pp\\|xx\\|\\+\\+\\)\\'" . c++-mode) ("\\.\\(cc\\|hh\\)\\'" . c++-mode) ("\\.\\(bat\\|cmd\\)\\'" . bat-mode) ("\\.[sx]?html?\\(\\.[a-zA-Z_]+\\)?\\'" . mhtml-mode) ("\\.svgz?\\'" . image-mode) ("\\.svgz?\\'" . xml-mode) ("\\.x[bp]m\\'" . image-mode) ("\\.x[bp]m\\'" . c-mode) ("\\.p[bpgn]m\\'" . image-mode) ("\\.tiff?\\'" . image-mode) ("\\.gif\\'" . image-mode) ("\\.png\\'" . image-mode) ("\\.jpe?g\\'" . image-mode) ("\\.webp\\'" . image-mode) ("\\.te?xt\\'" . text-mode) ("\\.[tT]e[xX]\\'" . tex-mode) ("\\.ins\\'" . tex-mode) ("\\.ltx\\'" . latex-mode) ("\\.dtx\\'" . doctex-mode) ...) nil nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer test.org> "~/test.org" nil nil "~/test.org" (14180533 64513))
  find-file-noselect("/home/andcor03/test.org")
  command-line-1(("-eval" "(setq native-comp-jit-compilation t)" "/home/andcor03/test.org"))
  command-line()
  normal-top-level()
==============

Why are we setting 'font-lock-keywords' on test.org if the last major
mode activation we have on the stack is for
'emacs-lisp-compilation-mode'?  IOW why the current buffer is test.org
if 'emacs-lisp-compilation-mode' is called wrapped by
'with-current-buffer' on '*Async-native-compile-log*'?

Also is the value of 'font-lock-keywords' we are setting on test.org the
expected one or are we mixing up things?

Thanks

  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.