unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#33798: 27.0.50; font-lock-ensure fontifies the whole buffer
@ 2018-12-18 22:15 Juri Linkov
  2018-12-18 23:54 ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Juri Linkov @ 2018-12-18 22:15 UTC (permalink / raw)
  To: 33798; +Cc: stefan monnier

X-Debbugs-CC: Stefan Monnier <monnier@iro.umontreal.ca>

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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-12-19 21:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-18 22:15 bug#33798: 27.0.50; font-lock-ensure fontifies the whole buffer Juri Linkov
2018-12-18 23:54 ` Stefan Monnier
2018-12-19  0:15   ` Juri Linkov
2018-12-19  4:27     ` Stefan Monnier
2018-12-19 21:56       ` Juri Linkov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).