From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Mackenzie, Alan" Newsgroups: gmane.emacs.devel Subject: AW: font-locking and open parens in column 0 Date: Fri, 3 Nov 2006 09:44:09 +0100 Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1162543549 12617 80.91.229.2 (3 Nov 2006 08:45:49 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 3 Nov 2006 08:45:49 +0000 (UTC) Cc: Richard Stallman , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 03 09:45:47 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 1GfugK-0003uq-Fa for ged-emacs-devel@m.gmane.org; Fri, 03 Nov 2006 09:45:46 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GfugJ-0005Xg-Tj for ged-emacs-devel@m.gmane.org; Fri, 03 Nov 2006 03:45:43 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Gfuf0-0005Ld-I3 for emacs-devel@gnu.org; Fri, 03 Nov 2006 03:44:23 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Gfuew-0005KQ-0g for emacs-devel@gnu.org; Fri, 03 Nov 2006 03:44:19 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Gfuev-0005Jy-HI for emacs-devel@gnu.org; Fri, 03 Nov 2006 03:44:17 -0500 Original-Received: from [64.18.1.187] (helo=exprod6og53.obsmtp.com) by monty-python.gnu.org with smtp (Exim 4.52) id 1Gfueq-0004D5-V7; Fri, 03 Nov 2006 03:44:13 -0500 Original-Received: from source ([194.121.90.51]) by exprod6ob53.postini.com ([64.18.5.12]) with SMTP; Fri, 03 Nov 2006 00:44:10 PST Original-Received: from oekaw2ex01.hbi.ad.harman.com (unverified [172.16.1.72]) by oekaw2vw01.hbi.ad.harman.com (Content Technologies SMTPRS 4.3.10) with ESMTP id ; Fri, 3 Nov 2006 09:37:29 +0100 Original-Received: from OEKAW2EXVS03.hbi.ad.harman.com ([172.16.1.97]) by oekaw2ex01.hbi.ad.harman.com with Microsoft SMTPSVC (5.0.2195.6713); Fri, 3 Nov 2006 09:44:09 +0100 X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 Content-class: urn:content-classes:message X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: font-locking and open parens in column 0 Thread-Index: Acb+rXmykopaWL9yQZGlAyyA0ajhnAAcwcbg Original-To: "martin rudalics" X-OriginalArrivalTime: 03 Nov 2006 08:44:09.0401 (UTC) FILETIME=[3A9E8290:01C6FF24] 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:61672 Archived-At: Hi, Martin!=20 >-----Urspr=FCngliche Nachricht----- >Von: martin rudalics [mailto:rudalics@gmx.at]=20 >Gesendet: Donnerstag, 2. November 2006 19:32 >An: Mackenzie, Alan >Cc: emacs-devel@gnu.org; Richard Stallman; Alan Mackenzie >Betreff: Re: font-locking and open parens in column 0 >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 oth= er > > 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. 1 2 3 4 5 6 7 3 I agree with you. :-) However, my patch is to do with beginning-of-defun-raw, not font-locking. Are you saying that open-paren-in-column-0-is-defun-start shouldn't exist at all? When it is nil, a paren in column 0 may not, of itself, be regarded as a defun start. Richard, please say what you think about this. I would say, rather, that font-locking should not use b-o-defun-raw when o-p-i-c-0-i-d-s is nil, except in exceptional circumstances. The case you spotted in syntax.c (and I've really no idea how you did ;-), is such an exceptional case. CC Mode caches parenthesis structures. My patch did fix the bug (a whole screenful of misfontified string in syntax.c), though, didn't it? >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 .... You're talking about my patch to beginning-of-defun-raw, here, not the stuff in CC Mode. I don't have the source files to hand at the moment. >(1) Consult `syntax-ppss' first. > >(2) Try to use the 9th field of the return value of=20 >`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. OK, thanks! I'll need to learn about these optimisations. begining-of-defun-raw, when used in font locking, could be distressingly slow without them. --=20 Alan Mackenzie (Ittersbach, Germany) ******************************************* Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informati= onen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtuemli= ch erhalten haben, informieren Sie bitte sofort den Absender und loeschen S= ie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe diese= r Mail ist nicht gestattet. =20 This e-mail may contain confidential and/or privileged information. If you = are not the intended recipient (or have received this e-mail in error) plea= se notify the sender immediately and delete this e-mail. Any unauthorized c= opying, disclosure or distribution of the contents in this e-mail is strict= ly forbidden. *******************************************