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"