From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Mysterious fontification/C++ context issue - Patch for beginning-of-defun-raw. Date: 14 Dec 2006 08:36:42 +0100 Message-ID: <20061214084713.GA1333@muc.de> References: <45768797.5010106@gmx.at> <87odqhj89q.fsf@stupidchicken.com> <20061210014526.GB3738@muc.de> <877ix0lfm8.fsf@furball.mit.edu> <20061210102249.GA1235@muc.de> <87d56rpk7a.fsf@stupidchicken.com> <20061213224009.GA1206@muc.de> <87odq72ssy.fsf@stupidchicken.com> NNTP-Posting-Host: dough.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1166081834 10005 80.91.229.10 (14 Dec 2006 07:37:14 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 14 Dec 2006 07:37:14 +0000 (UTC) Cc: martin rudalics , emacs-devel@gnu.org, Richard Stallman , Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 14 08:37:12 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by dough.gmane.org with esmtp (Exim 4.50) id 1Gul9S-0003ER-TG for ged-emacs-devel@m.gmane.org; Thu, 14 Dec 2006 08:37:11 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Gul9S-0000Jz-DK for ged-emacs-devel@m.gmane.org; Thu, 14 Dec 2006 02:37:10 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Gul95-0008SL-46 for emacs-devel@gnu.org; Thu, 14 Dec 2006 02:36:47 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Gul92-0008M8-Nu for emacs-devel@gnu.org; Thu, 14 Dec 2006 02:36:46 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Gul92-0008Ly-Fx for emacs-devel@gnu.org; Thu, 14 Dec 2006 02:36:44 -0500 Original-Received: from [193.149.48.1] (helo=mail.muc.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1Gul91-0000eS-W4 for emacs-devel@gnu.org; Thu, 14 Dec 2006 02:36:44 -0500 Original-Received: (qmail 86339 invoked by uid 3782); 14 Dec 2006 07:36:42 -0000 Original-Received: from acm.muc.de (p54A3E86F.dip.t-dialin.net [84.163.232.111]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Thu, 14 Dec 2006 08:36:38 +0100 (CET) Original-Received: (qmail 1737 invoked by uid 1000); 14 Dec 2006 08:47:13 -0000 Original-Date: Thu, 14 Dec 2006 08:47:13 +0000 Original-To: Chong Yidong Content-Disposition: inline In-Reply-To: <87odq72ssy.fsf@stupidchicken.com> User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.0.3 (Seattle Slew) X-Primary-Address: acm@muc.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:63707 Archived-At: Good morning/evening, Chong! On Wed, Dec 13, 2006 at 08:02:37PM -0500, Chong Yidong wrote: > >> In any case, could someone check in Martin's optimization to > >> c-beginning-of-defun-raw, or send me the patch with a changelog so > >> that I can check it in? > > Chong, especially: Please load xdisp.c with the following patch, and tell > > me whether or not its slowness is still a problem. > Before the changes beginning-to-defun-raw, doing M-> to move to the > end of xdisp.c is instantaneous. Hey, that's not fair! When you raised this problem, you were complaining about how slow a M-v was, after having got to EOF. Is this M-v now acceptably fast for you on your 1.7 GHz machine? > With the patch applied, M-> takes four seconds. This is on a Pentium 4 > 1700MHz computer. It's worth pointing out that this is only the first time. If you then do M-< and another M->, these are then instantaneous. If (some) cache later gets disrupted, then the M-> would be a bit slow again. Do you have any idea why M->, which is surely nothing more than (goto-char (point-max)) is so slow? I have an idea it is the filling of CC Mode's cache. > Is it really so bad to revert the changes for now? Yes. By "for now", you mean for Emacs 22. If the changes are reverted "for now", they'll stay reverted until the release of Emacs 23, sometime around 2011. > If the only files misfontified are Emacs source files, I don't think > this "fix" is necessary for Emacs 22---especially if the files in > question can be tweaked to avoid the bug. It isn't only Emacs source files. It happens a lot in normal users' files.c. There's a FAQ about it in the CC Mode manual. After all, having parentheses inside strings and comments in C is perfectly valid and acceptable syntax, and it looks like a bug (which indeed it is), if Emacs can't fontify such things properly. xdisp.c, at ~750k, is an unusually large source file. A 1.7 GHz machine will become unusually old and slow during the lifetime of Emacs 22. > (AFAIK, the issue of how to see this problem was never discussed on > this mailing list, but I've certainly never come across it in my > frequent perusal of the Emacs sources.) The problem here is that CC Mode sets opic0ids to nil in a hard coded fashion. The solution must be that opic0ids in CC Mode should be nil by default, yet give the user a way to set it to t. How about the following: open-paren-in-column-0-is-defun-start should become a buffer-local variable, with default value 'mode. This symbol will mean "use the major mode's default for the variable". This will give the user the flexibility she needs. -- Alan.