From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [sigra@home.se: C++-mode: Syntax highlighting: wrong color for function identifier depending on the kind of whitespace that follows] Date: Sat, 19 Mar 2005 17:30:49 -0500 Message-ID: <871xabz2yu.fsf-monnier+emacs@gnu.org> References: <5bk6of409s.fsf@lister.roxen.com> <5bu0nfplh2.fsf@lister.roxen.com> <87br9n9gxu.fsf-monnier+emacs@gnu.org> <5b8y4jgtq8.fsf@lister.roxen.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1111271826 28029 80.91.229.2 (19 Mar 2005 22:37:06 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 19 Mar 2005 22:37:06 +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 Mar 19 23:37:06 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DCmZ4-00082k-62 for ged-emacs-devel@m.gmane.org; Sat, 19 Mar 2005 23:37:02 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DCmpq-0006PP-2s for ged-emacs-devel@m.gmane.org; Sat, 19 Mar 2005 17:54:22 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DCmpD-0006Gp-4u for emacs-devel@gnu.org; Sat, 19 Mar 2005 17:53:43 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DCmp1-0006Ae-Hf for emacs-devel@gnu.org; Sat, 19 Mar 2005 17:53:35 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DCmoz-00068X-5h for emacs-devel@gnu.org; Sat, 19 Mar 2005 17:53:29 -0500 Original-Received: from [209.226.175.93] (helo=tomts36-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DCmT9-0006ob-Pn; Sat, 19 Mar 2005 17:30:56 -0500 Original-Received: from alfajor ([67.68.217.141]) by tomts36-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20050319223050.VBXX1694.tomts36-srv.bellnexxia.net@alfajor>; Sat, 19 Mar 2005 17:30:50 -0500 Original-Received: by alfajor (Postfix, from userid 1000) id 9E013D72F3; Sat, 19 Mar 2005 17:30:49 -0500 (EST) Original-To: bug-cc-mode@gnu.org In-Reply-To: <5b8y4jgtq8.fsf@lister.roxen.com> (Martin Stjernholm's message of "Sat, 19 Mar 2005 23:23:59 +0100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) 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 X-MailScanner-To: ged-emacs-devel@m.gmane.org Xref: news.gmane.org gmane.emacs.devel:34790 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:34790 >>> That doesn't work very well while the thing is entered, does it? First >>> you see "s[foo]{" while it's being entered, then you see the next line >>> " bar", and lastly "}x". Your patterns will never see the whole >>> construct at once. (They will however see the buffer end, or even >>> worse some completely unrelated code that happen to be on the >>> following lines and which might confuse them.) >> >> I use font-lock-syntactic-face-function, > (I had to investigate what that really does, in case it worked out > some fantastic magic. But afaics it doesn't. ;) No, no fantastic magic. But in some cases, together with font-lock-syntactic-keywords, it's a good way to get "multi-line keywords". Other examples: verbatim envs in LaTeX, heredocs in sh-script, things like that. I also had a hack that marked strings with a missing \ at the end of the line using this trick, but the behavior had some rough edges. >> so I don't need to "see the whole pattern" (I basically keep track >> of the intermediate state in the parse-partial-sexp state). > If I understand this correctly, this means that your example falls > under the special case when the construct can be recognized from the > first line alone. Unfortunately things aren't always that easy. This trick is of restricted applicability, of course, Stefan