[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: address@hidden: Emacs very slow opening file]
From: |
Sascha Wilde |
Subject: |
Re: address@hidden: Emacs very slow opening file] |
Date: |
Thu, 29 Sep 2005 11:51:57 +0200 |
User-agent: |
Mutt/1.5.9i |
On Wed, Sep 28, 2005 at 01:11:10PM -0400, Richard M. Stallman wrote:
> Would someone please investigate this bug report,
> and then ack?
[...]
> I tried opening a debian 'patch' file in Emacs. The Emacs process
> appeared to hang, using all my CPU. It wouldn't respond to C-g.
>
> After chopping down my .emacs to see what triggered the problem, it
> turns out that just using a minimal .emacs file like this triggers it:
>
> ;; -------
> (custom-set-variables '(global-font-lock-mode t nil (font-lock)))
> (find-file "bigfile")
> ;; -------
>
> "bigfile" is the patch file, which I've cut down to a reasonable size
> (1.3 Mb), and uploaded here:
>
> http://s89213869.onlinehome.us/bigfile
>
> It takes the latest CVS Emacs on my 2.2GHz P4 PC 15 seconds to open that
> file.
I can confirm, that it takes more than 10 seconds to open the given
file, using the latest emacs from cvs.
After short investigation I found the following:
What takes so long is a combination of c-mode fontification and
interpretation of file-local variables.
What happens is that:
- running through the file emacs finds the last valid "Local
Variables:" block starting on line 42634,
- in the first line of this block the mode gets switched to c-mode.
- After that emacs finds an "eval:" in the next line of the block, and
wants to ask the user whether to process it,
- so the part of the file with the eval: variable in question is
displayed -- this is starting with line 42635(!)
- fontification is enabled, and the c-mode fontification rules seem to
do lots of parsing on the whole file preceding the displayed part
_that_ is what takes so long.
To verify my theory, simply change line 42635 from
-/* mode:c */
to
-/* mode:diff */
(or fundamental or lisp or simply anything, which does less expensive
fontification).
So, I would conclude, that there is no bug at all. Emacs can't
possibly know, that the "Local Variables:" block isn't meant to be
interpreted in the diff file.
And I wouldn't consider the fact, that c-mode fontification takes so
long on a big file, which isn't valid c-code at all, a bug.
Workaround: turn of global-font-lock-mode or set
enable-local-variables to nil, before opening a file like that.
cheers
sascha
--
Sascha Wilde
"C++ : an octopus made by nailing extra legs onto a dog"
pgpxuGJjw8IwY.pgp
Description: PGP signature
- address@hidden: Emacs very slow opening file], Richard M. Stallman, 2005/09/28
- Re: address@hidden: Emacs very slow opening file],
Sascha Wilde <=
- Re: address@hidden: Emacs very slow opening file], Kenichi Handa, 2005/09/29
- Re: address@hidden: Emacs very slow opening file], Sascha Wilde, 2005/09/29
- Re: address@hidden: Emacs very slow opening file], Stefan Monnier, 2005/09/29
- Re: address@hidden: Emacs very slow opening file], Andreas Schwab, 2005/09/29
- Re: address@hidden: Emacs very slow opening file], Juri Linkov, 2005/09/29
- Re: address@hidden: Emacs very slow opening file], Richard M. Stallman, 2005/09/30
Re: address@hidden: Emacs very slow opening file], Richard M. Stallman, 2005/09/29