unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Sascha Wilde <wilde@sha-bang.de>
Cc: emacs-devel@gnu.org
Subject: Re: [christopher.ian.moore@gmail.com: Emacs very slow opening file]
Date: Thu, 29 Sep 2005 11:51:57 +0200	[thread overview]
Message-ID: <20050929095157.GA6233@kenny.sha-bang.local> (raw)
In-Reply-To: <E1EKfSY-00020o-H1@fencepost.gnu.org>


[-- Attachment #1.1: Type: text/plain, Size: 2389 bytes --]

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"

[-- Attachment #1.2: Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

  reply	other threads:[~2005-09-29  9:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-28 17:11 [christopher.ian.moore@gmail.com: Emacs very slow opening file] Richard M. Stallman
2005-09-29  9:51 ` Sascha Wilde [this message]
2005-09-29 12:24   ` Kenichi Handa
2005-09-29 12:38     ` Sascha Wilde
2005-09-29 19:44       ` Stefan Monnier
2005-09-29 20:55         ` Juri Linkov
2005-09-30 17:33           ` Richard M. Stallman
2005-09-29 21:03         ` Andreas Schwab
2005-09-29 23:31   ` Richard M. Stallman
2005-09-30  6:39     ` David Kastrup
2005-09-30  7:58       ` Sascha Wilde
2005-09-30 23:50       ` Richard M. Stallman
2005-10-02 14:48         ` Stefan Monnier
2005-09-30  7:43     ` Sascha Wilde
2005-10-02 20:22       ` Juri Linkov
2005-10-03 15:35         ` Richard M. Stallman

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=20050929095157.GA6233@kenny.sha-bang.local \
    --to=wilde@sha-bang.de \
    --cc=emacs-devel@gnu.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).