From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Koppelman Newsgroups: gmane.emacs.devel Subject: Re: regexp does not work as documented Date: Mon, 12 May 2008 10:03:52 -0500 Message-ID: References: <87k5i8ukq8.fsf@stupidchicken.com> <200805061335.11379.bruno@clisp.org> <48204B3D.6000500@gmx.at> <4826A303.3030002@gmx.at> <87abiwoqzd.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1210604733 16175 80.91.229.12 (12 May 2008 15:05:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 12 May 2008 15:05:33 +0000 (UTC) Cc: martin rudalics , Chong Yidong , 192@emacsbugs.donarmstrong.com, Bruno Haible , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 12 17:06:08 2008 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 1JvZaS-0004rz-Bj for ged-emacs-devel@m.gmane.org; Mon, 12 May 2008 17:05:51 +0200 Original-Received: from localhost ([127.0.0.1]:56960 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JvZZj-0006Sm-Du for ged-emacs-devel@m.gmane.org; Mon, 12 May 2008 11:04:27 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JvZZV-0006OM-Tk for emacs-devel@gnu.org; Mon, 12 May 2008 11:04:14 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JvZZT-0006Mq-7P for emacs-devel@gnu.org; Mon, 12 May 2008 11:04:12 -0400 Original-Received: from [199.232.76.173] (port=42349 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JvZZT-0006Mh-0K for emacs-devel@gnu.org; Mon, 12 May 2008 11:04:11 -0400 Original-Received: from ecelsrv1.ece.lsu.edu ([130.39.223.98]:43374) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JvZZS-0000tP-C0 for emacs-devel@gnu.org; Mon, 12 May 2008 11:04:10 -0400 Original-Received: from localhost (unknown [127.0.0.1]) by ecelsrv1.ece.lsu.edu (Postfix) with ESMTP id 47536283CA; Mon, 12 May 2008 15:03:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at ece.lsu.edu Original-Received: from ecelsrv1.ece.lsu.edu ([127.0.0.1]) by localhost (ecelsrv1.ece.lsu.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EhHBp4hL8c4p; Mon, 12 May 2008 10:03:52 -0500 (CDT) Original-Received: from nested.ece.lsu.edu (nested.ece.lsu.edu [130.39.222.143]) by ecelsrv1.ece.lsu.edu (Postfix) with ESMTP id 741F6283C6; Mon, 12 May 2008 10:03:52 -0500 (CDT) In-Reply-To: (Stefan Monnier's message of "Sun, 11 May 2008 21:28:18 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) 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:97032 Archived-At: > I guess I simply do not understand what you propose. Any improvement in > the multiline handling is welcome, but beware: this is not an easy area. I'm proposing that font-lock divide keywords into two or three classes, ordinary, multi-line, and maybe mega-line, matches for multi-line and mega-line keywords would be over much larger regions. Here is how it might work with two classes (keep in mind that I don't yet have a thorough understanding of font-lock and jit-lock): Multi-line keywords are explicitly identified as such, perhaps through keyword syntax or the way they are given to font-lock (say, using font-lock-multiline-keywords). Explicit identification avoids performance problems from keywords that, though technically multi-line, rarely span more than a few lines. Functions such as font-lock-default-fontify-region would find two sets of extended regions, ordinary and multi, running functions on two hooks for this purpose. The multi-line hook might extend the region based on the size of the largest supported match rather than using the multline property. The multiline property might still be useful for non-deferred handling of existing matches. Functions such as font-lock-fontify-keywords-region would be passed both extended regions and use the region appropriate for each keyword they process. The large region is only used on the few multi-line patterns that need it. Here I'm assuming that a mode might have hundreds of single-line (or two-line) keywords and only a few multi-line keywords, and the multi-line keywords might span no more than hundreds of lines. We could guarantee that matches for such patterns are perfect (using a line-count-limit variable). If there were a third class, mega-line, it would have its own text property and region-extension hook. Stefan Monnier writes: >> A better solution would be to have font-lock use multi-line extended >> regions selectively. Perhaps a hint in the current keyword syntax >> (say, explicitly applying the font-lock-multiline property), or a >> separate method for providing multi-line keywords to font-lock. > > I don't understand the difference between the above and the application > of font-lock-multiline properties which you seem to have tried and rejected. > > I don't necessarily disagree with your rejection of font-lock-multiline: > it can have disastrous effect indeed if the multiline region becomes large. > >> Such keywords would get the multi-line extended regions, the other >> just the whole-line extensions (or whatever the hooks do). >> Is this something the font-lock maintainers would consider? > > I guess I simply do not understand what you propose. Any improvement in > the multiline handling is welcome, but beware: this is not an easy area. >