bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#33798: 27.0.50; font-lock-ensure fontifies the whole buffer


From: Juri Linkov
Subject: bug#33798: 27.0.50; font-lock-ensure fontifies the whole buffer
Date: Wed, 19 Dec 2018 00:15:12 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

X-Debbugs-CC: Stefan Monnier <address@hidden>

The simplest test case to reproduce this is to eval in emacs -Q:

(with-temp-buffer
  (insert "#include <stdio.h>\n\nmain()\n{\n printf(\"Hello, world\");\n}")
  (c-mode)
  (font-lock-ensure 21 (point-max))
  (get-text-property (point-min) 'face))

that returns
=> font-lock-preprocessor-face

This means that `font-lock-ensure' fontifies not only the given region,
but also the whole buffer.

OTOH,

(with-temp-buffer
  (insert "#include <stdio.h>\n\nmain()\n{\n printf(\"Hello, world\");\n}")
  (c-mode)
  (font-lock-fontify-region 21 (point-max))
  (get-text-property (point-min) 'face))

returns `nil' that means that it fontifies only within the specified boundary.

This difference is essential for bug#33567: Syntactic fontification of diff 
hunks
where fontifying the whole buffer might slow down fontification of diff hunks
that are small parts of the whole buffer.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]