From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kan-Ru Chen Newsgroups: gmane.emacs.devel Subject: Re: Slow fontification in C mode buffers Date: Fri, 16 Dec 2011 00:16:25 +0800 Message-ID: <87y5udizdy.fsf@isil.kanru.info> References: <83vcpxbxn0.fsf@gnu.org> <20111203151824.GA4566@acm.acm> <87pqfso5d3.fsf@isil.kanru.info> <20111215134332.GA5698@acm.acm> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1323965812 10035 80.91.229.12 (15 Dec 2011 16:16:52 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 15 Dec 2011 16:16:52 +0000 (UTC) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 15 17:16:48 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RbDzE-0001Ry-2A for ged-emacs-devel@m.gmane.org; Thu, 15 Dec 2011 17:16:48 +0100 Original-Received: from localhost ([::1]:35636 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RbDzD-0000Yw-J4 for ged-emacs-devel@m.gmane.org; Thu, 15 Dec 2011 11:16:47 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:47790) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RbDzA-0000Yh-DQ for emacs-devel@gnu.org; Thu, 15 Dec 2011 11:16:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RbDz0-0002jD-NN for emacs-devel@gnu.org; Thu, 15 Dec 2011 11:16:44 -0500 Original-Received: from mail-ee0-f41.google.com ([74.125.83.41]:65037) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RbDz0-0002im-I8; Thu, 15 Dec 2011 11:16:34 -0500 Original-Received: by eekc41 with SMTP id c41so2385932eek.0 for ; Thu, 15 Dec 2011 08:16:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=ziEvInF6oRarvB+Z8L4NB5BYxjnQJ0+SxI7yqd3J+d4=; b=a1yXqIg0ipEYRG6aaAdL94ypitizZEH6Kfq1zHnJnfhxHyE1x66mr032d+ype8NpDS 7do/hULZCE6JMhL3+k2JLtD99tJ3k7EzTw0yp86KQmUMY77lWSkzFXinPpW4X3Pg+ijv USg5a6E66i3CNld/d6Rl2+jlwowACHT40dGv0= Original-Received: by 10.14.50.197 with SMTP id z45mr1710406eeb.63.1323965792813; Thu, 15 Dec 2011 08:16:32 -0800 (PST) Original-Received: from isil.kanru.info (61-228-154-170.dynamic.hinet.net. [61.228.154.170]) by mx.google.com with ESMTPS id 54sm25772185eeo.10.2011.12.15.08.16.30 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 15 Dec 2011 08:16:31 -0800 (PST) Original-Received: from localhost.localdomain ([127.0.0.1] helo=isil.kanru.info) by isil.kanru.info with esmtp (Exim 4.77) (envelope-from ) id 1RbDys-0005mq-2C; Fri, 16 Dec 2011 00:16:26 +0800 In-Reply-To: <20111215134332.GA5698@acm.acm> (Alan Mackenzie's message of "Thu, 15 Dec 2011 13:43:32 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 74.125.83.41 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:146726 Archived-At: Alan Mackenzie writes: > Would you please try the following patch and let me know how it goes. > Thanks! No change. c-cheap-inside-bracelist-p seems not called at all. > *** orig/cc-engine.el 2011-12-15 09:06:28.000000000 +0000 > --- cc-engine.el 2011-12-15 13:41:25.000000000 +0000 > *************** > *** 8073,8078 **** > --- 8073,8094 ---- > next-open-brace (c-pull-open-brace paren-state))) > open-brace)) > > + (defun c-cheap-inside-bracelist-p (paren-state) > + ;; Return the position of the L-brace if point is inside a brace list > + ;; initialization of an array, etc. This is an approximate function, > + ;; designed for speed over accuracy. We simply search for "= {" (naturally > + ;; with syntactic whitespace allowed). PAREN-STATE is the normal thing that > + ;; it is everywhere else. > + (let (b-pos) > + (save-excursion > + (while > + (and (setq b-pos (c-pull-open-brace paren-state)) > + (progn (goto-char b-pos) > + (c-backward-sws) > + (c-backward-token-2) > + (not (looking-at "="))))) > + b-pos))) > + > (defun c-inside-bracelist-p (containing-sexp paren-state) > ;; return the buffer position of the beginning of the brace list > ;; statement if we're inside a brace list, otherwise return nil. > *** orig/cc-fonts.el 2011-12-15 09:06:28.000000000 +0000 > --- cc-fonts.el 2011-12-15 13:15:43.000000000 +0000 > *************** > *** 1394,1399 **** > --- 1394,1405 ---- > (c-fontify-recorded-types-and-refs) > nil) > > + ;; If point is inside a bracelist, there's no point checking it > + ;; being at a declarator. > + ((let ((paren-state (c-parse-state))) > + (c-cheap-inside-bracelist-p paren-state)) > + nil) > + > (t > ;; Are we at a declarator? Try to go back to the declaration > ;; to check this. If we get there, check whether a "typedef" > >> -- >> Kanru -- Kanru