unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: 33798@debbugs.gnu.org
Cc: stefan monnier <monnier@iro.umontreal.ca>
Subject: bug#33798: 27.0.50; font-lock-ensure fontifies the whole buffer
Date: Wed, 19 Dec 2018 00:15:12 +0200	[thread overview]
Message-ID: <87woo632j3.fsf@mail.linkov.net> (raw)

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.





             reply	other threads:[~2018-12-18 22:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-18 22:15 Juri Linkov [this message]
2018-12-18 23:54 ` bug#33798: 27.0.50; font-lock-ensure fontifies the whole buffer Stefan Monnier
2018-12-19  0:15   ` Juri Linkov
2018-12-19  4:27     ` Stefan Monnier
2018-12-19 21:56       ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87woo632j3.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=33798@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).