From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#192: regexp does not work as documented Date: Sun, 11 May 2008 14:44:12 -0400 Message-ID: References: <87k5i8ukq8.fsf@stupidchicken.com> <200805061335.11379.bruno@clisp.org> <48204B3D.6000500@gmx.at> <4826A303.3030002@gmx.at> <87abiwoqzd.fsf@stupidchicken.com> Reply-To: Stefan Monnier , 192@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1210531928 21032 80.91.229.12 (11 May 2008 18:52:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 11 May 2008 18:52:08 +0000 (UTC) Cc: Chong Yidong , 192@emacsbugs.donarmstrong.com, Bruno Haible , emacs-devel@gnu.org To: David Koppelman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun May 11 20:52:45 2008 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JvGf5-0005OV-J6 for geb-bug-gnu-emacs@m.gmane.org; Sun, 11 May 2008 20:52:43 +0200 Original-Received: from localhost ([127.0.0.1]:45402 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JvGeM-0006JV-UA for geb-bug-gnu-emacs@m.gmane.org; Sun, 11 May 2008 14:51:58 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JvGe9-0006EM-HO for bug-gnu-emacs@gnu.org; Sun, 11 May 2008 14:51:45 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JvGe7-0006Dd-DD for bug-gnu-emacs@gnu.org; Sun, 11 May 2008 14:51:44 -0400 Original-Received: from [199.232.76.173] (port=45947 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JvGe7-0006DZ-33 for bug-gnu-emacs@gnu.org; Sun, 11 May 2008 14:51:43 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:42706) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JvGe6-0006Zw-GO for bug-gnu-emacs@gnu.org; Sun, 11 May 2008 14:51:42 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m4BIpdlY022112; Sun, 11 May 2008 11:51:40 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id m4BIo3qS021511; Sun, 11 May 2008 11:50:03 -0700 X-Loop: don@donarmstrong.com Resent-From: Stefan Monnier Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Sun, 11 May 2008 18:50:03 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 192 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 192-submit@emacsbugs.donarmstrong.com id=B192.121053146220865 (code B ref 192); Sun, 11 May 2008 18:50:03 +0000 Original-Received: (at 192) by emacsbugs.donarmstrong.com; 11 May 2008 18:44:22 +0000 Original-Received: from ironport2-out.teksavvy.com (ironport2-out.pppoe.ca [206.248.154.182]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m4BIiINA020859 for <192@emacsbugs.donarmstrong.com>; Sun, 11 May 2008 11:44:20 -0700 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmoCABPbJkjO+JgrdGdsb2JhbACBU5A5ASeXBA X-IronPort-AV: E=Sophos;i="4.27,469,1204520400"; d="scan'208";a="20288304" Original-Received: from smtp.pppoe.ca (HELO smtp.teksavvy.com) ([65.39.196.238]) by ironport2-out.teksavvy.com with ESMTP; 11 May 2008 14:44:12 -0400 Original-Received: from pastel.home ([206.248.152.43]) by smtp.teksavvy.com (Internet Mail Server v1.0) with ESMTP id RXD65612; Sun, 11 May 2008 14:44:12 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 25DDD8265; Sun, 11 May 2008 14:44:12 -0400 (EDT) In-Reply-To: (David Koppelman's message of "Sun, 11 May 2008 10:36:49 -0500") 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 (newer, 3) Resent-Date: Sun, 11 May 2008 14:51:44 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:17960 Archived-At: > My latest plan is to do what Chong Yidong suggests, setting up text > properties so that font-lock DTRT, though it doesn't seem as hard as he > suggests (I'm still in the naive enthusiasm stage). Indeed, it shouldn't be that hard. > I tried adding the font-lock-multiline property to the face property > list passed to font lock and that did the trick, even with the > font-lock-multiline variable nil. That may not be enough. You'll probably want to do something like what smerge does: (while (re-search-forward nil t) (font-lock-fontify-region (match-beginning 0) (match-end 0))) this will find all the multiline elements. And the font-lock-multiline property you add will make sure that those that were found will not disappear accidentally because of some later refontification. > I rather do that than turn on font-lock-multiline because I'm assuming > that font-lock-multiline is set to nil in most cases for > a good reason. Setting the `font-lock-multiline' variable to t has a performance cost. > I actually thought about properly parsing the regexp, but the effort to > do that could be spent on making multi-line patterns work properly, at > least if they don't span too many lines. If someone wants that, I have a parser that takes a regexp and turns it into something like `rx' syntax. It uses my lex.el library (which takes an `rx'-like input syntax). > One more thing, multi-line regexp matches don't work properly even > with font-lock-multiline t when jit-lock is being used in a buffer > without syntactic fontification and using the default setting of > jit-lock-contextually, setting it to t gets multi-line fontification > to work. The `font-lock-multiline' variable only tells font-lock that if it ever bumps into a multiline element, it should mark it (with the font-lock-multiline property) so that it will not re-fontify it as a whole if it ever needs to refontify it. So it doesn't solve the problem of "how do I make sure that font-lock indeed finds the multiline element". Multiline elements can only be found when font-locking a large enough piece of text, which tends to only happen during the initial fontification, or during background or contextual refontification, or during an explicit call such as in the above while loop. Stefan