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: Thu, 02 Nov 2006 19:31:32 +0100 Message-ID: <454A3984.6000302@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 1162492491 28120 80.91.229.2 (2 Nov 2006 18:34:51 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 2 Nov 2006 18:34:51 +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 Thu Nov 02 19:34:46 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 1GfhOO-0001KQ-S0 for ged-emacs-devel@m.gmane.org; Thu, 02 Nov 2006 19:34:21 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GfhOO-0000EJ-CB for ged-emacs-devel@m.gmane.org; Thu, 02 Nov 2006 13:34:20 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GfhOA-0000B7-9G for emacs-devel@gnu.org; Thu, 02 Nov 2006 13:34:06 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GfhO5-000070-G4 for emacs-devel@gnu.org; Thu, 02 Nov 2006 13:34:05 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GfhO5-00006w-AW for emacs-devel@gnu.org; Thu, 02 Nov 2006 13:34:01 -0500 Original-Received: from [213.165.64.20] (helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.52) id 1GfhO5-00047E-1x for emacs-devel@gnu.org; Thu, 02 Nov 2006 13:34:01 -0500 Original-Received: (qmail invoked by alias); 02 Nov 2006 18:33:59 -0000 Original-Received: from M3197P010.adsl.highway.telekom.at (EHLO [88.117.47.138]) [88.117.47.138] by mail.gmx.net (mp037) with SMTP; 02 Nov 2006 19:33:59 +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:61617 Archived-At: Good evening, Alan > The cause of this (as Martin (almost) discerned) is that the handling of > (eq open-paren-in-column-0-is-defun-start nil) in begining-of-defun-raw > hasn't been implemented. The function just looks for a "(" in C0 > regardless of that variable. > > "Clearly", when that variable is nil, a defun can begin at no place > other > than a paren at the outermost level. Therefore, the function must scan > the entire source file from BOB, as in the earliest days. No! That would be a serious regression. Font-locking should never be forced to scan from BOB. Observe that this would only serve to handle the rare case where a user puts a paren in column zero of a C comment. I think warning about such parens as in emacs-lisp-mode is sufficient. Please try to make use of Richard's `font-lock-syntax-paren-check' from this thread as with (put font-lock-beginning-of-syntax-function 'font-lock-syntax-paren-check t) Moreover, any such code as yours should (1) Consult `syntax-ppss' first. (2) Try to use the 9th field of the return value of `parse-partial-sexp' to find the outermost paren instead of up-/forward-/backward-listing. (3) Crowd the cache of `syntax-ppss' in order to avoid further scans.