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: Multiline font-lock Date: Wed, 14 Jan 2009 21:47:29 -0500 Message-ID: References: <87fxjlwkbv.fsf@mithrandir.homeunix.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1231987665 23596 80.91.229.12 (15 Jan 2009 02:47:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 15 Jan 2009 02:47:45 +0000 (UTC) Cc: emacs-devel@gnu.org To: "Jose A. Ortega Ruiz" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jan 15 03:48:56 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LNIHu-0007Zk-7h for ged-emacs-devel@m.gmane.org; Thu, 15 Jan 2009 03:48:54 +0100 Original-Received: from localhost ([127.0.0.1]:40475 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LNIGd-00032M-GG for ged-emacs-devel@m.gmane.org; Wed, 14 Jan 2009 21:47:35 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LNIGZ-00032D-PP for emacs-devel@gnu.org; Wed, 14 Jan 2009 21:47:31 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LNIGZ-00031v-13 for emacs-devel@gnu.org; Wed, 14 Jan 2009 21:47:31 -0500 Original-Received: from [199.232.76.173] (port=35247 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LNIGY-00031s-Uo for emacs-devel@gnu.org; Wed, 14 Jan 2009 21:47:30 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:62942) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LNIGX-0004NL-Rw; Wed, 14 Jan 2009 21:47:29 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AicFAEgybklMCpxj/2dsb2JhbACBbM05hW6BbA X-IronPort-AV: E=Sophos;i="4.37,265,1231131600"; d="scan'208";a="32324097" Original-Received: from 76-10-156-99.dsl.teksavvy.com (HELO pastel.home) ([76.10.156.99]) by ironport2-out.teksavvy.com with ESMTP; 14 Jan 2009 21:47:29 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 1B1437F41; Wed, 14 Jan 2009 21:47:29 -0500 (EST) In-Reply-To: <87fxjlwkbv.fsf@mithrandir.homeunix.net> (Jose A. Ortega Ruiz's message of "Thu, 15 Jan 2009 00:15:32 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. 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:107884 Archived-At: > I need multiline font lock in a major mode that i'm writing. I read in > the elisp manual (and have actually checked it) that using regexps > matching multiple lines in font-lock-keywords is a bad idea. > I've also read the node dedicated to multiline font-lock in the > manual, but it's not clear to me how it works. Could you please point > me to an example of that mechanism being used? As explained in the manual, there are different mechanisms available, and which one to use depends on the particular situation. You can either use syntax-tables to turn your multiline thingy into a pseudo-comment or pseudo-string (and then use font-lock-syntactic-face-function to highlight it in a different way). Or you can use the font-lock-multiline text-property (not to be confused with the variable) on the multiline elements once you've found them. Or you can use font-lock-extend-region-functions and use your own ad-hoc code to make sure that your regexps always get to look at complete multiline elements. Stefan