From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: regexp does not work as documented Date: Tue, 06 May 2008 00:20:31 -0400 Message-ID: <87k5i8ukq8.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1210047929 14506 80.91.229.12 (6 May 2008 04:25:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 6 May 2008 04:25:29 +0000 (UTC) Cc: koppel@ece.lsu.edu, 192@emacsbugs.donarmstrong.com, Bruno Haible To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue May 06 06:26:04 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 1JtEkb-0004uE-Qt for ged-emacs-devel@m.gmane.org; Tue, 06 May 2008 06:26:02 +0200 Original-Received: from localhost ([127.0.0.1]:45019 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JtEjt-0005LM-Vi for ged-emacs-devel@m.gmane.org; Tue, 06 May 2008 00:25:18 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JtEjq-0005LG-UD for emacs-devel@gnu.org; Tue, 06 May 2008 00:25:14 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JtEjp-0005L4-U2 for emacs-devel@gnu.org; Tue, 06 May 2008 00:25:14 -0400 Original-Received: from [199.232.76.173] (port=52222 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JtEjp-0005L1-Pk for emacs-devel@gnu.org; Tue, 06 May 2008 00:25:13 -0400 Original-Received: from cyd.mit.edu ([18.115.2.24]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JtEjp-0000n3-JL for emacs-devel@gnu.org; Tue, 06 May 2008 00:25:13 -0400 Original-Received: by cyd.mit.edu (Postfix, from userid 1000) id 7245D4E304; Tue, 6 May 2008 00:20:31 -0400 (EDT) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) 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:96565 Archived-At: > $ emacs fr.po > M-x highlight-regexp > > Regexp to highlight (enter this with Ctrl-Q Ctrl-J for each of the two > newlines): > > ^msgstr\(\[[0-9]\]\)?.* > \(".* > \)* > > Highlight using face: hi-yellow > > Then move around in the buffer and look which lines are highlighted. > In the first match already, only 5 out of 11 lines are highlighted. I believe this bug arises because highlight-regexp uses font-lock to highlight the regular expression, and the font-lock engine is intentionally limiting the region to search for the multi-line regular expression. OTOH, I don't see what we can do about this problem. Maybe we could add a note to the docstring of highlight-regexp saying that multi-line regular expressions are problematic? Does anyone have a suggestion? BTW, here is a simplified recipe, for those who didn't download the attached file: 1. Copy the following text, between the "---...----" lines, into a buffer ------------------ # Messages fran=C3=A7ais pour GNU gettext. # Copyright =C2=A9 2006 Free Software Foundation, Inc. # Fran=C3=A7ois Pinard , 1996. # # msgid "" 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" "Language-Team: French \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=3DUTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3D2; plural=3D(n > 1);\n" ------------------ 2. M-: (highlight-regexp "^m.*\n\\(\".*\n\\)+") RET Note that the last two lines remain unhighlighted.