all messages for Emacs-related lists mirrored at yhetil.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

* bug#33798: 27.0.50; font-lock-ensure fontifies the whole buffer
  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
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2018-12-18 23:54 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 33798

Hi Jury,

> (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))

Is this testcase representative of what diff-mode does?


        Stefan





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

* bug#33798: 27.0.50; font-lock-ensure fontifies the whole buffer
  2018-12-18 23:54 ` Stefan Monnier
@ 2018-12-19  0:15   ` Juri Linkov
  2018-12-19  4:27     ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Juri Linkov @ 2018-12-19  0:15 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 33798

>> (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))
>
> Is this testcase representative of what diff-mode does?

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.





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

* bug#33798: 27.0.50; font-lock-ensure fontifies the whole buffer
  2018-12-19  0:15   ` Juri Linkov
@ 2018-12-19  4:27     ` Stefan Monnier
  2018-12-19 21:56       ` Juri Linkov
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2018-12-19  4:27 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 33798

> 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?


        Stefan





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

* bug#33798: 27.0.50; font-lock-ensure fontifies the whole buffer
  2018-12-19  4:27     ` Stefan Monnier
@ 2018-12-19 21:56       ` Juri Linkov
  0 siblings, 0 replies; 5+ messages in thread
From: Juri Linkov @ 2018-12-19 21:56 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 33798-done

>> 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.





^ 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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.