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: Sat, 10 May 2008 14:18:59 -0500 Message-ID: References: <87k5i8ukq8.fsf@stupidchicken.com> <200805061335.11379.bruno@clisp.org> <48204B3D.6000500@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1210447169 22563 80.91.229.12 (10 May 2008 19:19:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 10 May 2008 19:19:29 +0000 (UTC) Cc: Chong Yidong , 192@emacsbugs.donarmstrong.com, Bruno Haible , emacs-devel@gnu.org To: martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat May 10 21:20:05 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 1Juubz-00072t-Ig for ged-emacs-devel@m.gmane.org; Sat, 10 May 2008 21:20:03 +0200 Original-Received: from localhost ([127.0.0.1]:58580 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JuubH-0001DN-12 for ged-emacs-devel@m.gmane.org; Sat, 10 May 2008 15:19:19 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JuubC-0001Cw-HA for emacs-devel@gnu.org; Sat, 10 May 2008 15:19:14 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JuubB-0001Cd-3w for emacs-devel@gnu.org; Sat, 10 May 2008 15:19:14 -0400 Original-Received: from [199.232.76.173] (port=60688 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JuubA-0001Ca-Th for emacs-devel@gnu.org; Sat, 10 May 2008 15:19:12 -0400 Original-Received: from ecelsrv1.ece.lsu.edu ([130.39.223.98]:45834) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JuubA-0000ib-Fc for emacs-devel@gnu.org; Sat, 10 May 2008 15:19:12 -0400 Original-Received: from localhost (unknown [127.0.0.1]) by ecelsrv1.ece.lsu.edu (Postfix) with ESMTP id 676AF2839E; Sat, 10 May 2008 19:19:00 +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 D1Vpz2MRw8ec; Sat, 10 May 2008 14:18:59 -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 B248A28336; Sat, 10 May 2008 14:18:59 -0500 (CDT) In-Reply-To: <48204B3D.6000500@gmx.at> (martin rudalics's message of "Tue, 06 May 2008 14:12:45 +0200") 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:96940 Archived-At: I was able to reproduce the problem with Bruno Haible's testcase and font-lock-multiline t does "fix" it. However martin rudalics warns that font-lock-multiline won't work for all cases and provides an example idea (below). I can't get that to fail. That is, with font-lock-multiline t the text was correctly fontified (though after a pause). My realization of the example was to remove and then add the first quotation mark from one of the interior lines below (also tried with more quoted lines): msgstr "" "Project-Id-Version: GNU gettext-tools 0.16.2-pre5\n" "Report-Msgid-Bugs-To: bug-gnu-gettext@gnu.org\n" "POT-Creation-Date: 2007-11-02 03:23+0100\n" "PO-Revision-Date: 2007-10-27 13:35+0200\n" "Last-Translator: Christophe Combelles \n" "Last-Translator: Christophe Combelles \n" x The fix I'm contemplating would be to warn the user when a multi-line regexp was added interactively and font-lock-multiline was nil, and then perhaps to offer to set font-lock-multiline to t (or to not set it, or to stop asking). martin rudalics writes: >> Can someone help me find a workaround, then? If not, I would have to give up >> maintaining po-mode as part of GNU gettext. Said function is central in >> Emacs po-mode (everything else relies on it), and if multi-line regular >> expressions don't work, I don't know how this function could be rewritten. > > Don't worry, Stefan will find the solution. First of all you will > probably have to > > (setq font-lock-multiline t) > > in the respective buffer. This will _not_ always DTRT after a buffer > modification, as, for example, in > > AAAA > > CCCC > > BBBB > > where AAAA stands for some old text previously matched by your regexp, > CCCC for some new text inserted (or old text removed), and BBBB for some > text which, after the change, is now matched by the regexp (or not > matched any more): In this case BBBB will be wrongly highlighted now. > Alan uses the notorious > > `font-lock-extend-jit-lock-region-after-change' > > function to handle this, but it's not immediately clear how to apply > this here. If everything else fails you will have to refontify till > `window-end' (I prefer using a timer for such refontifications).