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

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

[debbugs-tracker] bug#33798: closed (27.0.50; font-lock-ensure fontifies


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#33798: closed (27.0.50; font-lock-ensure fontifies the whole buffer)
Date: Wed, 19 Dec 2018 22:01:03 +0000

Your message dated Wed, 19 Dec 2018 23:56:05 +0200
with message-id <address@hidden>
and subject line Re: bug#33798: 27.0.50; font-lock-ensure fontifies the whole 
buffer
has caused the debbugs.gnu.org bug report #33798,
regarding 27.0.50; font-lock-ensure fontifies the whole buffer
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
33798: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=33798
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 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.



--- End Message ---
--- Begin Message --- Subject: Re: bug#33798: 27.0.50; font-lock-ensure fontifies the whole buffer Date: Wed, 19 Dec 2018 23:56:05 +0200 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)
>> I can see the same effect in internal buffers created by diff-mode:
>> switching to these buffers I see that font-lock-ensure fontifies
>> the whole buffer, whereas using font-lock-fontify-region I see only
>> small parts of the source buffer fontified corresponding to diff hunks.
>
> I installed a patch into `master` which should fix this.
> Could you check it works for your cases?

I checked that it works now in all cases and fontifies only needed hunks,
so I updated diff-mode to always use font-lock-ensure.


--- End Message ---

reply via email to

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