From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sascha Wilde Newsgroups: gmane.emacs.devel Subject: Re: [christopher.ian.moore@gmail.com: Emacs very slow opening file] Date: Thu, 29 Sep 2005 11:51:57 +0200 Message-ID: <20050929095157.GA6233@kenny.sha-bang.local> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0097316945==" X-Trace: sea.gmane.org 1127990528 9464 80.91.229.2 (29 Sep 2005 10:42:08 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 29 Sep 2005 10:42:08 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Sep 29 12:42:03 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EKvpZ-0004rt-7h for ged-emacs-devel@m.gmane.org; Thu, 29 Sep 2005 12:40:01 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EKvpY-00029Y-9W for ged-emacs-devel@m.gmane.org; Thu, 29 Sep 2005 06:40:00 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EKvMF-0001VO-OM for emacs-devel@gnu.org; Thu, 29 Sep 2005 06:09:44 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EKvMD-0001UV-5o for emacs-devel@gnu.org; Thu, 29 Sep 2005 06:09:41 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EKvKi-0000Xl-8Q for emacs-devel@gnu.org; Thu, 29 Sep 2005 06:08:08 -0400 Original-Received: from [62.141.58.119] (helo=km1136.keymachine.de) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EKv57-0006Qx-96; Thu, 29 Sep 2005 05:52:01 -0400 Original-Received: from kenny.sha-bang.de (xdslw091.osnanet.de [82.149.182.91]) (authenticated bits=0) by km1136.keymachine.de (8.12.11/8.12.10) with ESMTP id j8T9ptkW001760; Thu, 29 Sep 2005 11:51:55 +0200 Original-Received: from wilde by kenny.sha-bang.de with local (Kenny MUA v.0409034.42) ID 1EKv53-0004qB-K6; Thu, 29 Sep 2005 11:51:57 +0200 Original-To: "Richard M. Stallman" Mail-Followup-To: "Richard M. Stallman" , emacs-devel@gnu.org In-Reply-To: User-Agent: Mutt/1.5.9i X-wieners-gbr-MailScanner-Information: MailScanner presented by www.wieners-gbr.de X-wieners-gbr-MailScanner: Nachricht wurde nicht auf Viren und Spam untersucht, sprechen Sie uns an: www.wieners-gbr.de. X-MailScanner-From: wilde@sha-bang.de X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:43348 Archived-At: --===============0097316945== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="x+6KMIRAuhnl3hBn" Content-Disposition: inline --x+6KMIRAuhnl3hBn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. >=20 > 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: >=20 > ;; ------- > (custom-set-variables '(global-font-lock-mode t nil (font-lock))) > (find-file "bigfile") > ;; ------- >=20 > "bigfile" is the patch file, which I've cut down to a reasonable size > (1.3 Mb), and uploaded here: >=20 > http://s89213869.onlinehome.us/bigfile >=20 > 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:=20 - 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,=20 - 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=20 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. =20 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 --=20 Sascha Wilde "C++ : an octopus made by nailing extra legs onto a dog" --x+6KMIRAuhnl3hBn Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQFDO7k9chutvmkRUCQRAotuAJ9TZF0U/DxnCRNAVqcRREAIh1VGlACg229N oLPO/vVRaYkSO6Rn2uGExXo= =7PdN -----END PGP SIGNATURE----- --x+6KMIRAuhnl3hBn-- --===============0097316945== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --===============0097316945==--