From: Anders Lindgren <andlind@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Wilfred Hughes <me@wilfred.me.uk>,
public@ryanb.org, emacs-devel <emacs-devel@gnu.org>
Subject: Re: Making font-lock handle long lines better
Date: Sun, 12 Feb 2017 00:06:41 +0100 [thread overview]
Message-ID: <CABr8ebY_0sUTmv_unYQSdZ4VjrCf3KNH3nnE2SW_sd-xEdU9+A@mail.gmail.com> (raw)
In-Reply-To: <83lgtc3215.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1320 bytes --]
>
> Since it's slow in Fundamental mode as well, it's unrelated to
> font-lock, and thus to this thread. Display of very long lines is
> known to be slow in Emacs.
>
I believe this is a font-lock problem. If you disable global-font-lock-mode
before you open the file, it opens in seconds. If global-font-lock-mode is
active Emacs stops responding (I gave up after a few minutes).
A quick experiment suggested that the problem is the member
`font-lock-extend-region-wholelines' of `font-lock-extend-region-functions'
that ensures that whenever font-lock highlights keywords in a region, the
full line is rehighlighted (in the case of the example, the full 18M). By
removing it, font-locking the file is done in seconds. (I assume that only
the visible parts of the buffer is highlighted.)
Clearly, simple dropping the function is not a good idea, as keyword
fontification could start anywhere on the line, e.g. in the middle of
identifiers. A better approach would be to extend the region to include
10KB in either direction, plus ensure that the region isn't split in the
middle of identifiers.
/ Anders
Ps. In case anybody is interested in looking further into this, you can use
the tool https://github.com/Lindydancer/highlight-refontification to get
visual feedback on the font-lock refontification process.
[-- Attachment #2: Type: text/html, Size: 1772 bytes --]
next prev parent reply other threads:[~2017-02-11 23:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-10 15:44 Making font-lock handle long lines better Ryan B
2017-02-10 15:57 ` joakim
2017-02-10 16:24 ` Eli Zaretskii
2017-02-11 20:10 ` Wilfred Hughes
2017-02-11 20:28 ` Eli Zaretskii
2017-02-11 23:06 ` Anders Lindgren [this message]
2018-05-13 19:44 ` Ryan B
2018-05-15 0:05 ` Noam Postavsky
2018-05-15 8:08 ` Jostein Kjønigsen
2018-05-15 16:50 ` Eli Zaretskii
2018-05-15 18:32 ` Stefan Monnier
2017-02-11 22:06 ` Ryan B
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=CABr8ebY_0sUTmv_unYQSdZ4VjrCf3KNH3nnE2SW_sd-xEdU9+A@mail.gmail.com \
--to=andlind@gmail.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=me@wilfred.me.uk \
--cc=public@ryanb.org \
/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).