From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: font-locking and open parens in column 0 Date: Sat, 04 Nov 2006 10:30:09 +0100 Message-ID: <454C5DA1.70608@gmx.at> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1162640338 27628 80.91.229.2 (4 Nov 2006 11:38:58 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 4 Nov 2006 11:38:58 +0000 (UTC) Cc: Alan Mackenzie , Richard Stallman , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Nov 04 12:38:57 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GgJrR-0004Hh-8W for ged-emacs-devel@m.gmane.org; Sat, 04 Nov 2006 12:38:53 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GgJrQ-0003Fb-R6 for ged-emacs-devel@m.gmane.org; Sat, 04 Nov 2006 06:38:52 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GgJqj-0002tC-Dq for emacs-devel@gnu.org; Sat, 04 Nov 2006 06:38:09 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GgJqh-0002rC-DR for emacs-devel@gnu.org; Sat, 04 Nov 2006 06:38:08 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GgJqg-0002qs-UO for emacs-devel@gnu.org; Sat, 04 Nov 2006 06:38:06 -0500 Original-Received: from [213.165.64.20] (helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.52) id 1GgJqY-0008Vj-KC for emacs-devel@gnu.org; Sat, 04 Nov 2006 06:37:59 -0500 Original-Received: (qmail invoked by alias); 04 Nov 2006 11:37:56 -0000 Original-Received: from N709P013.adsl.highway.telekom.at (EHLO [62.47.32.141]) [62.47.32.141] by mail.gmx.net (mp036) with SMTP; 04 Nov 2006 12:37:56 +0100 X-Authenticated: #14592706 User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en Original-To: "Mackenzie, Alan" In-Reply-To: X-Y-GMX-Trusted: 0 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:61762 Archived-At: >> But I still think the >>"bug" is with the author who put the left paren in column zero of that >>comment. That author should be warned just as in emacs-lisp-mode. > > > Should _HAVE_ been warned. Martin Stjernholm has worked very hard to > remove that restriction from C Mode without sacrificing (much) speed. It > would be a shame now to leave the restriction in Emacs 22. Which means that Martin Stjernholm's change did not make it to font-locking which, for c-mode, still uses the `beginning-of-defun' from lisp-mode. I see only two reasonable fixes to this: (1) Set `syntax-begin-function' (or `beginning-of-defun-function') to `c-beginning-of-defun' if you trust that change. This should, hopefully, populate your cache. (2) Set `syntax-begin-function' to nil as Stefan suggested and let `syntax-ppss' do the work. This should populate Stefan's cache. Any other solution would be a shameful waste of resources since the results of `parse-partial-sexp' from your original proposal don't get stored anywhere (jumping to a position n in a c-mode buffer and subsequently jumping to a position m < n would afford to rescan from bob). Also make sure that `font-lock-beginning-of-syntax-function' nowhere interferes with these settings. Ideally, there would be one and only one cache populated and consulted by both - c-mode and `syntax-ppss'.