[Top][All Lists]

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

Re: Emacs very slow opening file

From: Stefan Monnier
Subject: Re: Emacs very slow opening file
Date: Tue, 27 Sep 2005 18:36:10 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> If I change the .emacs to say the following, then the file opens
> almost immediately:

> ;; -------
> (custom-set-variables '(global-font-lock-mode t nil (font-lock)))
> (defun y-or-n-p (prompt) (message "Not asking '%s'" prompt))
> (find-file "bigfile")
> ;; -------

You can still see the same problem with the above if right after opening the
file you do M->

The problem is that the buffer is put in C mode (because of the mode:C in
the file local variables) and that the font-lock-keywords of C mode are very
complex nowadays and they end up parsing the whole file.

Usually it's not *that* bad because the result of the parsing is partly
cached (IIUC) or because normal C code has some markers (e.g. a { in column
0) which can be used to avoid parsing from the beginning of the buffer.

So it's a conjunction of mostly 2 problems:
- accidental use of C mode.
- slowness of C font-lock-keywords on non-C text.
I'm not sure how to best avoid/fix the problem.


reply via email to

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